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

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

Issue 2637603002: [Payments] Use formatter currency code on desktop (Closed)
Patch Set: rebase Created 3 years, 11 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/payment_details_validation.h" 5 #include "components/payments/payment_details_validation.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "components/payments/payment_request.mojom.h" 10 #include "components/payments/payment_request.mojom.h"
(...skipping 26 matching lines...) Expand all
37 if (item->amount->value.empty()) { 37 if (item->amount->value.empty()) {
38 *error_message = "Currency value required"; 38 *error_message = "Currency value required";
39 return false; 39 return false;
40 } 40 }
41 41
42 if (item->amount->currency != total->amount->currency) { 42 if (item->amount->currency != total->amount->currency) {
43 *error_message = "Currencies must all be equal"; 43 *error_message = "Currencies must all be equal";
44 return false; 44 return false;
45 } 45 }
46 46
47 if (item->amount->currencySystem.has_value() && 47 if (item->amount->currency_system.has_value() &&
48 item->amount->currencySystem.value().empty()) { 48 item->amount->currency_system.value().empty()) {
49 *error_message = "Currency system can't be empty"; 49 *error_message = "Currency system can't be empty";
50 return false; 50 return false;
51 } 51 }
52 52
53 if (!payments::PaymentsValidators::isValidCurrencyCodeFormat( 53 if (!payments::PaymentsValidators::isValidCurrencyCodeFormat(
54 item->amount->currency, item->amount->currencySystem.has_value() 54 item->amount->currency, item->amount->currency_system.has_value()
55 ? item->amount->currencySystem.value() 55 ? item->amount->currency_system.value()
56 : "", 56 : "",
57 error_message)) { 57 error_message)) {
58 return false; 58 return false;
59 } 59 }
60 60
61 if (!payments::PaymentsValidators::isValidAmountFormat(item->amount->value, 61 if (!payments::PaymentsValidators::isValidAmountFormat(item->amount->value,
62 error_message)) { 62 error_message)) {
63 return false; 63 return false;
64 } 64 }
65 return true; 65 return true;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (!validatePaymentDetailsModifiers(details->modifiers, details->total, 176 if (!validatePaymentDetailsModifiers(details->modifiers, details->total,
177 error_message)) 177 error_message))
178 return false; 178 return false;
179 } 179 }
180 if (!PaymentsValidators::isValidErrorMsgFormat(details->error, error_message)) 180 if (!PaymentsValidators::isValidErrorMsgFormat(details->error, error_message))
181 return false; 181 return false;
182 return true; 182 return true;
183 } 183 }
184 184
185 } // namespace payments 185 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/payment_sheet_view_controller.cc ('k') | components/payments/payment_request.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698