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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java

Issue 2501593003: Implement the new basic card specification. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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: chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java
index 6013fa5ec918f80fde423c2fec88b6ff3827ee20..ff1debb421a8c2929f1cfab06f38c3070e54b50d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java
@@ -36,6 +36,7 @@ public class AutofillPaymentInstrument extends PaymentInstrument
private CreditCard mCard;
private String mSecurityCode;
@Nullable private AutofillProfile mBillingAddress;
+ @Nullable private String mMethodName;
@Nullable private InstrumentDetailsCallback mCallback;
private boolean mIsWaitingForBillingNormalization;
private boolean mIsWaitingForFullCardDetails;
@@ -47,9 +48,10 @@ public class AutofillPaymentInstrument extends PaymentInstrument
* @param webContents The web contents where PaymentRequest was invoked.
* @param card The autofill card that can be used for payment.
* @param billingAddress The billing address for the card.
+ * @param methodName The payment method name, e.g., "basic-card", "visa", amex", or null.
*/
public AutofillPaymentInstrument(Context context, WebContents webContents, CreditCard card,
- @Nullable AutofillProfile billingAddress) {
+ @Nullable AutofillProfile billingAddress, @Nullable String methodName) {
super(card.getGUID(), card.getObfuscatedNumber(), card.getName(),
card.getIssuerIconDrawableId() == 0
? null
@@ -60,12 +62,13 @@ public class AutofillPaymentInstrument extends PaymentInstrument
mCard = card;
mBillingAddress = billingAddress;
mIsEditable = true;
+ mMethodName = methodName;
checkAndUpateCardCompleteness();
}
@Override
public String getInstrumentMethodName() {
- return mCard.getBasicCardPaymentType();
+ return mMethodName;
}
@Override
@@ -183,8 +186,7 @@ public class AutofillPaymentInstrument extends PaymentInstrument
mSecurityCode = "";
}
- mCallback.onInstrumentDetailsReady(
- mCard.getBasicCardPaymentType(), stringWriter.toString());
+ mCallback.onInstrumentDetailsReady(getInstrumentMethodName(), stringWriter.toString());
}
private static String ensureNotNull(@Nullable String value) {
@@ -210,11 +212,15 @@ public class AutofillPaymentInstrument extends PaymentInstrument
* instrument.
*
* @param card The new credit card to use. The GUID should not change.
+ * @param methodName The payment method name to use for this instrument, e.g., "visa",
+ * "basic-card".
* @param billingAddress The billing address for the card. The GUID should match the billing
* address ID of the new card to use.
*/
- public void completeInstrument(CreditCard card, AutofillProfile billingAddress) {
+ public void completeInstrument(CreditCard card, String methodName,
+ AutofillProfile billingAddress) {
assert card != null;
+ assert methodName != null;
assert billingAddress != null;
assert card.getBillingAddressId() != null;
assert card.getBillingAddressId().equals(billingAddress.getGUID());
@@ -223,6 +229,7 @@ public class AutofillPaymentInstrument extends PaymentInstrument
== AutofillAddress.COMPLETE;
mCard = card;
+ mMethodName = methodName;
mBillingAddress = billingAddress;
updateIdentifierLabelsAndIcon(card.getGUID(), card.getObfuscatedNumber(), card.getName(),
null, ApiCompatibilityUtils.getDrawable(

Powered by Google App Engine
This is Rietveld 408576698