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

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: 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
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 22 matching lines...) Expand all
33 if (item->amount->currency.empty()) { 33 if (item->amount->currency.empty()) {
34 *error_message = "Currency code required"; 34 *error_message = "Currency code required";
35 return false; 35 return false;
36 } 36 }
37 37
38 if (item->amount->value.empty()) { 38 if (item->amount->value.empty()) {
39 *error_message = "Currency value required"; 39 *error_message = "Currency value required";
40 return false; 40 return false;
41 } 41 }
42 42
43 if (total && item->amount->currency != total->amount->currency) {
gogerald1 2017/05/02 18:57:33 This is cross platform code, might '#if !defined(O
wuandy 2017/05/05 15:04:37 Done.
44 *error_message = "Currencies must all be equal";
45 return false;
46 }
47
48 if (item->amount->currency_system.empty()) { 43 if (item->amount->currency_system.empty()) {
49 *error_message = "Currency system can't be empty"; 44 *error_message = "Currency system can't be empty";
50 return false; 45 return false;
51 } 46 }
52 47
53 if (!payments::PaymentsValidators::isValidCurrencyCodeFormat( 48 if (!payments::PaymentsValidators::isValidCurrencyCodeFormat(
54 item->amount->currency, item->amount->currency_system, 49 item->amount->currency, item->amount->currency_system,
55 error_message)) { 50 error_message)) {
56 return false; 51 return false;
57 } 52 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 if (!validatePaymentDetailsModifiers(details->modifiers, details->total, 164 if (!validatePaymentDetailsModifiers(details->modifiers, details->total,
170 error_message)) 165 error_message))
171 return false; 166 return false;
172 } 167 }
173 if (!PaymentsValidators::isValidErrorMsgFormat(details->error, error_message)) 168 if (!PaymentsValidators::isValidErrorMsgFormat(details->error, error_message))
174 return false; 169 return false;
175 return true; 170 return true;
176 } 171 }
177 172
178 } // namespace payments 173 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698