OLD | NEW |
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 #ifndef PaymentsValidators_h | 5 #ifndef PaymentsValidators_h |
6 #define PaymentsValidators_h | 6 #define PaymentsValidators_h |
7 | 7 |
8 #include "modules/ModulesExport.h" | 8 #include "modules/ModulesExport.h" |
9 #include "public/platform/modules/payments/payment_request.mojom-blink.h" | 9 #include "public/platform/modules/payments/payment_request.mojom-blink.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
11 #include "wtf/text/WTFString.h" | 11 #include "wtf/text/WTFString.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class MODULES_EXPORT PaymentsValidators final { | 15 class MODULES_EXPORT PaymentsValidators final { |
16 STATIC_ONLY(PaymentsValidators); | 16 STATIC_ONLY(PaymentsValidators); |
17 | 17 |
18 public: | 18 public: |
19 // The most common identifiers are three-letter alphabetic codes as defined by | 19 // The most common identifiers are three-letter alphabetic codes as defined by |
20 // [ISO4217] (for example, "USD" for US Dollars) however any string of at most | 20 // [ISO4217] (for example, "USD" for US Dollars). |system| is a URL that |
21 // 2048 characters is considered valid. Returns false if currency |code| is | 21 // indicates the currency system that the currency identifier belongs to. By |
22 // too long (greater than 2048). | 22 // default, the value is urn:iso:std:iso:4217 indicating that currency is |
| 23 // defined by [[ISO4217]], however any string of at most 2048 characters is |
| 24 // considered valid in other currencySystem. Returns false if currency |code| |
| 25 // is too long (greater than 2048). |
23 static bool isValidCurrencyCodeFormat(const String& code, | 26 static bool isValidCurrencyCodeFormat(const String& code, |
| 27 const String& system, |
24 String* optionalErrorMessage); | 28 String* optionalErrorMessage); |
25 | 29 |
26 // Returns true if |amount| is a valid currency code as defined in ISO 20022 | 30 // Returns true if |amount| is a valid currency code as defined in ISO 20022 |
27 // CurrencyAnd30Amount. | 31 // CurrencyAnd30Amount. |
28 static bool isValidAmountFormat(const String& amount, | 32 static bool isValidAmountFormat(const String& amount, |
29 String* optionalErrorMessage); | 33 String* optionalErrorMessage); |
30 | 34 |
31 // Returns true if |code| is a valid ISO 3166 country code. | 35 // Returns true if |code| is a valid ISO 3166 country code. |
32 static bool isValidCountryCodeFormat(const String& code, | 36 static bool isValidCountryCodeFormat(const String& code, |
33 String* optionalErrorMessage); | 37 String* optionalErrorMessage); |
(...skipping 15 matching lines...) Expand all Loading... |
49 String* optionalErrorMessage); | 53 String* optionalErrorMessage); |
50 | 54 |
51 // Returns false if |error| is too long (greater than 2048). | 55 // Returns false if |error| is too long (greater than 2048). |
52 static bool isValidErrorMsgFormat(const String& code, | 56 static bool isValidErrorMsgFormat(const String& code, |
53 String* optionalErrorMessage); | 57 String* optionalErrorMessage); |
54 }; | 58 }; |
55 | 59 |
56 } // namespace blink | 60 } // namespace blink |
57 | 61 |
58 #endif // PaymentsValidators_h | 62 #endif // PaymentsValidators_h |
OLD | NEW |