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.app.Activity; | 7 import android.app.Activity; |
8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
9 import android.os.Handler; | 9 import android.os.Handler; |
10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 private ShoppingCart mUiShoppingCart; | 168 private ShoppingCart mUiShoppingCart; |
169 | 169 |
170 /** | 170 /** |
171 * The UI model for the shipping options. Includes the label and sublabel fo
r each shipping | 171 * The UI model for the shipping options. Includes the label and sublabel fo
r each shipping |
172 * option. Also keeps track of the selected shipping option. This data is pa
ssed to the UI. | 172 * option. Also keeps track of the selected shipping option. This data is pa
ssed to the UI. |
173 */ | 173 */ |
174 private SectionInformation mUiShippingOptions; | 174 private SectionInformation mUiShippingOptions; |
175 | 175 |
176 private Map<String, JSONObject> mMethodData; | 176 private Map<String, JSONObject> mMethodData; |
177 private SectionInformation mShippingAddressesSection; | 177 private SectionInformation mShippingAddressesSection; |
178 private SectionInformation mContactSection; | 178 private SectionInformation mPayerInfoSection; |
179 private List<PaymentApp> mPendingApps; | 179 private List<PaymentApp> mPendingApps; |
180 private List<PaymentInstrument> mPendingInstruments; | 180 private List<PaymentInstrument> mPendingInstruments; |
181 private List<PaymentInstrument> mPendingAutofillInstruments; | 181 private List<PaymentInstrument> mPendingAutofillInstruments; |
182 private SectionInformation mPaymentMethodsSection; | 182 private SectionInformation mPaymentMethodsSection; |
183 private PaymentRequestUI mUI; | 183 private PaymentRequestUI mUI; |
184 private Callback<PaymentInformation> mPaymentInformationCallback; | 184 private Callback<PaymentInformation> mPaymentInformationCallback; |
185 private boolean mPaymentAppRunning; | 185 private boolean mPaymentAppRunning; |
186 private boolean mMerchantSupportsAutofillPaymentInstruments; | 186 private boolean mMerchantSupportsAutofillPaymentInstruments; |
187 private ContactEditor mContactEditor; | 187 private PayerInfoEditor mPayerInfoEditor; |
188 private boolean mHasRecordedAbortReason; | 188 private boolean mHasRecordedAbortReason; |
189 | 189 |
190 /** True if any of the requested payment methods are supported. */ | 190 /** True if any of the requested payment methods are supported. */ |
191 private boolean mArePaymentMethodsSupported; | 191 private boolean mArePaymentMethodsSupported; |
192 | 192 |
193 /** True if show() was called. */ | 193 /** True if show() was called. */ |
194 private boolean mIsShowing; | 194 private boolean mIsShowing; |
195 | 195 |
196 private boolean mIsWaitingForNormalization; | 196 private boolean mIsWaitingForNormalization; |
197 private PaymentResponse mPendingPaymentResponse; | 197 private PaymentResponse mPendingPaymentResponse; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 && addresses.get(0).isComplete()) { | 318 && addresses.get(0).isComplete()) { |
319 firstCompleteAddressIndex = 0; | 319 firstCompleteAddressIndex = 0; |
320 } | 320 } |
321 | 321 |
322 mShippingAddressesSection = | 322 mShippingAddressesSection = |
323 new SectionInformation(PaymentRequestUI.TYPE_SHIPPING_ADDRES
SES, | 323 new SectionInformation(PaymentRequestUI.TYPE_SHIPPING_ADDRES
SES, |
324 firstCompleteAddressIndex, addresses); | 324 firstCompleteAddressIndex, addresses); |
325 } | 325 } |
326 | 326 |
327 if (requestPayerPhone || requestPayerEmail) { | 327 if (requestPayerPhone || requestPayerEmail) { |
328 Set<String> uniqueContactInfos = new HashSet<>(); | 328 Set<String> uniquePayerInfos = new HashSet<>(); |
329 mContactEditor = new ContactEditor(requestPayerPhone, requestPayerEm
ail); | 329 mPayerInfoEditor = new PayerInfoEditor(requestPayerPhone, requestPay
erEmail); |
330 List<AutofillContact> contacts = new ArrayList<>(); | 330 List<AutofillPayerInfo> payerInfos = new ArrayList<>(); |
331 | 331 |
332 for (int i = 0; i < profiles.size(); i++) { | 332 for (int i = 0; i < profiles.size(); i++) { |
333 AutofillProfile profile = profiles.get(i); | 333 AutofillProfile profile = profiles.get(i); |
334 String phone = requestPayerPhone && !TextUtils.isEmpty(profile.g
etPhoneNumber()) | 334 String phone = requestPayerPhone && !TextUtils.isEmpty(profile.g
etPhoneNumber()) |
335 ? profile.getPhoneNumber() : null; | 335 ? profile.getPhoneNumber() : null; |
336 String email = requestPayerEmail && !TextUtils.isEmpty(profile.g
etEmailAddress()) | 336 String email = requestPayerEmail && !TextUtils.isEmpty(profile.g
etEmailAddress()) |
337 ? profile.getEmailAddress() : null; | 337 ? profile.getEmailAddress() : null; |
338 mContactEditor.addPhoneNumberIfValid(phone); | 338 mPayerInfoEditor.addPhoneNumberIfValid(phone); |
339 mContactEditor.addEmailAddressIfValid(email); | 339 mPayerInfoEditor.addEmailAddressIfValid(email); |
340 | 340 |
341 if (phone != null || email != null) { | 341 if (phone != null || email != null) { |
342 // Different profiles can have identical contact info. Do no
t add the same | 342 // Different profiles can have identical payer info. Do not
add the same |
343 // contact info to the list twice. | 343 // payer info to the list twice. |
344 String uniqueContactInfo = phone + email; | 344 String uniquePayerInfo = phone + email; |
345 if (!uniqueContactInfos.contains(uniqueContactInfo)) { | 345 if (!uniquePayerInfos.contains(uniquePayerInfo)) { |
346 uniqueContactInfos.add(uniqueContactInfo); | 346 uniquePayerInfos.add(uniquePayerInfo); |
347 | 347 |
348 boolean isComplete = | 348 boolean isComplete = |
349 mContactEditor.isContactInformationComplete(phon
e, email); | 349 mPayerInfoEditor.isPayerInformationComplete(phon
e, email); |
350 contacts.add(new AutofillContact(profile, phone, email,
isComplete)); | 350 payerInfos.add(new AutofillPayerInfo(profile, phone, ema
il, isComplete)); |
351 } | 351 } |
352 } | 352 } |
353 } | 353 } |
354 | 354 |
355 // Suggest complete contact infos first. | 355 // Suggest complete payer infos first. |
356 Collections.sort(contacts, COMPLETENESS_COMPARATOR); | 356 Collections.sort(payerInfos, COMPLETENESS_COMPARATOR); |
357 | 357 |
358 // Limit the number of suggestions. | 358 // Limit the number of suggestions. |
359 contacts = contacts.subList(0, Math.min(contacts.size(), SUGGESTIONS
_LIMIT)); | 359 payerInfos = payerInfos.subList(0, Math.min(payerInfos.size(), SUGGE
STIONS_LIMIT)); |
360 | 360 |
361 // Log the number of suggested contact infos. | 361 // Log the number of suggested payer infos. |
362 mJourneyLogger.setNumberOfSuggestionsShown( | 362 mJourneyLogger.setNumberOfSuggestionsShown( |
363 PaymentRequestJourneyLogger.SECTION_CONTACT_INFO, contacts.s
ize()); | 363 PaymentRequestJourneyLogger.SECTION_PAYER_INFO_INFO, payerIn
fos.size()); |
364 | 364 |
365 // Automatically select the first address if it is complete. | 365 // Automatically select the first address if it is complete. |
366 int firstCompleteContactIndex = SectionInformation.NO_SELECTION; | 366 int firstCompletePayerInfoIndex = SectionInformation.NO_SELECTION; |
367 if (!contacts.isEmpty() && contacts.get(0).isComplete()) { | 367 if (!payerInfos.isEmpty() && payerInfos.get(0).isComplete()) { |
368 firstCompleteContactIndex = 0; | 368 firstCompletePayerInfoIndex = 0; |
369 } | 369 } |
370 | 370 |
371 mContactSection = new SectionInformation( | 371 mPayerInfoSection = new SectionInformation(PaymentRequestUI.TYPE_PAY
ER_INFO_DETAILS, |
372 PaymentRequestUI.TYPE_CONTACT_DETAILS, firstCompleteContactI
ndex, contacts); | 372 firstCompletePayerInfoIndex, payerInfos); |
373 } | 373 } |
374 | 374 |
375 mUI = new PaymentRequestUI(mContext, this, requestShipping, | 375 mUI = new PaymentRequestUI(mContext, this, requestShipping, |
376 requestPayerPhone || requestPayerEmail, mMerchantSupportsAutofil
lPaymentInstruments, | 376 requestPayerPhone || requestPayerEmail, mMerchantSupportsAutofil
lPaymentInstruments, |
377 mMerchantName, mOrigin); | 377 mMerchantName, mOrigin); |
378 | 378 |
379 if (mFavicon != null) mUI.setTitleBitmap(mFavicon); | 379 if (mFavicon != null) mUI.setTitleBitmap(mFavicon); |
380 mFavicon = null; | 380 mFavicon = null; |
381 | 381 |
382 mAddressEditor.setEditorView(mUI.getEditorView()); | 382 mAddressEditor.setEditorView(mUI.getEditorView()); |
383 mCardEditor.setEditorView(mUI.getCardEditorView()); | 383 mCardEditor.setEditorView(mUI.getCardEditorView()); |
384 if (mContactEditor != null) mContactEditor.setEditorView(mUI.getEditorVi
ew()); | 384 if (mPayerInfoEditor != null) mPayerInfoEditor.setEditorView(mUI.getEdit
orView()); |
385 | 385 |
386 PaymentRequestMetrics.recordRequestedInformationHistogram(requestPayerEm
ail, | 386 PaymentRequestMetrics.recordRequestedInformationHistogram(requestPayerEm
ail, |
387 requestPayerPhone, requestShipping); | 387 requestPayerPhone, requestShipping); |
388 } | 388 } |
389 | 389 |
390 /** | 390 /** |
391 * Called by the merchant website to show the payment request to the user. | 391 * Called by the merchant website to show the payment request to the user. |
392 */ | 392 */ |
393 @Override | 393 @Override |
394 public void show() { | 394 public void show() { |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 @Override | 675 @Override |
676 public void run() { | 676 public void run() { |
677 providePaymentInformation(); | 677 providePaymentInformation(); |
678 } | 678 } |
679 }); | 679 }); |
680 } | 680 } |
681 | 681 |
682 private void providePaymentInformation() { | 682 private void providePaymentInformation() { |
683 mPaymentInformationCallback.onResult( | 683 mPaymentInformationCallback.onResult( |
684 new PaymentInformation(mUiShoppingCart, mShippingAddressesSectio
n, | 684 new PaymentInformation(mUiShoppingCart, mShippingAddressesSectio
n, |
685 mUiShippingOptions, mContactSection, mPaymentMethodsSect
ion)); | 685 mUiShippingOptions, mPayerInfoSection, mPaymentMethodsSe
ction)); |
686 mPaymentInformationCallback = null; | 686 mPaymentInformationCallback = null; |
687 } | 687 } |
688 | 688 |
689 @Override | 689 @Override |
690 public void getShoppingCart(final Callback<ShoppingCart> callback) { | 690 public void getShoppingCart(final Callback<ShoppingCart> callback) { |
691 mHandler.post(new Runnable() { | 691 mHandler.post(new Runnable() { |
692 @Override | 692 @Override |
693 public void run() { | 693 public void run() { |
694 callback.onResult(mUiShoppingCart); | 694 callback.onResult(mUiShoppingCart); |
695 } | 695 } |
696 }); | 696 }); |
697 } | 697 } |
698 | 698 |
699 @Override | 699 @Override |
700 public void getSectionInformation(@PaymentRequestUI.DataType final int optio
nType, | 700 public void getSectionInformation(@PaymentRequestUI.DataType final int optio
nType, |
701 final Callback<SectionInformation> callback) { | 701 final Callback<SectionInformation> callback) { |
702 mHandler.post(new Runnable() { | 702 mHandler.post(new Runnable() { |
703 @Override | 703 @Override |
704 public void run() { | 704 public void run() { |
705 if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { | 705 if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { |
706 callback.onResult(mShippingAddressesSection); | 706 callback.onResult(mShippingAddressesSection); |
707 } else if (optionType == PaymentRequestUI.TYPE_SHIPPING_OPTIONS)
{ | 707 } else if (optionType == PaymentRequestUI.TYPE_SHIPPING_OPTIONS)
{ |
708 callback.onResult(mUiShippingOptions); | 708 callback.onResult(mUiShippingOptions); |
709 } else if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS)
{ | 709 } else if (optionType == PaymentRequestUI.TYPE_PAYER_INFO_DETAIL
S) { |
710 callback.onResult(mContactSection); | 710 callback.onResult(mPayerInfoSection); |
711 } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS)
{ | 711 } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS)
{ |
712 assert mPaymentMethodsSection != null; | 712 assert mPaymentMethodsSection != null; |
713 callback.onResult(mPaymentMethodsSection); | 713 callback.onResult(mPaymentMethodsSection); |
714 } | 714 } |
715 } | 715 } |
716 }); | 716 }); |
717 } | 717 } |
718 | 718 |
719 @Override | 719 @Override |
720 @PaymentRequestUI.SelectionResult public int onSectionOptionSelected( | 720 @PaymentRequestUI.SelectionResult public int onSectionOptionSelected( |
(...skipping 13 matching lines...) Expand all Loading... |
734 editAddress(address); | 734 editAddress(address); |
735 } | 735 } |
736 mPaymentInformationCallback = callback; | 736 mPaymentInformationCallback = callback; |
737 return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; | 737 return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; |
738 } else if (optionType == PaymentRequestUI.TYPE_SHIPPING_OPTIONS) { | 738 } else if (optionType == PaymentRequestUI.TYPE_SHIPPING_OPTIONS) { |
739 // This may update the line items. | 739 // This may update the line items. |
740 mUiShippingOptions.setSelectedItem(option); | 740 mUiShippingOptions.setSelectedItem(option); |
741 mClient.onShippingOptionChange(option.getIdentifier()); | 741 mClient.onShippingOptionChange(option.getIdentifier()); |
742 mPaymentInformationCallback = callback; | 742 mPaymentInformationCallback = callback; |
743 return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; | 743 return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; |
744 } else if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) { | 744 } else if (optionType == PaymentRequestUI.TYPE_PAYER_INFO_DETAILS) { |
745 assert option instanceof AutofillContact; | 745 assert option instanceof AutofillPayerInfo; |
746 // Log the change of contact info. | 746 // Log the change of payer info. |
747 mJourneyLogger.incrementSelectionChanges( | 747 mJourneyLogger.incrementSelectionChanges( |
748 PaymentRequestJourneyLogger.SECTION_CONTACT_INFO); | 748 PaymentRequestJourneyLogger.SECTION_PAYER_INFO_INFO); |
749 AutofillContact contact = (AutofillContact) option; | 749 AutofillPayerInfo payerInfo = (AutofillPayerInfo) option; |
750 | 750 |
751 if (contact.isComplete()) { | 751 if (payerInfo.isComplete()) { |
752 mContactSection.setSelectedItem(option); | 752 mPayerInfoSection.setSelectedItem(option); |
753 } else { | 753 } else { |
754 editContact(contact); | 754 editPayerInfo(payerInfo); |
755 return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; | 755 return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; |
756 } | 756 } |
757 } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { | 757 } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { |
758 assert option instanceof PaymentInstrument; | 758 assert option instanceof PaymentInstrument; |
759 if (option instanceof AutofillPaymentInstrument) { | 759 if (option instanceof AutofillPaymentInstrument) { |
760 // Log the change of credit card. | 760 // Log the change of credit card. |
761 mJourneyLogger.incrementSelectionChanges( | 761 mJourneyLogger.incrementSelectionChanges( |
762 PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS); | 762 PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS); |
763 AutofillPaymentInstrument card = (AutofillPaymentInstrument) opt
ion; | 763 AutofillPaymentInstrument card = (AutofillPaymentInstrument) opt
ion; |
764 | 764 |
(...skipping 12 matching lines...) Expand all Loading... |
777 @Override | 777 @Override |
778 @PaymentRequestUI.SelectionResult public int onSectionAddOption( | 778 @PaymentRequestUI.SelectionResult public int onSectionAddOption( |
779 @PaymentRequestUI.DataType int optionType, Callback<PaymentInformati
on> callback) { | 779 @PaymentRequestUI.DataType int optionType, Callback<PaymentInformati
on> callback) { |
780 if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { | 780 if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { |
781 editAddress(null); | 781 editAddress(null); |
782 mPaymentInformationCallback = callback; | 782 mPaymentInformationCallback = callback; |
783 // Log the add of shipping address. | 783 // Log the add of shipping address. |
784 mJourneyLogger.incrementSelectionAdds( | 784 mJourneyLogger.incrementSelectionAdds( |
785 PaymentRequestJourneyLogger.SECTION_SHIPPING_ADDRESS); | 785 PaymentRequestJourneyLogger.SECTION_SHIPPING_ADDRESS); |
786 return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; | 786 return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; |
787 } else if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) { | 787 } else if (optionType == PaymentRequestUI.TYPE_PAYER_INFO_DETAILS) { |
788 editContact(null); | 788 editPayerInfo(null); |
789 // Log the add of contact info. | 789 // Log the add of payer info. |
790 mJourneyLogger.incrementSelectionAdds(PaymentRequestJourneyLogger.SE
CTION_CONTACT_INFO); | 790 mJourneyLogger.incrementSelectionAdds( |
| 791 PaymentRequestJourneyLogger.SECTION_PAYER_INFO_INFO); |
791 return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; | 792 return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; |
792 } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { | 793 } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { |
793 editCard(null); | 794 editCard(null); |
794 // Log the add of credit card. | 795 // Log the add of credit card. |
795 mJourneyLogger.incrementSelectionAdds(PaymentRequestJourneyLogger.SE
CTION_CREDIT_CARDS); | 796 mJourneyLogger.incrementSelectionAdds(PaymentRequestJourneyLogger.SE
CTION_CREDIT_CARDS); |
796 return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; | 797 return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; |
797 } | 798 } |
798 | 799 |
799 return PaymentRequestUI.SELECTION_RESULT_NONE; | 800 return PaymentRequestUI.SELECTION_RESULT_NONE; |
800 } | 801 } |
(...skipping 14 matching lines...) Expand all Loading... |
815 providePaymentInformation(); | 816 providePaymentInformation(); |
816 } else { | 817 } else { |
817 if (toEdit == null) mShippingAddressesSection.addAndSelectIt
em(completeAddress); | 818 if (toEdit == null) mShippingAddressesSection.addAndSelectIt
em(completeAddress); |
818 mCardEditor.updateBillingAddress(completeAddress); | 819 mCardEditor.updateBillingAddress(completeAddress); |
819 mClient.onShippingAddressChange(completeAddress.toPaymentAdd
ress()); | 820 mClient.onShippingAddressChange(completeAddress.toPaymentAdd
ress()); |
820 } | 821 } |
821 } | 822 } |
822 }); | 823 }); |
823 } | 824 } |
824 | 825 |
825 private void editContact(final AutofillContact toEdit) { | 826 private void editPayerInfo(final AutofillPayerInfo toEdit) { |
826 if (toEdit != null) { | 827 if (toEdit != null) { |
827 // Log the edit of a contact info. | 828 // Log the edit of a payer info. |
828 mJourneyLogger.incrementSelectionEdits( | 829 mJourneyLogger.incrementSelectionEdits( |
829 PaymentRequestJourneyLogger.SECTION_CONTACT_INFO); | 830 PaymentRequestJourneyLogger.SECTION_PAYER_INFO_INFO); |
830 } | 831 } |
831 mContactEditor.edit(toEdit, new Callback<AutofillContact>() { | 832 mPayerInfoEditor.edit(toEdit, new Callback<AutofillPayerInfo>() { |
832 @Override | 833 @Override |
833 public void onResult(AutofillContact completeContact) { | 834 public void onResult(AutofillPayerInfo completePayerInfo) { |
834 if (mUI == null) return; | 835 if (mUI == null) return; |
835 | 836 |
836 if (completeContact == null) { | 837 if (completePayerInfo == null) { |
837 mContactSection.setSelectedItemIndex(SectionInformation.NO_S
ELECTION); | 838 mPayerInfoSection.setSelectedItemIndex(SectionInformation.NO
_SELECTION); |
838 } else if (toEdit == null) { | 839 } else if (toEdit == null) { |
839 mContactSection.addAndSelectItem(completeContact); | 840 mPayerInfoSection.addAndSelectItem(completePayerInfo); |
840 } | 841 } |
841 | 842 |
842 mUI.updateSection(PaymentRequestUI.TYPE_CONTACT_DETAILS, mContac
tSection); | 843 mUI.updateSection(PaymentRequestUI.TYPE_PAYER_INFO_DETAILS, mPay
erInfoSection); |
843 } | 844 } |
844 }); | 845 }); |
845 } | 846 } |
846 | 847 |
847 private void editCard(final AutofillPaymentInstrument toEdit) { | 848 private void editCard(final AutofillPaymentInstrument toEdit) { |
848 if (toEdit != null) { | 849 if (toEdit != null) { |
849 // Log the edit of a credit card. | 850 // Log the edit of a credit card. |
850 mJourneyLogger.incrementSelectionEdits( | 851 mJourneyLogger.incrementSelectionEdits( |
851 PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS); | 852 PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS); |
852 } | 853 } |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 * Called after retrieving instrument details. | 1059 * Called after retrieving instrument details. |
1059 */ | 1060 */ |
1060 @Override | 1061 @Override |
1061 public void onInstrumentDetailsReady(String methodName, String stringifiedDe
tails) { | 1062 public void onInstrumentDetailsReady(String methodName, String stringifiedDe
tails) { |
1062 if (mClient == null) return; | 1063 if (mClient == null) return; |
1063 | 1064 |
1064 PaymentResponse response = new PaymentResponse(); | 1065 PaymentResponse response = new PaymentResponse(); |
1065 response.methodName = methodName; | 1066 response.methodName = methodName; |
1066 response.stringifiedDetails = stringifiedDetails; | 1067 response.stringifiedDetails = stringifiedDetails; |
1067 | 1068 |
1068 if (mContactSection != null) { | 1069 if (mPayerInfoSection != null) { |
1069 PaymentOption selectedContact = mContactSection.getSelectedItem(); | 1070 PaymentOption selectedPayerInfo = mPayerInfoSection.getSelectedItem(
); |
1070 if (selectedContact != null) { | 1071 if (selectedPayerInfo != null) { |
1071 // Contacts are created in show(). These should all be instances
of AutofillContact. | 1072 // Payer informations are created in show(). These should all be
instances of |
1072 assert selectedContact instanceof AutofillContact; | 1073 // AutofillPayerInfo. |
1073 response.payerPhone = ((AutofillContact) selectedContact).getPay
erPhone(); | 1074 assert selectedPayerInfo instanceof AutofillPayerInfo; |
1074 response.payerEmail = ((AutofillContact) selectedContact).getPay
erEmail(); | 1075 response.payerPhone = ((AutofillPayerInfo) selectedPayerInfo).ge
tPayerPhone(); |
| 1076 response.payerEmail = ((AutofillPayerInfo) selectedPayerInfo).ge
tPayerEmail(); |
1075 } | 1077 } |
1076 } | 1078 } |
1077 | 1079 |
1078 if (mUiShippingOptions != null) { | 1080 if (mUiShippingOptions != null) { |
1079 PaymentOption selectedShippingOption = mUiShippingOptions.getSelecte
dItem(); | 1081 PaymentOption selectedShippingOption = mUiShippingOptions.getSelecte
dItem(); |
1080 if (selectedShippingOption != null && selectedShippingOption.getIden
tifier() != null) { | 1082 if (selectedShippingOption != null && selectedShippingOption.getIden
tifier() != null) { |
1081 response.shippingOption = selectedShippingOption.getIdentifier()
; | 1083 response.shippingOption = selectedShippingOption.getIdentifier()
; |
1082 } | 1084 } |
1083 } | 1085 } |
1084 | 1086 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 "PaymentRequest.CheckoutFunnel.Aborted", abortReason, | 1264 "PaymentRequest.CheckoutFunnel.Aborted", abortReason, |
1263 PaymentRequestMetrics.ABORT_REASON_MAX); | 1265 PaymentRequestMetrics.ABORT_REASON_MAX); |
1264 | 1266 |
1265 if (abortReason == PaymentRequestMetrics.ABORT_REASON_ABORTED_BY_USER) { | 1267 if (abortReason == PaymentRequestMetrics.ABORT_REASON_ABORTED_BY_USER) { |
1266 mJourneyLogger.recordJourneyStatsHistograms("UserAborted"); | 1268 mJourneyLogger.recordJourneyStatsHistograms("UserAborted"); |
1267 } else { | 1269 } else { |
1268 mJourneyLogger.recordJourneyStatsHistograms("OtherAborted"); | 1270 mJourneyLogger.recordJourneyStatsHistograms("OtherAborted"); |
1269 } | 1271 } |
1270 } | 1272 } |
1271 } | 1273 } |
OLD | NEW |