Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentApp.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentApp.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentApp.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e632ce9ee6159abea09bfe7b8e529e655b2731e7 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentApp.java |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.chrome.browser.payments; |
| + |
| +import org.chromium.chrome.browser.payments.ui.LineItem; |
| + |
| +import java.util.ArrayList; |
| +import java.util.HashSet; |
| +import java.util.List; |
| + |
| +/** |
| + * The interface that a payment app implements. A payment app can get its data from Chrome autofill, |
| + * Android Pay, or third party apps. |
| + */ |
| +public interface PaymentApp { |
| + /** |
| + * The interface for the requester of instruments. |
| + */ |
| + public interface InstrumentsCallback { |
| + /** |
| + * Called by this app to provide a list of instruments asynchronously. |
| + * |
| + * @param app The calling app. |
| + * @param instruments The instruments from this app. |
| + */ |
| + void onInstrumentsReady(PaymentApp app, List<PaymentInstrument> instruments); |
| + } |
| + |
| + /** |
| + * Provides a list of all payment instruments in this app. For example, this can be all credit |
| + * cards for the current profile. Can return null or empty list, e.g., if user has no locally |
| + * stored credit cards. |
| + * |
| + * @param items The line items in the payment request. Can be used to filter out instruments |
| + * that, for example, do not have enough funds. |
| + * @param callback The object that will receive the list of instruments. |
| + */ |
| + void getInstruments(ArrayList<LineItem> items, InstrumentsCallback callback); |
|
Ted C
2016/04/22 03:59:37
any reason we don't use vanilla List here?
please use gerrit instead
2016/04/25 19:22:30
Was ensuring O(1) random access, until you assured
|
| + |
| + /** |
| + * Returns a list of all payment method names that this app supports. For example, ["visa", |
| + * "mastercard"] in basic card payments. Should return a list of at least one method name. |
| + * https://w3c.github.io/browser-payment-api/specs/basic-card-payment.html#method-id |
| + * |
| + * @return The list of all payment method names that this app supports. |
| + */ |
| + HashSet<String> getSupportedMethodNames(); |
|
Ted C
2016/04/22 03:59:37
same thing...should use a vanilla Set if we can.
please use gerrit instead
2016/04/25 19:22:30
Done.
|
| + |
| + /** |
| + * Returns the identifier for this payment app to be saved in user preferences. For example, |
| + * this can be "autofill", "https://android.com/pay", or "com.example.app.ExamplePaymentApp". |
| + * |
| + * @return The identifier for this payment app. |
| + */ |
| + String getIdentifier(); |
| +} |