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

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 3 years, 11 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: 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 406ff9fc7a3dfabd5ac558e0867029678f000ca8..1e6d3bd56863880d00614cf2c773ebbb934e607b 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
@@ -39,6 +39,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;
@@ -51,9 +52,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
@@ -64,13 +66,14 @@ public class AutofillPaymentInstrument extends PaymentInstrument
mCard = card;
mBillingAddress = billingAddress;
mIsEditable = true;
+ mMethodName = methodName;
checkAndUpateCardCompleteness();
}
@Override
public Set<String> getInstrumentMethodNames() {
Set<String> result = new HashSet<>();
- result.add(mCard.getBasicCardPaymentType());
+ result.add(mMethodName);
return result;
}
@@ -197,8 +200,7 @@ public class AutofillPaymentInstrument extends PaymentInstrument
mSecurityCode = "";
}
- mCallback.onInstrumentDetailsReady(
- mCard.getBasicCardPaymentType(), stringWriter.toString());
+ mCallback.onInstrumentDetailsReady(mMethodName, stringWriter.toString());
}
private static String ensureNotNull(@Nullable String value) {
@@ -235,11 +237,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());
@@ -248,6 +254,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