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

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: more minor changes requested by code reviewing 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 !defined(OS_ANDROID)
please use gerrit instead 2017/05/05 19:13:55 Desktop should behave the same as Android. Please
wuandy1 2017/05/05 19:50:11 Done.
38 if (total && item->amount->currency != total->amount->currency) { 39 if (total && item->amount->currency != total->amount->currency) {
39 *error_message = "Currencies must all be equal"; 40 *error_message = "Currencies must all be equal";
40 return false; 41 return false;
41 } 42 }
43 #endif
42 44
43 if (item->amount->currency_system.empty()) { 45 if (item->amount->currency_system.empty()) {
44 *error_message = "Currency system can't be empty"; 46 *error_message = "Currency system can't be empty";
45 return false; 47 return false;
46 } 48 }
47 49
48 if (!payments::PaymentsValidators::isValidCurrencyCodeFormat( 50 if (!payments::PaymentsValidators::isValidCurrencyCodeFormat(
49 item->amount->currency, item->amount->currency_system, 51 item->amount->currency, item->amount->currency_system,
50 error_message)) { 52 error_message)) {
51 return false; 53 return false;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (!validatePaymentDetailsModifiers(details->modifiers, details->total, 166 if (!validatePaymentDetailsModifiers(details->modifiers, details->total,
165 error_message)) 167 error_message))
166 return false; 168 return false;
167 } 169 }
168 if (!PaymentsValidators::isValidErrorMsgFormat(details->error, error_message)) 170 if (!PaymentsValidators::isValidErrorMsgFormat(details->error, error_message))
169 return false; 171 return false;
170 return true; 172 return true;
171 } 173 }
172 174
173 } // namespace payments 175 } // 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