Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: components/payments/content/payment_details_validation.cc

Issue 2852363002: [payment] display mixed currency in item list and shipping optiopns. When there is more than one cu… (Closed)
Patch Set: fixing dumb compilation error! Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/payments/content/payment_details_validation.h" 5 #include "components/payments/content/payment_details_validation.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "components/payments/content/payments_validators.h" 10 #include "components/payments/content/payments_validators.h"
(...skipping 17 matching lines...) Expand all
28 if (item->amount->currency.empty()) { 28 if (item->amount->currency.empty()) {
29 *error_message = "Currency code required"; 29 *error_message = "Currency code required";
30 return false; 30 return false;
31 } 31 }
32 32
33 if (item->amount->value.empty()) { 33 if (item->amount->value.empty()) {
34 *error_message = "Currency value required"; 34 *error_message = "Currency value required";
35 return false; 35 return false;
36 } 36 }
37 37
38 if (total && item->amount->currency != total->amount->currency) {
39 *error_message = "Currencies must all be equal";
40 return false;
41 }
42
43 if (item->amount->currency_system.empty()) { 38 if (item->amount->currency_system.empty()) {
44 *error_message = "Currency system can't be empty"; 39 *error_message = "Currency system can't be empty";
45 return false; 40 return false;
46 } 41 }
47 42
48 if (!payments::PaymentsValidators::isValidCurrencyCodeFormat( 43 if (!payments::PaymentsValidators::isValidCurrencyCodeFormat(
49 item->amount->currency, item->amount->currency_system, 44 item->amount->currency, item->amount->currency_system,
50 error_message)) { 45 error_message)) {
51 return false; 46 return false;
52 } 47 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (!validatePaymentDetailsModifiers(details->modifiers, details->total, 159 if (!validatePaymentDetailsModifiers(details->modifiers, details->total,
165 error_message)) 160 error_message))
166 return false; 161 return false;
167 } 162 }
168 if (!PaymentsValidators::isValidErrorMsgFormat(details->error, error_message)) 163 if (!PaymentsValidators::isValidErrorMsgFormat(details->error, error_message))
169 return false; 164 return false;
170 return true; 165 return true;
171 } 166 }
172 167
173 } // namespace payments 168 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698