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

Side by Side Diff: third_party/WebKit/public/platform/modules/payments/payment_request.mojom

Issue 1753543002: PaymentRequest Mojo bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface
Patch Set: haraken@'s + esprehn@'s comments 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 [JavaPackage="org.chromium.mojom.payments"]
6 module mojom;
7
8 // The shipping address that the browser process provides to the renderer
9 // process. Built either by the browser or a payment app.
10 struct ShippingAddress {
11 // ISO 3166 country code. Two upper case ASCII letters.
12 string region_code;
13
14 array<string> address_line;
15 string administrative_area;
16 string locality;
17 string dependent_locality;
18 string postal_code;
19 string sorting_code;
20
21 // Optional shortest ISO 639 language code. Two or three lower case ASCII
22 // letters.
23 string language_code;
24
25 // Optional ISO 1524 script code. Four ASCII letters. The first letter is
26 // upper case; the rest are lower case.
27 string script_code;
28
29 string organization;
30 string recipient;
31 };
32
33 struct PaymentResponse {
34 string method_name;
35
36 // Payment method specific JSON string that is built either by the browser or
37 // a payment app, for example Android Pay. Browser ensures that the string can
38 // be successfully parsed into base::JSONParser. Renderer parses this string
39 // via v8::JSON::Parse() and hands off the result to the merchant website.
40 // There's no one format for this object, so richer types cannot be used. A
41 // simple example:
42 //
43 // {"nameOnCard": "Jon Doe", "pan": "4111 1111 1111 1111"}
44 string stringified_details;
45 };
46
47 interface PaymentRequestClient {
48 OnShippingAddressChange(ShippingAddress address);
49 OnShippingOptionChange(string shipping_option_id);
50 OnPaymentResponse(PaymentResponse response);
51 OnError();
52 OnComplete();
53 };
54
55 // The currency amount that the renderer provides to the browser process. The
56 // browser shows the amount in UI and forwards it on to the payment app, if it
57 // requires the amount.
58 struct CurrencyAmount {
59 // ISO 4217 currency code. Three upper case ASCII letters.
60 string currency_code;
61
62 // ISO 20022 CurrencyAnd30Amount. Up to 30 total digits. Up to 10 fraction
63 // digits. Separated by a dot.
64 string value;
65 };
66
67 struct PaymentItem {
68 string id;
69 string label;
70 CurrencyAmount amount;
71 };
72
73 struct ShippingOption {
74 string id;
75 string label;
76 CurrencyAmount amount;
77 };
78
79 struct PaymentDetails {
80 array<PaymentItem> items;
81 array<ShippingOption> shipping_options;
82 };
83
84 struct PaymentOptions {
85 bool request_shipping;
86 };
87
88 interface PaymentRequest {
89 SetClient(PaymentRequestClient client);
90 Show(array<string> supported_methods,
91 PaymentDetails details,
92 PaymentOptions options,
93 // A JSON string built by the renderer from a JavaScript object that the
94 // merchant website provides. The renderer uses
95 // blink::JSONObject::toJSONString() to generate this string. The browser
96 // parses the string via base::JSONParser and passes a part of the JSON
97 // object to the payment app, for example Android Pay. There's no one
98 // format for this object, so richer types cannot be used. A simple
99 // example:
100 //
101 // {"https://android.com/pay": {"gateway": "stripe"}}
102 string stringified_data);
103 Abort();
104 Complete(bool success);
105 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698