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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentApp.java

Issue 2521063002: [Merge M-56] All billing addresses should be valid/complete (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.payments; 5 package org.chromium.chrome.browser.payments;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.Handler; 8 import android.os.Handler;
9 import android.text.TextUtils; 9 import android.text.TextUtils;
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 public void getInstruments( 42 public void getInstruments(
43 Map<String, PaymentMethodData> unusedMethodData, final InstrumentsCa llback callback) { 43 Map<String, PaymentMethodData> unusedMethodData, final InstrumentsCa llback callback) {
44 PersonalDataManager pdm = PersonalDataManager.getInstance(); 44 PersonalDataManager pdm = PersonalDataManager.getInstance();
45 List<CreditCard> cards = pdm.getCreditCardsToSuggest(); 45 List<CreditCard> cards = pdm.getCreditCardsToSuggest();
46 final List<PaymentInstrument> instruments = new ArrayList<>(cards.size() ); 46 final List<PaymentInstrument> instruments = new ArrayList<>(cards.size() );
47 47
48 for (int i = 0; i < cards.size(); i++) { 48 for (int i = 0; i < cards.size(); i++) {
49 CreditCard card = cards.get(i); 49 CreditCard card = cards.get(i);
50 AutofillProfile billingAddress = TextUtils.isEmpty(card.getBillingAd dressId()) 50 AutofillProfile billingAddress = TextUtils.isEmpty(card.getBillingAd dressId())
51 ? null : pdm.getProfile(card.getBillingAddressId()); 51 ? null : pdm.getProfile(card.getBillingAddressId());
52
53 if (billingAddress != null
54 && AutofillAddress.checkAddressCompletionStatus(billingAddre ss)
55 != AutofillAddress.COMPLETE) {
56 billingAddress = null;
57 }
58
52 instruments.add(new AutofillPaymentInstrument(mContext, mWebContents , card, 59 instruments.add(new AutofillPaymentInstrument(mContext, mWebContents , card,
53 billingAddress)); 60 billingAddress));
54 } 61 }
55 62
56 new Handler().post(new Runnable() { 63 new Handler().post(new Runnable() {
57 @Override 64 @Override
58 public void run() { 65 public void run() {
59 callback.onInstrumentsReady(AutofillPaymentApp.this, instruments ); 66 callback.onInstrumentsReady(AutofillPaymentApp.this, instruments );
60 } 67 }
61 }); 68 });
(...skipping 20 matching lines...) Expand all
82 methods.add("generic"); 89 methods.add("generic");
83 90
84 return methods; 91 return methods;
85 } 92 }
86 93
87 @Override 94 @Override
88 public String getAppIdentifier() { 95 public String getAppIdentifier() {
89 return "Chrome_Autofill_Payment_App"; 96 return "Chrome_Autofill_Payment_App";
90 } 97 }
91 } 98 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/AutofillPaymentInstrument.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698