| Index: ios/chrome/browser/payments/payment_request_util.mm
|
| diff --git a/ios/chrome/browser/payments/payment_request_util.mm b/ios/chrome/browser/payments/payment_request_util.mm
|
| index 3b643adf7075932e797e1499d83db0b685fa8048..07595166e1f3500e4d6e0b96cf7e6166afdd5b0f 100644
|
| --- a/ios/chrome/browser/payments/payment_request_util.mm
|
| +++ b/ios/chrome/browser/payments/payment_request_util.mm
|
| @@ -9,8 +9,10 @@
|
| #include "base/strings/sys_string_conversions.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "components/autofill/core/browser/autofill_profile.h"
|
| +#include "components/autofill/core/browser/credit_card.h"
|
| #include "components/autofill/core/browser/field_types.h"
|
| #include "components/autofill/core/browser/personal_data_manager.h"
|
| +#include "components/autofill/core/browser/validation.h"
|
| #include "components/payments/core/payment_request_data_util.h"
|
| #include "components/payments/core/strings_util.h"
|
| #include "components/strings/grit/components_strings.h"
|
| @@ -71,6 +73,26 @@ NSString* GetAddressNotificationLabelFromAutofillProfile(
|
| return !label.empty() ? base::SysUTF16ToNSString(label) : nil;
|
| }
|
|
|
| +BOOL IsCreditCardCompleteForPayment(
|
| + const autofill::CreditCard& credit_card,
|
| + const std::vector<autofill::AutofillProfile*>& billing_profiles) {
|
| + // EXPIRED cards are considered valid for payment. The user will be prompted
|
| + // to enter the new expiration at the CVC step.
|
| + return autofill::GetCompletionStatusForCard(
|
| + credit_card, GetApplicationContext()->GetApplicationLocale(),
|
| + billing_profiles) <= autofill::CREDIT_CARD_EXPIRED;
|
| +}
|
| +
|
| +NSString* GetPaymentMethodNotificationLabelFromCreditCard(
|
| + const autofill::CreditCard& credit_card,
|
| + const std::vector<autofill::AutofillProfile*>& billing_profiles) {
|
| + base::string16 label = autofill::GetCompletionMessageForCard(
|
| + autofill::GetCompletionStatusForCard(
|
| + credit_card, GetApplicationContext()->GetApplicationLocale(),
|
| + billing_profiles));
|
| + return !label.empty() ? base::SysUTF16ToNSString(label) : nil;
|
| +}
|
| +
|
| NSString* GetShippingSectionTitle(payments::PaymentShippingType shipping_type) {
|
| switch (shipping_type) {
|
| case payments::PaymentShippingType::SHIPPING:
|
|
|