| 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
[ISO4217] (for example, "USD" for US Dollars) | 19 // The most common identifiers are three-letter alphabetic codes as defined by |
| 20 // however any string of at most 2048 characters is considered valid. Returns
false if currency |code| is too long (greater than 2048). | 20 // [ISO4217] (for example, "USD" for US Dollars) however any string of at most |
| 21 // 2048 characters is considered valid. Returns false if currency |code| is |
| 22 // too long (greater than 2048). |
| 21 static bool isValidCurrencyCodeFormat(const String& code, | 23 static bool isValidCurrencyCodeFormat(const String& code, |
| 22 String* optionalErrorMessage); | 24 String* optionalErrorMessage); |
| 23 | 25 |
| 24 // Returns true if |amount| is a valid currency code as defined in ISO 20022 C
urrencyAnd30Amount. | 26 // Returns true if |amount| is a valid currency code as defined in ISO 20022 |
| 27 // CurrencyAnd30Amount. |
| 25 static bool isValidAmountFormat(const String& amount, | 28 static bool isValidAmountFormat(const String& amount, |
| 26 String* optionalErrorMessage); | 29 String* optionalErrorMessage); |
| 27 | 30 |
| 28 // Returns true if |code| is a valid ISO 3166 country code. | 31 // Returns true if |code| is a valid ISO 3166 country code. |
| 29 static bool isValidCountryCodeFormat(const String& code, | 32 static bool isValidCountryCodeFormat(const String& code, |
| 30 String* optionalErrorMessage); | 33 String* optionalErrorMessage); |
| 31 | 34 |
| 32 // Returns true if |code| is a valid ISO 639 language code. | 35 // Returns true if |code| is a valid ISO 639 language code. |
| 33 static bool isValidLanguageCodeFormat(const String& code, | 36 static bool isValidLanguageCodeFormat(const String& code, |
| 34 String* optionalErrorMessage); | 37 String* optionalErrorMessage); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 46 String* optionalErrorMessage); | 49 String* optionalErrorMessage); |
| 47 | 50 |
| 48 // Returns false if |error| is too long (greater than 2048). | 51 // Returns false if |error| is too long (greater than 2048). |
| 49 static bool isValidErrorMsgFormat(const String& code, | 52 static bool isValidErrorMsgFormat(const String& code, |
| 50 String* optionalErrorMessage); | 53 String* optionalErrorMessage); |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 } // namespace blink | 56 } // namespace blink |
| 54 | 57 |
| 55 #endif // PaymentsValidators_h | 58 #endif // PaymentsValidators_h |
| OLD | NEW |