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

Unified Diff: ios/chrome/browser/ui/payments/payment_method_selection_coordinator.mm

Issue 2956453003: [Payment Request] Makes sure only complete credit cards can be selected (Closed)
Patch Set: Initial Created 3 years, 6 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
Index: ios/chrome/browser/ui/payments/payment_method_selection_coordinator.mm
diff --git a/ios/chrome/browser/ui/payments/payment_method_selection_coordinator.mm b/ios/chrome/browser/ui/payments/payment_method_selection_coordinator.mm
index b3a15081a4dde6627789a1683b936b39488f06e6..f0e40bfaf0d3f4dffed2315502811a7e09d3baa5 100644
--- a/ios/chrome/browser/ui/payments/payment_method_selection_coordinator.mm
+++ b/ios/chrome/browser/ui/payments/payment_method_selection_coordinator.mm
@@ -7,6 +7,7 @@
#include "components/autofill/core/browser/credit_card.h"
#include "components/strings/grit/components_strings.h"
#include "ios/chrome/browser/payments/payment_request.h"
+#import "ios/chrome/browser/ui/payments/cells/payment_method_item.h"
#include "ios/chrome/browser/ui/payments/payment_method_selection_mediator.h"
#include "ui/base/l10n/l10n_util.h"
@@ -83,8 +84,16 @@ const int64_t kDelegateNotificationDelayInNanoSeconds = 0.2 * NSEC_PER_SEC;
self.mediator.selectedItemIndex = index;
DCHECK(index < self.paymentRequest->credit_cards().size());
- [self delayedNotifyDelegateOfSelection:self.paymentRequest
- ->credit_cards()[index]];
+ autofill::CreditCard* creditCard = self.paymentRequest->credit_cards()[index];
+
+ // Proceed with item selection only if the item has all required info, or
+ // else bring up the credit card editor.
+ CollectionViewItem<PaymentsIsSelectable>* selectedItem =
+ self.mediator.selectableItems[index];
+ if (selectedItem.complete)
+ [self delayedNotifyDelegateOfSelection:creditCard];
+ else
+ [self startCreditCardEditCoordinatorWithCreditCard:creditCard];
}
- (void)paymentRequestSelectorViewControllerDidFinish:

Powered by Google App Engine
This is Rietveld 408576698