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

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

Issue 2368073002: PaymentRequest: Add payer name field to payer info editor. (android) (Closed)
Patch Set: PaymentRequest: Add payer name field to payer info editor. (android) Created 4 years, 2 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 | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/ContactEditor.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillContact.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillContact.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillContact.java
index 37c9fd19d7195b4e7820961ef80b5c4d7c8b72a7..146e20b2cfce55fd827ea07020f8bfdbc950abbf 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillContact.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillContact.java
@@ -16,6 +16,7 @@ import javax.annotation.Nullable;
*/
public class AutofillContact extends PaymentOption {
private final AutofillProfile mProfile;
+ @Nullable private String mPayerName;
@Nullable private String mPayerPhone;
@Nullable private String mPayerEmail;
@@ -23,17 +24,24 @@ public class AutofillContact extends PaymentOption {
* Builds contact details.
*
* @param profile The autofill profile where this contact data lives.
- * @param phone The phone number. If not empty, this will be the primary label.
- * @param email The email address. If phone is empty, this will be the primary label.
+ * @param name The payer name. If not empty, this will be the primary label.
+ * @param phone The phone number. If name is empty, this will be the primary label.
+ * @param email The email address. If name and phone are empty, this will be the primary
+ * label.
* @param isComplete Whether the data in this contact can be sent to the merchant as-is. If
* false, user needs to add more information here.
*/
- public AutofillContact(AutofillProfile profile, @Nullable String phone, @Nullable String email,
- boolean isComplete) {
+ public AutofillContact(AutofillProfile profile, @Nullable String name,
+ @Nullable String phone, @Nullable String email, boolean isComplete) {
super(profile.getGUID(), null, null, PaymentOption.NO_ICON);
mProfile = profile;
mIsComplete = isComplete;
- setGuidPhoneEmail(profile.getGUID(), phone, email);
+ setContactInfo(profile.getGUID(), name, phone, email);
+ }
+
+ /** @return Payer name. Null if the merchant did not request it or data is incomplete. */
+ @Nullable public String getPayerName() {
+ return mPayerName;
}
/** @return Email address. Null if the merchant did not request it or data is incomplete. */
@@ -52,23 +60,35 @@ public class AutofillContact extends PaymentOption {
}
/**
- * Updates the profile guid, email address, and phone number and marks this information
- * "complete." Called after the user has edited this contact information. Updates the
- * identifier, label, and sublabel.
+ * Updates the profile guid, payer name, email address, and phone number and marks this
+ * information "complete." Called after the user has edited this contact information.
+ * Update the identifier, label, sublabel, and tertiarylabel.
*
* @param guid The new identifier to use. Should not be null or empty.
- * @param phone The new phone number to use. If not empty, this will be the primary label.
- * @param email The new email address to use. If phone is empty, this will be the primary label.
+ * @param name The new payer name to use. If not empty, this will be the primary label.
+ * @param phone The new phone number to use. If name is empty, this will be the primary label.
+ * @param email The new email address to use. If email and phone are empty, this will be the
+ * primary label.
*/
- public void completeContact(String guid, @Nullable String phone, @Nullable String email) {
+ public void completeContact(String guid, @Nullable String name,
+ @Nullable String phone, @Nullable String email) {
mIsComplete = true;
- setGuidPhoneEmail(guid, phone, email);
+ setContactInfo(guid, name, phone, email);
}
- private void setGuidPhoneEmail(String guid, @Nullable String phone, @Nullable String email) {
+ private void setContactInfo(String guid, @Nullable String name,
+ @Nullable String phone, @Nullable String email) {
+ mPayerName = TextUtils.isEmpty(name) ? null : name;
mPayerPhone = TextUtils.isEmpty(phone) ? null : phone;
mPayerEmail = TextUtils.isEmpty(email) ? null : email;
- updateIdentifierAndLabels(guid, mPayerPhone == null ? mPayerEmail : mPayerPhone,
- mPayerPhone == null ? null : mPayerEmail);
+
+ if (mPayerName == null) {
+ updateIdentifierAndLabels(guid, mPayerPhone == null ? mPayerEmail : mPayerPhone,
+ mPayerPhone == null ? null : mPayerEmail);
+ } else {
+ updateIdentifierAndLabels(guid, mPayerName,
+ mPayerPhone == null ? mPayerEmail : mPayerPhone,
+ mPayerPhone == null ? null : mPayerEmail);
+ }
}
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/ContactEditor.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698