| 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 COMPONENTS_PAYMENTS_PAYMENTS_VALIDATORS_H_ | 5 #ifndef COMPONENTS_PAYMENTS_PAYMENTS_VALIDATORS_H_ |
| 6 #define COMPONENTS_PAYMENTS_PAYMENTS_VALIDATORS_H_ | 6 #define COMPONENTS_PAYMENTS_PAYMENTS_VALIDATORS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "components/payments/payment_request.mojom.h" | 10 #include "components/payments/payment_request.mojom.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Returns true if |code| is a valid ISO 15924 script code. | 40 // Returns true if |code| is a valid ISO 15924 script code. |
| 41 static bool isValidScriptCodeFormat(const std::string& code, | 41 static bool isValidScriptCodeFormat(const std::string& code, |
| 42 std::string* optionalErrorMessage); | 42 std::string* optionalErrorMessage); |
| 43 | 43 |
| 44 // Returns true if the payment address is valid: | 44 // Returns true if the payment address is valid: |
| 45 // - Has a valid region code | 45 // - Has a valid region code |
| 46 // - Has a valid language code, if any. | 46 // - Has a valid language code, if any. |
| 47 // - Has a valid script code, if any. | 47 // - Has a valid script code, if any. |
| 48 // A script code should be present only if language code is present. | 48 // A script code should be present only if language code is present. |
| 49 static bool isValidShippingAddress(const blink::mojom::PaymentAddressPtr&, | 49 static bool isValidShippingAddress(const mojom::PaymentAddressPtr&, |
| 50 std::string* optionalErrorMessage); | 50 std::string* optionalErrorMessage); |
| 51 | 51 |
| 52 // Returns false if |error| is too long (greater than 2048). | 52 // Returns false if |error| is too long (greater than 2048). |
| 53 static bool isValidErrorMsgFormat(const std::string& code, | 53 static bool isValidErrorMsgFormat(const std::string& code, |
| 54 std::string* optionalErrorMessage); | 54 std::string* optionalErrorMessage); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace payments | 57 } // namespace payments |
| 58 | 58 |
| 59 #endif // COMPONENTS_PAYMENTS_PAYMENTS_VALIDATORS_H_ | 59 #endif // COMPONENTS_PAYMENTS_PAYMENTS_VALIDATORS_H_ |
| OLD | NEW |