org.chromium.chrome.browser.payments.ui.PaymentInformation Java Examples
The following examples show how to use
org.chromium.chrome.browser.payments.ui.PaymentInformation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PaymentRequestImpl.java From delion with Apache License 2.0 | 6 votes |
@Override public boolean onSectionAddOption( @PaymentRequestUI.DataType int optionType, Callback<PaymentInformation> callback) { if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { editAddress(null); if (mMerchantNeedsShippingAddress) { mPaymentInformationCallback = callback; return true; } } else if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) { editContact(null); } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { PreferencesLauncher.launchSettingsPage( mContext, AutofillLocalCardEditor.class.getName()); } return false; }
Example #2
Source File: PaymentRequestImpl.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override @PaymentRequestUI.SelectionResult public int onSectionEditOption(@PaymentRequestUI.DataType int optionType, PaymentOption option, Callback<PaymentInformation> callback) { if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { assert option instanceof AutofillAddress; editAddress((AutofillAddress) option); mPaymentInformationCallback = callback; return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; } if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) { assert option instanceof AutofillContact; editContact((AutofillContact) option); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { assert option instanceof AutofillPaymentInstrument; editCard((AutofillPaymentInstrument) option); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } assert false; return PaymentRequestUI.SELECTION_RESULT_NONE; }
Example #3
Source File: PaymentRequestImpl.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override @PaymentRequestUI.SelectionResult public int onSectionAddOption( @PaymentRequestUI.DataType int optionType, Callback<PaymentInformation> callback) { if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { editAddress(null); mPaymentInformationCallback = callback; // Log the add of shipping address. mJourneyLogger.incrementSelectionAdds( PaymentRequestJourneyLogger.SECTION_SHIPPING_ADDRESS); return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; } else if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) { editContact(null); // Log the add of contact info. mJourneyLogger.incrementSelectionAdds(PaymentRequestJourneyLogger.SECTION_CONTACT_INFO); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { editCard(null); // Log the add of credit card. mJourneyLogger.incrementSelectionAdds(PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } return PaymentRequestUI.SELECTION_RESULT_NONE; }
Example #4
Source File: PaymentRequestImpl.java From 365browser with Apache License 2.0 | 6 votes |
@Override @PaymentRequestUI.SelectionResult public int onSectionEditOption(@PaymentRequestUI.DataType int optionType, PaymentOption option, Callback<PaymentInformation> callback) { if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { assert option instanceof AutofillAddress; editAddress((AutofillAddress) option); mPaymentInformationCallback = callback; return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; } if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) { assert option instanceof AutofillContact; editContact((AutofillContact) option); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { assert option instanceof AutofillPaymentInstrument; editCard((AutofillPaymentInstrument) option); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } assert false; return PaymentRequestUI.SELECTION_RESULT_NONE; }
Example #5
Source File: PaymentRequestImpl.java From 365browser with Apache License 2.0 | 6 votes |
@Override @PaymentRequestUI.SelectionResult public int onSectionAddOption( @PaymentRequestUI.DataType int optionType, Callback<PaymentInformation> callback) { if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { editAddress(null); mPaymentInformationCallback = callback; // Log the add of shipping address. mJourneyLogger.incrementSelectionAdds(Section.SHIPPING_ADDRESS); return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; } else if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) { editContact(null); // Log the add of contact info. mJourneyLogger.incrementSelectionAdds(Section.CONTACT_INFO); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { editCard(null); // Log the add of credit card. mJourneyLogger.incrementSelectionAdds(Section.CREDIT_CARDS); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } return PaymentRequestUI.SELECTION_RESULT_NONE; }
Example #6
Source File: PaymentRequestImpl.java From delion with Apache License 2.0 | 5 votes |
/** * Called to retrieve the data to show in the initial PaymentRequest UI. */ @Override public void getDefaultPaymentInformation(Callback<PaymentInformation> callback) { mPaymentInformationCallback = callback; if (mPaymentMethodsSection == null) return; mHandler.post(new Runnable() { @Override public void run() { providePaymentInformation(); } }); }
Example #7
Source File: PaymentRequestImpl.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Called to retrieve the data to show in the initial PaymentRequest UI. */ @Override public void getDefaultPaymentInformation(Callback<PaymentInformation> callback) { mPaymentInformationCallback = callback; if (mPaymentMethodsSection == null) return; mHandler.post(new Runnable() { @Override public void run() { providePaymentInformation(); } }); }
Example #8
Source File: PaymentRequestImpl.java From 365browser with Apache License 2.0 | 5 votes |
/** * Called to retrieve the data to show in the initial PaymentRequest UI. */ @Override public void getDefaultPaymentInformation(Callback<PaymentInformation> callback) { mPaymentInformationCallback = callback; if (mPaymentMethodsSection == null) return; mHandler.post(new Runnable() { @Override public void run() { if (mUI != null) providePaymentInformation(); } }); }
Example #9
Source File: PaymentRequestImpl.java From 365browser with Apache License 2.0 | 5 votes |
private void providePaymentInformation() { mPaymentInformationCallback.onResult( new PaymentInformation(mUiShoppingCart, mShippingAddressesSection, mUiShippingOptions, mContactSection, mPaymentMethodsSection)); mPaymentInformationCallback = null; if (!mDidRecordShowEvent) { mDidRecordShowEvent = true; mShouldRecordAbortReason = true; mJourneyLogger.setEventOccurred(Event.SHOWN); mJourneyLogger.setShowCalled(); } }
Example #10
Source File: PaymentRequestImpl.java From delion with Apache License 2.0 | 4 votes |
private void providePaymentInformation() { mPaymentInformationCallback.onResult( new PaymentInformation(mUiShoppingCart, mShippingAddressesSection, mUiShippingOptions, mContactSection, mPaymentMethodsSection)); mPaymentInformationCallback = null; }
Example #11
Source File: PaymentRequestImpl.java From delion with Apache License 2.0 | 4 votes |
@Override public boolean onSectionOptionSelected(@PaymentRequestUI.DataType int optionType, PaymentOption option, Callback<PaymentInformation> callback) { if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { assert option instanceof AutofillAddress; AutofillAddress address = (AutofillAddress) option; if (address.isComplete()) { mShippingAddressesSection.setSelectedItem(option); // This updates the line items and the shipping options asynchronously. if (mMerchantNeedsShippingAddress) { mClient.onShippingAddressChange(address.toPaymentAddress()); } } else { editAddress(address); } if (mMerchantNeedsShippingAddress) { mPaymentInformationCallback = callback; return true; } } else if (optionType == PaymentRequestUI.TYPE_SHIPPING_OPTIONS) { // This may update the line items. mUiShippingOptions.setSelectedItem(option); mClient.onShippingOptionChange(option.getIdentifier()); } else if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) { assert option instanceof AutofillContact; AutofillContact contact = (AutofillContact) option; if (contact.isComplete()) { mContactSection.setSelectedItem(option); } else { editContact(contact); } } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { assert option instanceof PaymentInstrument; mPaymentMethodsSection.setSelectedItem(option); } return false; }
Example #12
Source File: PaymentRequestImpl.java From AndroidChromium with Apache License 2.0 | 4 votes |
private void providePaymentInformation() { mPaymentInformationCallback.onResult( new PaymentInformation(mUiShoppingCart, mShippingAddressesSection, mUiShippingOptions, mContactSection, mPaymentMethodsSection)); mPaymentInformationCallback = null; }
Example #13
Source File: PaymentRequestImpl.java From AndroidChromium with Apache License 2.0 | 4 votes |
@Override @PaymentRequestUI.SelectionResult public int onSectionOptionSelected(@PaymentRequestUI.DataType int optionType, PaymentOption option, Callback<PaymentInformation> callback) { if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { assert option instanceof AutofillAddress; // Log the change of shipping address. mJourneyLogger.incrementSelectionChanges( PaymentRequestJourneyLogger.SECTION_SHIPPING_ADDRESS); AutofillAddress address = (AutofillAddress) option; if (address.isComplete()) { mShippingAddressesSection.setSelectedItem(option); // This updates the line items and the shipping options asynchronously. mClient.onShippingAddressChange(address.toPaymentAddress()); } else { editAddress(address); } mPaymentInformationCallback = callback; return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; } else if (optionType == PaymentRequestUI.TYPE_SHIPPING_OPTIONS) { // This may update the line items. mUiShippingOptions.setSelectedItem(option); mClient.onShippingOptionChange(option.getIdentifier()); mPaymentInformationCallback = callback; return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; } else if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) { assert option instanceof AutofillContact; // Log the change of contact info. mJourneyLogger.incrementSelectionChanges( PaymentRequestJourneyLogger.SECTION_CONTACT_INFO); AutofillContact contact = (AutofillContact) option; if (contact.isComplete()) { mContactSection.setSelectedItem(option); } else { editContact(contact); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { assert option instanceof PaymentInstrument; if (option instanceof AutofillPaymentInstrument) { // Log the change of credit card. mJourneyLogger.incrementSelectionChanges( PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS); AutofillPaymentInstrument card = (AutofillPaymentInstrument) option; if (!card.isComplete()) { editCard(card); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } } mPaymentMethodsSection.setSelectedItem(option); } return PaymentRequestUI.SELECTION_RESULT_NONE; }
Example #14
Source File: PaymentRequestImpl.java From 365browser with Apache License 2.0 | 4 votes |
@Override @PaymentRequestUI.SelectionResult public int onSectionOptionSelected(@PaymentRequestUI.DataType int optionType, PaymentOption option, Callback<PaymentInformation> callback) { if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { assert option instanceof AutofillAddress; // Log the change of shipping address. mJourneyLogger.incrementSelectionChanges(Section.SHIPPING_ADDRESS); AutofillAddress address = (AutofillAddress) option; if (address.isComplete()) { mShippingAddressesSection.setSelectedItem(option); startShippingAddressChangeNormalization(address); } else { editAddress(address); } mPaymentInformationCallback = callback; return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; } else if (optionType == PaymentRequestUI.TYPE_SHIPPING_OPTIONS) { // This may update the line items. mUiShippingOptions.setSelectedItem(option); mClient.onShippingOptionChange(option.getIdentifier()); mPaymentInformationCallback = callback; return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; } else if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) { assert option instanceof AutofillContact; // Log the change of contact info. mJourneyLogger.incrementSelectionChanges(Section.CONTACT_INFO); AutofillContact contact = (AutofillContact) option; if (contact.isComplete()) { mContactSection.setSelectedItem(option); } else { editContact(contact); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) { assert option instanceof PaymentInstrument; if (option instanceof AutofillPaymentInstrument) { // Log the change of credit card. mJourneyLogger.incrementSelectionChanges(Section.CREDIT_CARDS); AutofillPaymentInstrument card = (AutofillPaymentInstrument) option; if (!card.isComplete()) { editCard(card); return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; } } updateOrderSummary((PaymentInstrument) option); mPaymentMethodsSection.setSelectedItem(option); } return PaymentRequestUI.SELECTION_RESULT_NONE; }