Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentInstrument.java

Issue 1904553003: Java implementation of PaymentRequest mojo service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable Pay button before user provided required information. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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.chrome.browser.payments.ui.LineItem;
8 import org.chromium.chrome.browser.payments.ui.PaymentOption;
9
10 import org.json.JSONObject;
11
12 import java.util.ArrayList;
13
14 /**
15 * The base class for a single payment instrument, e.g., a credit card.
16 */
17 public abstract class PaymentInstrument extends PaymentOption {
18 /**
19 * The interface for the requester of instrument details.
20 */
21 public interface DetailsCallback {
22 /**
23 * Called after retrieving instrument details.
24 *
25 * @param methodName Method name. For example, "visa".
26 * @param stringifiedDetails JSON-serialized object. For example, {"card ": "123"}.
27 */
28 void onInstrumentDetailsReady(String methodName, String stringifiedDetai ls);
29
30 /**
31 * Called if unable to retrieve instrument details.
32 */
33 void onInstrumentDetailsError();
34 }
35
36 protected PaymentInstrument(String id, String label, String sublabel, int ic on) {
37 super(id, label, sublabel, icon);
38 }
39
40 /**
41 * 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
43 *
44 * @return The method name for this instrument.
45 */
46 public abstract String getMethodName();
47
48 /**
49 * Asynchronously retrieves the instrument details and invokes the callback with the result.
50 *
51 * @param merchantName The name of the merchant.
52 * @param origin The origin of this merchant.
53 * @param items The line items, the last of which is the total.
54 * @param details The payment-method specific data.
55 * @param callback The object that will receive the instrument details.
56 */
57 public abstract void getDetails(String merchantName, String origin, ArrayLis t<LineItem> items,
Ted C 2016/04/22 03:59:37 List vs ArrayList comment as before
please use gerrit instead 2016/04/25 19:22:30 Done.
58 JSONObject details, DetailsCallback callback);
59
60 /**
61 * Cleans up any resources held by the payment instrument. For example, clos es server
62 * connections.
63 */
64 public abstract void dismiss();
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698