| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_CORE_PAYMENT_REQUEST_DATA_UTIL_H_ | 5 #ifndef COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_ |
| 6 #define COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_ | 6 #define COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 const std::string& country_code); | 64 const std::string& country_code); |
| 65 | 65 |
| 66 // Formats the given number |phone_number| to | 66 // Formats the given number |phone_number| to |
| 67 // i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat::E164 format by using | 67 // i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat::E164 format by using |
| 68 // i18n::phonenumbers::PhoneNumberUtil::Format, as defined in the Payment | 68 // i18n::phonenumbers::PhoneNumberUtil::Format, as defined in the Payment |
| 69 // Request spec | 69 // Request spec |
| 70 // (https://w3c.github.io/browser-payment-api/#paymentrequest-updated-algorithm) | 70 // (https://w3c.github.io/browser-payment-api/#paymentrequest-updated-algorithm) |
| 71 std::string FormatPhoneForResponse(const std::string& phone_number, | 71 std::string FormatPhoneForResponse(const std::string& phone_number, |
| 72 const std::string& country_code); | 72 const std::string& country_code); |
| 73 | 73 |
| 74 // Formats |card_number| for display. For example, "4111111111111111" is |
| 75 // formatted into "4111 1111 1111 1111". This method does not format masked card |
| 76 // numbers, which start with a letter. |
| 77 base::string16 FormatCardNumberForDisplay(const base::string16& card_number); |
| 78 |
| 74 // Returns a country code to be used when validating this profile. If the | 79 // Returns a country code to be used when validating this profile. If the |
| 75 // profile has a valid country code set, it is returned. If not, a country code | 80 // profile has a valid country code set, it is returned. If not, a country code |
| 76 // associated with |app_locale| is used as a fallback. | 81 // associated with |app_locale| is used as a fallback. |
| 77 std::string GetCountryCodeWithFallback(const autofill::AutofillProfile* profile, | 82 std::string GetCountryCodeWithFallback(const autofill::AutofillProfile* profile, |
| 78 const std::string& app_locale); | 83 const std::string& app_locale); |
| 79 | 84 |
| 80 } // namespace data_util | 85 } // namespace data_util |
| 81 } // namespace payments | 86 } // namespace payments |
| 82 | 87 |
| 83 #endif // COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_ | 88 #endif // COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_ |
| OLD | NEW |