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 org.json.JSONObject; | |
8 | |
7 import org.chromium.chrome.browser.payments.ui.PaymentOption; | 9 import org.chromium.chrome.browser.payments.ui.PaymentOption; |
8 import org.chromium.payments.mojom.PaymentItem; | 10 import org.chromium.payments.mojom.PaymentItem; |
9 | 11 |
10 import org.json.JSONObject; | |
11 | |
12 import java.util.List; | 12 import java.util.List; |
13 | 13 |
14 /** | 14 /** |
15 * The base class for a single payment instrument, e.g., a credit card. | 15 * The base class for a single payment instrument, e.g., a credit card. |
16 */ | 16 */ |
17 public abstract class PaymentInstrument extends PaymentOption { | 17 public abstract class PaymentInstrument extends PaymentOption { |
18 /** | 18 /** |
19 * The interface for the requester of instrument details. | 19 * The interface for the requester of instrument details. |
20 */ | 20 */ |
21 public interface DetailsCallback { | 21 public interface DetailsCallback { |
22 /** | 22 /** |
23 * Called after retrieving instrument details. | 23 * Called after retrieving instrument details. |
24 * | 24 * |
25 * @param methodName Method name. For example, "visa". | 25 * @param methodName Method name. For example, "visa". |
26 * @param stringifiedDetails JSON-serialized object. For example, {"card ": "123"}. | 26 * @param stringifiedDetails JSON-serialized object. For example, {"card ": "123"}. |
27 */ | 27 */ |
28 void onInstrumentDetailsReady(String methodName, String stringifiedDetai ls); | 28 void onInstrumentDetailsReady(String methodName, String stringifiedDetai ls); |
29 | 29 |
30 /** | 30 /** |
31 * Called when loading the instrument details. | |
please use gerrit instead
2016/10/17 20:44:18
Please elaborate a bit more on this comment. This
sebsg
2016/10/18 14:38:19
Done.
| |
32 */ | |
33 void loadingInstrumentDetails(); | |
please use gerrit instead
2016/10/17 20:44:18
Let's move this callback to be the first one in th
sebsg
2016/10/18 14:38:19
Done.
| |
34 | |
35 /** | |
31 * Called if unable to retrieve instrument details. | 36 * Called if unable to retrieve instrument details. |
32 */ | 37 */ |
33 void onInstrumentDetailsError(); | 38 void onInstrumentDetailsError(); |
34 } | 39 } |
35 | 40 |
36 protected PaymentInstrument(String id, String label, String sublabel, int ic on) { | 41 protected PaymentInstrument(String id, String label, String sublabel, int ic on) { |
37 super(id, label, sublabel, icon); | 42 super(id, label, sublabel, icon); |
38 } | 43 } |
39 | 44 |
40 /** | 45 /** |
(...skipping 17 matching lines...) Expand all Loading... | |
58 */ | 63 */ |
59 public abstract void getDetails(String merchantName, String origin, PaymentI tem total, | 64 public abstract void getDetails(String merchantName, String origin, PaymentI tem total, |
60 List<PaymentItem> cart, JSONObject details, DetailsCallback callback ); | 65 List<PaymentItem> cart, JSONObject details, DetailsCallback callback ); |
61 | 66 |
62 /** | 67 /** |
63 * Cleans up any resources held by the payment instrument. For example, clos es server | 68 * Cleans up any resources held by the payment instrument. For example, clos es server |
64 * connections. | 69 * connections. |
65 */ | 70 */ |
66 public abstract void dismiss(); | 71 public abstract void dismiss(); |
67 } | 72 } |
OLD | NEW |