Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Unified Diff: ios/chrome/browser/payments/payment_request_util.mm

Issue 2733953003: [Payments] Return a basic card response (Closed)
Patch Set: addressed comments from anthony Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/payments/payment_request_util.h ('k') | ios/web/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ceb9ef7c2ac4c093005317193b8fa39a22e40d91..99c53f2330e059ff459b8b01c4f7401dfe2a7bdb 100644
--- a/ios/chrome/browser/payments/payment_request_util.mm
+++ b/ios/chrome/browser/payments/payment_request_util.mm
@@ -9,7 +9,6 @@
#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/strings/grit/components_strings.h"
@@ -62,58 +61,6 @@ NSString* GetEmailLabelFromAutofillProfile(
return !label.empty() ? base::SysUTF16ToNSString(label) : nil;
}
-web::PaymentAddress GetPaymentAddressFromAutofillProfile(
- const autofill::AutofillProfile& profile) {
- web::PaymentAddress address;
- address.country = profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY);
- address.address_line = base::SplitString(
- profile.GetInfo(
- autofill::AutofillType(autofill::ADDRESS_HOME_STREET_ADDRESS),
- GetApplicationContext()->GetApplicationLocale()),
- base::ASCIIToUTF16("\n"), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
- address.region = profile.GetRawInfo(autofill::ADDRESS_HOME_STATE);
- address.city = profile.GetRawInfo(autofill::ADDRESS_HOME_CITY);
- address.dependent_locality =
- profile.GetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_LOCALITY);
- address.postal_code = profile.GetRawInfo(autofill::ADDRESS_HOME_ZIP);
- address.sorting_code =
- profile.GetRawInfo(autofill::ADDRESS_HOME_SORTING_CODE);
- address.language_code = base::UTF8ToUTF16(profile.language_code());
- address.organization = profile.GetRawInfo(autofill::COMPANY_NAME);
- address.recipient =
- profile.GetInfo(autofill::AutofillType(autofill::NAME_FULL),
- GetApplicationContext()->GetApplicationLocale());
- address.phone = profile.GetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER);
-
- return address;
-}
-
-web::BasicCardResponse GetBasicCardResponseFromAutofillCreditCard(
- const PaymentRequest& payment_request,
- const autofill::CreditCard& card,
- const base::string16& cvc) {
- web::BasicCardResponse response;
- response.cardholder_name = card.GetRawInfo(autofill::CREDIT_CARD_NAME_FULL);
- response.card_number = card.GetRawInfo(autofill::CREDIT_CARD_NUMBER);
- response.expiry_month = card.GetRawInfo(autofill::CREDIT_CARD_EXP_MONTH);
- response.expiry_year =
- 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()).
- if (!card.billing_address_id().empty()) {
- const autofill::AutofillProfile* billing_address =
- autofill::PersonalDataManager::GetProfileFromProfilesByGUID(
- card.billing_address_id(), payment_request.billing_profiles());
- DCHECK(billing_address);
- response.billing_address =
- GetPaymentAddressFromAutofillProfile(*billing_address);
- }
-
- return response;
-}
-
NSString* GetShippingSectionTitle(const PaymentRequest& payment_request) {
switch (payment_request.payment_options().shipping_type) {
case web::PaymentShippingType::SHIPPING:
« no previous file with comments | « ios/chrome/browser/payments/payment_request_util.h ('k') | ios/web/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698