Index: ios/chrome/browser/payments/credit_card_edit_mediator.mm |
diff --git a/ios/chrome/browser/payments/credit_card_edit_mediator.mm b/ios/chrome/browser/payments/credit_card_edit_mediator.mm |
index 9a9bdb994608ff2d80832f2dad44547d46de3eb3..53c059383fce0dba57d50aa33aec7f3b25a1329c 100644 |
--- a/ios/chrome/browser/payments/credit_card_edit_mediator.mm |
+++ b/ios/chrome/browser/payments/credit_card_edit_mediator.mm |
@@ -12,6 +12,7 @@ |
#import "components/autofill/ios/browser/credit_card_util.h" |
#include "components/strings/grit/components_strings.h" |
#include "ios/chrome/browser/application_context.h" |
+#import "ios/chrome/browser/payments/cells/accepted_payment_methods_item.h" |
#import "ios/chrome/browser/payments/cells/payment_method_item.h" |
#include "ios/chrome/browser/payments/payment_request.h" |
#import "ios/chrome/browser/payments/payment_request_editor_field.h" |
@@ -27,6 +28,8 @@ |
namespace { |
using ::AutofillUITypeFromAutofillType; |
+using ::autofill::data_util::GetCardTypeForBasicCardPaymentType; |
+using ::autofill::data_util::GetPaymentRequestData; |
using ::payment_request_util::GetBillingAddressLabelFromAutofillProfile; |
const CGFloat kCardTypeIconDimension = 25.0; |
@@ -81,6 +84,31 @@ const CGFloat kCardTypeIconDimension = 25.0; |
return cardSummaryItem; |
} |
+- (CollectionViewItem*)acceptedPaymentMethodsItem { |
+ if (_creditCard && !autofill::IsCreditCardLocal(*_creditCard)) |
+ return nil; |
+ |
+ NSMutableArray* cardTypeIcons = [NSMutableArray array]; |
+ for (const auto& supportedNetwork : |
+ _paymentRequest->supported_card_networks()) { |
+ const std::string cardType = |
+ GetCardTypeForBasicCardPaymentType(supportedNetwork); |
+ int resourceID = GetPaymentRequestData(cardType).icon_resource_id; |
+ UIImage* cardTypeIcon = |
+ ResizeImage(NativeImage(resourceID), |
+ CGSizeMake(kCardTypeIconDimension, kCardTypeIconDimension), |
+ ProjectionMode::kAspectFillNoClipping); |
+ [cardTypeIcons addObject:cardTypeIcon]; |
+ } |
+ |
+ AcceptedPaymentMethodsItem* acceptedMethodsItem = |
+ [[AcceptedPaymentMethodsItem alloc] init]; |
+ acceptedMethodsItem.message = |
+ l10n_util::GetNSString(IDS_PAYMENTS_ACCEPTED_CARDS_LABEL); |
+ acceptedMethodsItem.methodTypeIcons = cardTypeIcons; |
+ return acceptedMethodsItem; |
+} |
+ |
- (NSString*)billingAddressLabelForProfileWithGUID:(NSString*)profileGUID { |
DCHECK(profileGUID); |
autofill::AutofillProfile* profile = |