| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.payments; |
| 6 |
| 7 import org.chromium.mojom.payments.PaymentItem; |
| 8 |
| 9 import java.util.List; |
| 10 import java.util.Set; |
| 11 |
| 12 /** |
| 13 * The interface that a payment app implements. A payment app can get its data f
rom Chrome autofill, |
| 14 * Android Pay, or third party apps. |
| 15 */ |
| 16 public interface PaymentApp { |
| 17 /** |
| 18 * The interface for the requester of instruments. |
| 19 */ |
| 20 public interface InstrumentsCallback { |
| 21 /** |
| 22 * Called by this app to provide a list of instruments asynchronously. |
| 23 * |
| 24 * @param app The calling app. |
| 25 * @param instruments The instruments from this app. |
| 26 */ |
| 27 void onInstrumentsReady(PaymentApp app, List<PaymentInstrument> instrume
nts); |
| 28 } |
| 29 |
| 30 /** |
| 31 * Provides a list of all payment instruments in this app. For example, this
can be all credit |
| 32 * cards for the current profile. Can return null or empty list, e.g., if us
er has no locally |
| 33 * stored credit cards. |
| 34 * |
| 35 * @param items The line items in the payment request. Can be used to filter
out instruments |
| 36 * that, for example, do not have enough funds. |
| 37 * @param callback The object that will receive the list of instruments. |
| 38 */ |
| 39 void getInstruments(List<PaymentItem> items, InstrumentsCallback callback); |
| 40 |
| 41 /** |
| 42 * Returns a list of all payment method names that this app supports. For ex
ample, ["visa", |
| 43 * "mastercard"] in basic card payments. Should return a list of at least on
e method name. |
| 44 * https://w3c.github.io/browser-payment-api/specs/basic-card-payment.html#m
ethod-id |
| 45 * |
| 46 * @return The list of all payment method names that this app supports. |
| 47 */ |
| 48 Set<String> getSupportedMethodNames(); |
| 49 |
| 50 /** |
| 51 * Returns the identifier for this payment app to be saved in user preferenc
es. For example, |
| 52 * this can be "autofill", "https://android.com/pay", or "com.example.app.Ex
amplePaymentApp". |
| 53 * |
| 54 * @return The identifier for this payment app. |
| 55 */ |
| 56 String getIdentifier(); |
| 57 } |
| OLD | NEW |