OLD | NEW |
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.os.AsyncTask; | 7 import android.os.AsyncTask; |
8 import android.os.Handler; | 8 import android.os.Handler; |
9 import android.text.SpannableStringBuilder; | 9 import android.text.SpannableStringBuilder; |
10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 import javax.annotation.Nullable; | 45 import javax.annotation.Nullable; |
46 | 46 |
47 /** | 47 /** |
48 * A credit card editor. Can be used for editing both local and server credit ca
rds. Everything in | 48 * A credit card editor. Can be used for editing both local and server credit ca
rds. Everything in |
49 * local cards can be edited. For server cards, only the billing address is edit
able. | 49 * local cards can be edited. For server cards, only the billing address is edit
able. |
50 */ | 50 */ |
51 public class CardEditor extends EditorBase<AutofillPaymentInstrument> | 51 public class CardEditor extends EditorBase<AutofillPaymentInstrument> |
52 implements CreditCardScanner.Delegate { | 52 implements CreditCardScanner.Delegate { |
53 /** Description of a card type. */ | 53 /** Description of a card type. */ |
54 private static class CardTypeInfo { | 54 private static class CardIssuerNetwork { |
55 /** The identifier for the drawable resource of the card type, e.g., R.d
rawable.pr_visa. */ | 55 /** |
| 56 * The identifier for the drawable resource of the card issuer network,
e.g., |
| 57 * R.drawable.pr_visa. |
| 58 */ |
56 public final int icon; | 59 public final int icon; |
57 | 60 |
58 /** | 61 /** |
59 * The identifier for the localized description string for accessibility
, e.g., | 62 * The identifier for the localized description string for accessibility
, e.g., |
60 * R.string.autofill_cc_visa. | 63 * R.string.autofill_cc_visa. |
61 */ | 64 */ |
62 public final int description; | 65 public final int description; |
63 | 66 |
64 /** | 67 /** |
65 * Builds a description of a card type. | 68 * Builds a description of a card issuer network. |
66 * | 69 * |
67 * @param icon The identifier for the drawable resource of the ca
rd type. | 70 * @param icon The identifier for the drawable resource of the ca
rd issuer network. |
68 * @param description The identifier for the localized description strin
g for accessibility. | 71 * @param description The identifier for the localized description strin
g for accessibility. |
69 */ | 72 */ |
70 public CardTypeInfo(int icon, int description) { | 73 public CardIssuerNetwork(int icon, int description) { |
71 this.icon = icon; | 74 this.icon = icon; |
72 this.description = description; | 75 this.description = description; |
73 } | 76 } |
74 } | 77 } |
75 | 78 |
76 /** The support credit card names. */ | 79 /** The support credit card names. */ |
77 private static final String AMEX = "amex"; | 80 private static final String AMEX = "amex"; |
78 private static final String DINERS = "diners"; | 81 private static final String DINERS = "diners"; |
79 private static final String DISCOVER = "discover"; | 82 private static final String DISCOVER = "discover"; |
80 private static final String JCB = "jcb"; | 83 private static final String JCB = "jcb"; |
(...skipping 21 matching lines...) Expand all Loading... |
102 /** A map of GUIDs of the incomplete profiles to their edit required message
resource Ids. */ | 105 /** A map of GUIDs of the incomplete profiles to their edit required message
resource Ids. */ |
103 private final Map<String, Integer> mIncompleteProfilesForBillingAddress; | 106 private final Map<String, Integer> mIncompleteProfilesForBillingAddress; |
104 | 107 |
105 /** Used for verifying billing address completeness and also editing billing
addresses. */ | 108 /** Used for verifying billing address completeness and also editing billing
addresses. */ |
106 private final AddressEditor mAddressEditor; | 109 private final AddressEditor mAddressEditor; |
107 | 110 |
108 /** An optional observer used by tests. */ | 111 /** An optional observer used by tests. */ |
109 @Nullable private final PaymentRequestServiceObserverForTest mObserverForTes
t; | 112 @Nullable private final PaymentRequestServiceObserverForTest mObserverForTes
t; |
110 | 113 |
111 /** | 114 /** |
112 * A mapping from all card types recognized in Chrome to information about t
hese card types. The | 115 * A mapping from all card issuer networks recognized in Chrome to informati
on about these |
113 * card types (e.g., "visa") are defined in: | 116 * networks. The networks (e.g., "visa") are defined in: |
114 * https://w3c.github.io/webpayments-methods-card/#method-id | 117 * https://w3c.github.io/webpayments-methods-card/#method-id |
115 */ | 118 */ |
116 private final Map<String, CardTypeInfo> mCardTypes; | 119 private final Map<String, CardIssuerNetwork> mCardIssuerNetworks; |
117 | 120 |
118 /** | 121 /** |
119 * The card types accepted by the merchant website. This is a subset of reco
gnized cards. Used | 122 * The issuer networks accepted by the merchant website. This is a subset of
recognized cards. |
120 * in the validator. | 123 * Used in the validator. |
121 */ | 124 */ |
122 private final Set<String> mAcceptedCardTypes; | 125 private final Set<String> mAcceptedIssuerNetworks; |
123 | 126 |
124 /** | 127 /** |
125 * The card types accepted by the merchant website that should have "basic-c
ard" as the payment | 128 * The issuer networks accepted by the merchant website that should have "ba
sic-card" as the |
126 * method. This is a subset of the accepted card types. Used when creating t
he complete payment | 129 * payment method. This is a subset of the accepted issuer networks. Used wh
en creating the |
127 * instrument. | 130 * complete payment instrument. |
128 */ | 131 */ |
129 private final Set<String> mAcceptedBasicCardTypes; | 132 private final Set<String> mAcceptedBasicCardIssuerNetworks; |
130 | 133 |
131 /** | 134 /** |
132 * The information about the accepted card types. Used in the editor as a hi
nt to the user about | 135 * The information about the accepted card issuer networks. Used in the edit
or as a hint to the |
133 * the valid card types. This is important to keep in a list, because the di
splay order matters. | 136 * user about the valid card issuer networks. This is important to keep in a
list, because the |
| 137 * display order matters. |
134 */ | 138 */ |
135 private final List<CardTypeInfo> mAcceptedCardTypeInfos; | 139 private final List<CardIssuerNetwork> mAcceptedCardIssuerNetworks; |
136 | 140 |
137 private final Handler mHandler; | 141 private final Handler mHandler; |
138 private final EditorFieldValidator mCardNumberValidator; | 142 private final EditorFieldValidator mCardNumberValidator; |
139 private final EditorValueIconGenerator mCardIconGenerator; | 143 private final EditorValueIconGenerator mCardIconGenerator; |
140 private final AsyncTask<Void, Void, Calendar> mCalendar; | 144 private final AsyncTask<Void, Void, Calendar> mCalendar; |
141 | 145 |
142 @Nullable private EditorFieldModel mIconHint; | 146 @Nullable private EditorFieldModel mIconHint; |
143 @Nullable private EditorFieldModel mNumberField; | 147 @Nullable private EditorFieldModel mNumberField; |
144 @Nullable private EditorFieldModel mNameField; | 148 @Nullable private EditorFieldModel mNameField; |
145 @Nullable private EditorFieldModel mMonthField; | 149 @Nullable private EditorFieldModel mMonthField; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 boolean isAComplete = AutofillAddress.checkAddressCompletionStat
us( | 202 boolean isAComplete = AutofillAddress.checkAddressCompletionStat
us( |
199 a, AutofillAddress.NORMAL_COMPLETE
NESS_CHECK) | 203 a, AutofillAddress.NORMAL_COMPLETE
NESS_CHECK) |
200 == AutofillAddress.COMPLETE; | 204 == AutofillAddress.COMPLETE; |
201 boolean isBComplete = AutofillAddress.checkAddressCompletionStat
us( | 205 boolean isBComplete = AutofillAddress.checkAddressCompletionStat
us( |
202 b, AutofillAddress.NORMAL_COMPLETE
NESS_CHECK) | 206 b, AutofillAddress.NORMAL_COMPLETE
NESS_CHECK) |
203 == AutofillAddress.COMPLETE; | 207 == AutofillAddress.COMPLETE; |
204 return ApiCompatibilityUtils.compareBoolean(isBComplete, isAComp
lete); | 208 return ApiCompatibilityUtils.compareBoolean(isBComplete, isAComp
lete); |
205 } | 209 } |
206 }); | 210 }); |
207 | 211 |
208 mCardTypes = new HashMap<>(); | 212 mCardIssuerNetworks = new HashMap<>(); |
209 mCardTypes.put(AMEX, new CardTypeInfo(R.drawable.pr_amex, R.string.autof
ill_cc_amex)); | 213 mCardIssuerNetworks.put( |
210 mCardTypes.put( | 214 AMEX, new CardIssuerNetwork(R.drawable.pr_amex, R.string.autofil
l_cc_amex)); |
211 DINERS, new CardTypeInfo(R.drawable.pr_dinersclub, R.string.auto
fill_cc_diners)); | 215 mCardIssuerNetworks.put(DINERS, |
212 mCardTypes.put( | 216 new CardIssuerNetwork(R.drawable.pr_dinersclub, R.string.autofil
l_cc_diners)); |
213 DISCOVER, new CardTypeInfo(R.drawable.pr_discover, R.string.auto
fill_cc_discover)); | 217 mCardIssuerNetworks.put(DISCOVER, |
214 mCardTypes.put(JCB, new CardTypeInfo(R.drawable.pr_jcb, R.string.autofil
l_cc_jcb)); | 218 new CardIssuerNetwork(R.drawable.pr_discover, R.string.autofill_
cc_discover)); |
215 mCardTypes.put( | 219 mCardIssuerNetworks.put( |
216 MASTERCARD, new CardTypeInfo(R.drawable.pr_mc, R.string.autofill
_cc_mastercard)); | 220 JCB, new CardIssuerNetwork(R.drawable.pr_jcb, R.string.autofill_
cc_jcb)); |
217 mCardTypes.put(MIR, new CardTypeInfo(R.drawable.pr_mir, R.string.autofil
l_cc_mir)); | 221 mCardIssuerNetworks.put(MASTERCARD, |
218 mCardTypes.put( | 222 new CardIssuerNetwork(R.drawable.pr_mc, R.string.autofill_cc_mas
tercard)); |
219 UNIONPAY, new CardTypeInfo(R.drawable.pr_unionpay, R.string.auto
fill_cc_union_pay)); | 223 mCardIssuerNetworks.put( |
220 mCardTypes.put(VISA, new CardTypeInfo(R.drawable.pr_visa, R.string.autof
ill_cc_visa)); | 224 MIR, new CardIssuerNetwork(R.drawable.pr_mir, R.string.autofill_
cc_mir)); |
| 225 mCardIssuerNetworks.put(UNIONPAY, |
| 226 new CardIssuerNetwork(R.drawable.pr_unionpay, R.string.autofill_
cc_union_pay)); |
| 227 mCardIssuerNetworks.put( |
| 228 VISA, new CardIssuerNetwork(R.drawable.pr_visa, R.string.autofil
l_cc_visa)); |
221 | 229 |
222 mAcceptedCardTypes = new HashSet<>(); | 230 mAcceptedIssuerNetworks = new HashSet<>(); |
223 mAcceptedBasicCardTypes = new HashSet<>(); | 231 mAcceptedBasicCardIssuerNetworks = new HashSet<>(); |
224 mAcceptedCardTypeInfos = new ArrayList<>(); | 232 mAcceptedCardIssuerNetworks = new ArrayList<>(); |
225 mHandler = new Handler(); | 233 mHandler = new Handler(); |
226 | 234 |
227 mCardNumberValidator = new EditorFieldValidator() { | 235 mCardNumberValidator = new EditorFieldValidator() { |
228 @Override | 236 @Override |
229 public boolean isValid(@Nullable CharSequence value) { | 237 public boolean isValid(@Nullable CharSequence value) { |
230 return value != null | 238 return value != null |
231 && mAcceptedCardTypes.contains( | 239 && mAcceptedIssuerNetworks.contains( |
232 PersonalDataManager.getInstance().getBasicCar
dPaymentType( | 240 PersonalDataManager.getInstance().getBasicCar
dIssuerNetwork( |
233 value.toString(), true)); | 241 value.toString(), true)); |
234 } | 242 } |
235 | 243 |
236 @Override | 244 @Override |
237 public boolean isLengthMaximum(@Nullable CharSequence value) { | 245 public boolean isLengthMaximum(@Nullable CharSequence value) { |
238 return isCardNumberLengthMaximum(value); | 246 return isCardNumberLengthMaximum(value); |
239 } | 247 } |
240 }; | 248 }; |
241 | 249 |
242 mCardIconGenerator = new EditorValueIconGenerator() { | 250 mCardIconGenerator = new EditorValueIconGenerator() { |
243 @Override | 251 @Override |
244 public int getIconResourceId(@Nullable CharSequence value) { | 252 public int getIconResourceId(@Nullable CharSequence value) { |
245 if (value == null) return 0; | 253 if (value == null) return 0; |
246 CardTypeInfo cardTypeInfo = | 254 CardIssuerNetwork cardTypeInfo = mCardIssuerNetworks.get( |
247 mCardTypes.get(PersonalDataManager.getInstance().getBasi
cCardPaymentType( | 255 PersonalDataManager.getInstance().getBasicCardIssuerNetw
ork( |
248 value.toString(), false)); | 256 value.toString(), false)); |
249 if (cardTypeInfo == null) return 0; | 257 if (cardTypeInfo == null) return 0; |
250 return cardTypeInfo.icon; | 258 return cardTypeInfo.icon; |
251 } | 259 } |
252 }; | 260 }; |
253 | 261 |
254 mCalendar = new AsyncTask<Void, Void, Calendar>() { | 262 mCalendar = new AsyncTask<Void, Void, Calendar>() { |
255 @Override | 263 @Override |
256 protected Calendar doInBackground(Void... unused) { | 264 protected Calendar doInBackground(Void... unused) { |
257 return Calendar.getInstance(); | 265 return Calendar.getInstance(); |
258 } | 266 } |
259 }; | 267 }; |
260 mCalendar.execute(); | 268 mCalendar.execute(); |
261 } | 269 } |
262 | 270 |
263 private boolean isCardNumberLengthMaximum(@Nullable CharSequence value) { | 271 private boolean isCardNumberLengthMaximum(@Nullable CharSequence value) { |
264 if (TextUtils.isEmpty(value)) return false; | 272 if (TextUtils.isEmpty(value)) return false; |
265 String cardType = | 273 String cardType = PersonalDataManager.getInstance().getBasicCardIssuerNe
twork( |
266 PersonalDataManager.getInstance().getBasicCardPaymentType(value.
toString(), false); | 274 value.toString(), false); |
267 if (TextUtils.isEmpty(cardType)) return false; | 275 if (TextUtils.isEmpty(cardType)) return false; |
268 | 276 |
269 // Below maximum values are consistent with the values used to check the
validity of the | 277 // Below maximum values are consistent with the values used to check the
validity of the |
270 // credit card number in autofill::IsValidCreditCardNumber. | 278 // credit card number in autofill::IsValidCreditCardNumber. |
271 String cardNumber = removeSpaceAndBar(value); | 279 String cardNumber = removeSpaceAndBar(value); |
272 switch (cardType) { | 280 switch (cardType) { |
273 case AMEX: | 281 case AMEX: |
274 return cardNumber.length() == 15; | 282 return cardNumber.length() == 15; |
275 case DINERS: | 283 case DINERS: |
276 return cardNumber.length() == 14; | 284 return cardNumber.length() == 14; |
(...skipping 11 matching lines...) Expand all Loading... |
288 | 296 |
289 /** | 297 /** |
290 * Adds accepted payment methods to the editor, if they are recognized credi
t card types. | 298 * Adds accepted payment methods to the editor, if they are recognized credi
t card types. |
291 * | 299 * |
292 * @param data Supported methods and method specific data. Should not be nul
l. | 300 * @param data Supported methods and method specific data. Should not be nul
l. |
293 */ | 301 */ |
294 public void addAcceptedPaymentMethodsIfRecognized(PaymentMethodData data) { | 302 public void addAcceptedPaymentMethodsIfRecognized(PaymentMethodData data) { |
295 assert data != null; | 303 assert data != null; |
296 for (int i = 0; i < data.supportedMethods.length; i++) { | 304 for (int i = 0; i < data.supportedMethods.length; i++) { |
297 String method = data.supportedMethods[i]; | 305 String method = data.supportedMethods[i]; |
298 if (mCardTypes.containsKey(method)) { | 306 if (mCardIssuerNetworks.containsKey(method)) { |
299 addAcceptedNetwork(method); | 307 addAcceptedNetwork(method); |
300 } else if (AutofillPaymentApp.BASIC_CARD_METHOD_NAME.equals(method))
{ | 308 } else if (AutofillPaymentApp.BASIC_CARD_METHOD_NAME.equals(method))
{ |
301 Set<String> basicCardNetworks = AutofillPaymentApp.convertBasicC
ardToNetworks(data); | 309 Set<String> basicCardNetworks = AutofillPaymentApp.convertBasicC
ardToNetworks(data); |
302 if (basicCardNetworks != null) { | 310 if (basicCardNetworks != null) { |
303 mAcceptedBasicCardTypes.addAll(basicCardNetworks); | 311 mAcceptedBasicCardIssuerNetworks.addAll(basicCardNetworks); |
304 for (String network : basicCardNetworks) { | 312 for (String network : basicCardNetworks) { |
305 addAcceptedNetwork(network); | 313 addAcceptedNetwork(network); |
306 } | 314 } |
307 } | 315 } |
308 } | 316 } |
309 } | 317 } |
310 } | 318 } |
311 | 319 |
312 /** | 320 /** |
313 * Adds a card network to the list of accepted networks. | 321 * Adds a card network to the list of accepted networks. |
314 * | 322 * |
315 * @param network An accepted network. Will be shown in UI only once, regard
less of how many | 323 * @param network An accepted network. Will be shown in UI only once, regard
less of how many |
316 * times this method is called. | 324 * times this method is called. |
317 */ | 325 */ |
318 private void addAcceptedNetwork(String network) { | 326 private void addAcceptedNetwork(String network) { |
319 if (!mAcceptedCardTypes.contains(network)) { | 327 if (!mAcceptedIssuerNetworks.contains(network)) { |
320 mAcceptedCardTypes.add(network); | 328 mAcceptedIssuerNetworks.add(network); |
321 mAcceptedCardTypeInfos.add(mCardTypes.get(network)); | 329 mAcceptedCardIssuerNetworks.add(mCardIssuerNetworks.get(network)); |
322 } | 330 } |
323 } | 331 } |
324 | 332 |
325 /** | 333 /** |
326 * Builds and shows an editor model with the following fields for local card
s. | 334 * Builds and shows an editor model with the following fields for local card
s. |
327 * | 335 * |
328 * [ accepted card types hint images ] | 336 * [ accepted card types hint images ] |
329 * [ card number ] | 337 * [ card number ] |
330 * [ name on card ] | 338 * [ name on card ] |
331 * [ expiration month ][ expiration year ] | 339 * [ expiration month ][ expiration year ] |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } | 403 } |
396 }); | 404 }); |
397 | 405 |
398 // If the user clicks [Done], save changes on disk, mark the card "compl
ete," and send it | 406 // If the user clicks [Done], save changes on disk, mark the card "compl
ete," and send it |
399 // back to the caller. | 407 // back to the caller. |
400 editor.setDoneCallback(new Runnable() { | 408 editor.setDoneCallback(new Runnable() { |
401 @Override | 409 @Override |
402 public void run() { | 410 public void run() { |
403 commitChanges(card, isNewCard); | 411 commitChanges(card, isNewCard); |
404 | 412 |
405 String methodName = card.getBasicCardPaymentType(); | 413 String methodName = card.getBasicCardIssuerNetwork(); |
406 if (mAcceptedBasicCardTypes.contains(methodName)) { | 414 if (mAcceptedBasicCardIssuerNetworks.contains(methodName)) { |
407 methodName = AutofillPaymentApp.BASIC_CARD_METHOD_NAME; | 415 methodName = AutofillPaymentApp.BASIC_CARD_METHOD_NAME; |
408 } | 416 } |
409 assert methodName != null; | 417 assert methodName != null; |
410 | 418 |
411 AutofillProfile billingAddress = | 419 AutofillProfile billingAddress = |
412 findTargetProfile(mProfilesForBillingAddress, card.getBi
llingAddressId()); | 420 findTargetProfile(mProfilesForBillingAddress, card.getBi
llingAddressId()); |
413 assert billingAddress != null; | 421 assert billingAddress != null; |
414 | 422 |
415 instrument.completeInstrument(card, methodName, billingAddress); | 423 instrument.completeInstrument(card, methodName, billingAddress); |
416 callback.onResult(instrument); | 424 callback.onResult(instrument); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 * [ accepted card types hint images ] | 458 * [ accepted card types hint images ] |
451 * [ card number [ocr icon] ] | 459 * [ card number [ocr icon] ] |
452 * [ name on card ] | 460 * [ name on card ] |
453 * [ expiration month ][ expiration year ] | 461 * [ expiration month ][ expiration year ] |
454 */ | 462 */ |
455 private void addLocalCardInputs(EditorModel editor, CreditCard card, Calenda
r calendar) { | 463 private void addLocalCardInputs(EditorModel editor, CreditCard card, Calenda
r calendar) { |
456 // Local card editor shows a card icon hint. | 464 // Local card editor shows a card icon hint. |
457 if (mIconHint == null) { | 465 if (mIconHint == null) { |
458 List<Integer> icons = new ArrayList<>(); | 466 List<Integer> icons = new ArrayList<>(); |
459 List<Integer> descriptions = new ArrayList<>(); | 467 List<Integer> descriptions = new ArrayList<>(); |
460 for (int i = 0; i < mAcceptedCardTypeInfos.size(); i++) { | 468 for (int i = 0; i < mAcceptedCardIssuerNetworks.size(); i++) { |
461 icons.add(mAcceptedCardTypeInfos.get(i).icon); | 469 icons.add(mAcceptedCardIssuerNetworks.get(i).icon); |
462 descriptions.add(mAcceptedCardTypeInfos.get(i).description); | 470 descriptions.add(mAcceptedCardIssuerNetworks.get(i).description)
; |
463 } | 471 } |
464 mIconHint = EditorFieldModel.createIconList( | 472 mIconHint = EditorFieldModel.createIconList( |
465 mContext.getString(R.string.payments_accepted_cards_label),
icons, | 473 mContext.getString(R.string.payments_accepted_cards_label),
icons, |
466 descriptions); | 474 descriptions); |
467 } | 475 } |
468 editor.addField(mIconHint); | 476 editor.addField(mIconHint); |
469 | 477 |
470 // Card scanner is expensive to query. | 478 // Card scanner is expensive to query. |
471 if (mCardScanner == null) { | 479 if (mCardScanner == null) { |
472 mCardScanner = CreditCardScanner.create(mWebContents, this); | 480 mCardScanner = CreditCardScanner.create(mWebContents, this); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 if (!card.getIsLocal()) { | 789 if (!card.getIsLocal()) { |
782 pdm.updateServerCardBillingAddress(card); | 790 pdm.updateServerCardBillingAddress(card); |
783 return; | 791 return; |
784 } | 792 } |
785 | 793 |
786 card.setNumber(removeSpaceAndBar(mNumberField.getValue())); | 794 card.setNumber(removeSpaceAndBar(mNumberField.getValue())); |
787 card.setName(mNameField.getValue().toString()); | 795 card.setName(mNameField.getValue().toString()); |
788 card.setMonth(mMonthField.getValue().toString()); | 796 card.setMonth(mMonthField.getValue().toString()); |
789 card.setYear(mYearField.getValue().toString()); | 797 card.setYear(mYearField.getValue().toString()); |
790 | 798 |
791 // Calculate the basic card payment type, obfuscated number, and the ico
n for this card. | 799 // Calculate the basic card issuer network, obfuscated number, and the i
con for this card. |
792 // All of these depend on the card number. The type is sent to the merch
ant website. The | 800 // All of these depend on the card number. The issuer network is sent to
the merchant |
793 // obfuscated number and the icon are displayed in the user interface. | 801 // website. The obfuscated number and the icon are displayed in the user
interface. |
794 CreditCard displayableCard = pdm.getCreditCardForNumber(card.getNumber()
); | 802 CreditCard displayableCard = pdm.getCreditCardForNumber(card.getNumber()
); |
795 card.setBasicCardPaymentType(displayableCard.getBasicCardPaymentType()); | 803 card.setBasicCardIssuerNetwork(displayableCard.getBasicCardIssuerNetwork
()); |
796 card.setObfuscatedNumber(displayableCard.getObfuscatedNumber()); | 804 card.setObfuscatedNumber(displayableCard.getObfuscatedNumber()); |
797 card.setIssuerIconDrawableId(displayableCard.getIssuerIconDrawableId()); | 805 card.setIssuerIconDrawableId(displayableCard.getIssuerIconDrawableId()); |
798 | 806 |
799 if (!isNewCard) { | 807 if (!isNewCard) { |
800 pdm.setCreditCard(card); | 808 pdm.setCreditCard(card); |
801 return; | 809 return; |
802 } | 810 } |
803 | 811 |
804 if (mSaveCardCheckbox != null && mSaveCardCheckbox.isChecked()) { | 812 if (mSaveCardCheckbox != null && mSaveCardCheckbox.isChecked()) { |
805 card.setGUID(pdm.setCreditCard(card)); | 813 card.setGUID(pdm.setCreditCard(card)); |
(...skipping 13 matching lines...) Expand all Loading... |
819 | 827 |
820 mEditorView.update(); | 828 mEditorView.update(); |
821 mIsScanning = false; | 829 mIsScanning = false; |
822 } | 830 } |
823 | 831 |
824 @Override | 832 @Override |
825 public void onScanCancelled() { | 833 public void onScanCancelled() { |
826 mIsScanning = false; | 834 mIsScanning = false; |
827 } | 835 } |
828 } | 836 } |
OLD | NEW |