Chromium Code Reviews| Index: components/payments/payments_validators.h |
| diff --git a/components/payments/payments_validators.h b/components/payments/payments_validators.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e35b09cf37b4d96728014e4b0f04c01f36b4d2af |
| --- /dev/null |
| +++ b/components/payments/payments_validators.h |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_PAYMENTS_PAYMENTS_VALIDATORS_H_ |
| +#define COMPONENTS_PAYMENTS_PAYMENTS_VALIDATORS_H_ |
| + |
| +#include <string> |
| + |
| +#include "components/payments/payment_request.mojom.h" |
| + |
| +namespace payments { |
| + |
| +class PaymentsValidators { |
| + public: |
| + // The most common identifiers are three-letter alphabetic codes as defined by |
| + // [ISO4217] (for example, "USD" for US Dollars) |
| + // however any string of at most 2048 characters is considered valid. Returns |
| + // false if currency |code| is too long (greater than 2048). |
| + static bool isValidCurrencyCodeFormat(const std::string& code, |
|
please use gerrit instead
2016/10/28 18:38:58
This validator now has "system" parameter.
https:
Kevin Bailey
2016/10/28 20:53:05
I've added the parameter, but no one added it to t
please use gerrit instead
2016/10/31 13:17:33
SGTM. It's good that we're finding these discrepan
Kevin Bailey
2016/10/31 14:10:03
Done.
|
| + std::string* optionalErrorMessage); |
| + |
| + // Returns true if |amount| is a valid currency code as defined in ISO 20022 |
| + // CurrencyAnd30Amount. |
| + static bool isValidAmountFormat(const std::string& amount, |
| + std::string* optionalErrorMessage); |
| +}; |
| + |
| +} // namespace payments |
| + |
| +#endif // COMPONENTS_PAYMENTS_PAYMENTS_VALIDATORS_H_ |