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.graphics.drawable.Drawable; |
| 8 |
| 9 import org.json.JSONObject; |
| 10 |
7 import org.chromium.chrome.browser.payments.ui.PaymentOption; | 11 import org.chromium.chrome.browser.payments.ui.PaymentOption; |
8 import org.chromium.payments.mojom.PaymentItem; | 12 import org.chromium.payments.mojom.PaymentItem; |
9 | 13 |
10 import org.json.JSONObject; | |
11 | |
12 import java.util.List; | 14 import java.util.List; |
13 | 15 |
14 /** | 16 /** |
15 * The base class for a single payment instrument, e.g., a credit card. | 17 * The base class for a single payment instrument, e.g., a credit card. |
16 */ | 18 */ |
17 public abstract class PaymentInstrument extends PaymentOption { | 19 public abstract class PaymentInstrument extends PaymentOption { |
18 /** | 20 /** |
19 * The interface for the requester of instrument details. | 21 * The interface for the requester of instrument details. |
20 */ | 22 */ |
21 public interface DetailsCallback { | 23 public interface DetailsCallback { |
22 /** | 24 /** |
23 * Called after retrieving instrument details. | 25 * Called after retrieving instrument details. |
24 * | 26 * |
25 * @param methodName Method name. For example, "visa". | 27 * @param methodName Method name. For example, "visa". |
26 * @param stringifiedDetails JSON-serialized object. For example, {"card
": "123"}. | 28 * @param stringifiedDetails JSON-serialized object. For example, {"card
": "123"}. |
27 */ | 29 */ |
28 void onInstrumentDetailsReady(String methodName, String stringifiedDetai
ls); | 30 void onInstrumentDetailsReady(String methodName, String stringifiedDetai
ls); |
29 | 31 |
30 /** | 32 /** |
31 * Called if unable to retrieve instrument details. | 33 * Called if unable to retrieve instrument details. |
32 */ | 34 */ |
33 void onInstrumentDetailsError(); | 35 void onInstrumentDetailsError(); |
34 } | 36 } |
35 | 37 |
36 protected PaymentInstrument(String id, String label, String sublabel, int ic
on) { | 38 protected PaymentInstrument(String id, String label, String sublabel, Drawab
le icon) { |
37 super(id, label, sublabel, icon); | 39 super(id, label, sublabel, icon); |
38 } | 40 } |
39 | 41 |
40 /** | 42 /** |
41 * Returns the method name for this instrument, e.g., "visa" or "mastercard"
in basic card | 43 * Returns the method name for this instrument, e.g., "visa" or "mastercard"
in basic card |
42 * payments: https://w3c.github.io/browser-payment-api/specs/basic-card-paym
ent.html#method-id | 44 * payments: https://w3c.github.io/browser-payment-api/specs/basic-card-paym
ent.html#method-id |
43 * | 45 * |
44 * @return The method name for this instrument. | 46 * @return The method name for this instrument. |
45 */ | 47 */ |
46 public abstract String getMethodName(); | 48 public abstract String getMethodName(); |
(...skipping 11 matching lines...) Expand all Loading... |
58 */ | 60 */ |
59 public abstract void getDetails(String merchantName, String origin, PaymentI
tem total, | 61 public abstract void getDetails(String merchantName, String origin, PaymentI
tem total, |
60 List<PaymentItem> cart, JSONObject details, DetailsCallback callback
); | 62 List<PaymentItem> cart, JSONObject details, DetailsCallback callback
); |
61 | 63 |
62 /** | 64 /** |
63 * Cleans up any resources held by the payment instrument. For example, clos
es server | 65 * Cleans up any resources held by the payment instrument. For example, clos
es server |
64 * connections. | 66 * connections. |
65 */ | 67 */ |
66 public abstract void dismiss(); | 68 public abstract void dismiss(); |
67 } | 69 } |
OLD | NEW |