Index: components/payments/core/payment_request_data_util.cc |
diff --git a/components/payments/core/payment_request_data_util.cc b/components/payments/core/payment_request_data_util.cc |
index 9a5f5f4f9636f30dc2b60ac6423a53d4a92ff5c3..67dd07f8eef6220221b1de6657e5123572347d68 100644 |
--- a/components/payments/core/payment_request_data_util.cc |
+++ b/components/payments/core/payment_request_data_util.cc |
@@ -71,7 +71,7 @@ PaymentAddress GetPaymentAddressFromAutofillProfile( |
BasicCardResponse GetBasicCardResponseFromAutofillCreditCard( |
const autofill::CreditCard& card, |
const base::string16& cvc, |
- const std::vector<autofill::AutofillProfile*>& billing_profiles, |
+ const autofill::AutofillProfile& billing_profile, |
const std::string& app_locale) { |
BasicCardResponse response; |
response.cardholder_name = card.GetRawInfo(autofill::CREDIT_CARD_NAME_FULL); |
@@ -81,18 +81,30 @@ BasicCardResponse GetBasicCardResponseFromAutofillCreditCard( |
card.GetRawInfo(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR); |
response.card_security_code = cvc; |
- // TODO(crbug.com/602666): Ensure we reach here only if the card has a billing |
- // address. Then add DCHECK(!card->billing_address_id().empty()). |
+ response.billing_address = |
+ GetPaymentAddressFromAutofillProfile(billing_profile, app_locale); |
+ |
+ return response; |
+} |
+ |
+BasicCardResponse GetBasicCardResponseFromAutofillCreditCard( |
+ const autofill::CreditCard& card, |
+ const base::string16& cvc, |
+ const std::vector<autofill::AutofillProfile*>& billing_profiles, |
+ const std::string& app_locale) { |
+ autofill::AutofillProfile billing_profile; |
+ |
+ // TODO(crbug.com/714655): This should be done in the autofill instrument. |
if (!card.billing_address_id().empty()) { |
const autofill::AutofillProfile* billing_address = |
autofill::PersonalDataManager::GetProfileFromProfilesByGUID( |
card.billing_address_id(), billing_profiles); |
DCHECK(billing_address); |
- response.billing_address = |
- GetPaymentAddressFromAutofillProfile(*billing_address, app_locale); |
+ billing_profile = *billing_address; |
} |
- return response; |
+ return GetBasicCardResponseFromAutofillCreditCard(card, cvc, billing_profile, |
+ app_locale); |
} |
void ParseBasicCardSupportedNetworks( |