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

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

Issue 2406923002: Move payment_request.mojom file to components/ (Closed)
Patch Set: Add Android test dependencies Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/public/platform/modules/payments/OWNERS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.payments.mojom"]
6 module blink.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 PaymentAddress {
11 // ISO 3166 country code. Two upper case ASCII letters.
12 string country;
13
14 array<string> address_line;
15 string region;
16 string city;
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 15924 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 string phone;
32 };
33
34 // The currency amount that the renderer provides to the browser process. The
35 // browser shows the amount in UI and forwards it on to the payment app, if it
36 // requires the amount.
37 struct PaymentCurrencyAmount {
38 // The most common identifiers are three-letter alphabetic codes as defined
39 // by [ISO4217] (for example, "USD" for US Dollars), however any string of at
40 // most 2048 characters is considered valid.
41 string currency;
42
43 // ISO 20022 CurrencyAnd30Amount. Up to 30 total digits. Up to 10 fraction
44 // digits. Separated by a dot.
45 string value;
46 };
47
48 struct PaymentResponse {
49 string method_name;
50
51 // Payment method specific JSON string that is built either by the browser or
52 // a payment app, for example Android Pay. Browser ensures that the string can
53 // be successfully parsed into base::JSONParser. Renderer parses this string
54 // via v8::JSON::Parse() and hands off the result to the merchant website.
55 // There's no one format for this object, so richer types cannot be used. A
56 // simple example:
57 //
58 // {"nameOnCard": "Jon Doe", "pan": "4111 1111 1111 1111"}
59 string stringified_details;
60
61 PaymentAddress? shipping_address;
62 string? shipping_option;
63 string? payer_name;
64 string? payer_email;
65 string? payer_phone;
66 };
67
68 enum PaymentErrorReason {
69 UNKNOWN,
70 USER_CANCEL,
71 NOT_SUPPORTED
72 };
73
74 interface PaymentRequestClient {
75 OnShippingAddressChange(PaymentAddress address);
76 OnShippingOptionChange(string shipping_option_id);
77 OnPaymentResponse(PaymentResponse response);
78 OnError(PaymentErrorReason error);
79 OnComplete();
80 OnAbort(bool aborted_successfully);
81 };
82
83 struct PaymentItem {
84 string label;
85 PaymentCurrencyAmount amount;
86 };
87
88 struct PaymentShippingOption {
89 string id;
90 string label;
91 PaymentCurrencyAmount amount;
92 bool selected;
93 };
94
95 struct PaymentDetailsModifier {
96 array<string> supported_methods;
97 PaymentItem total;
98 array<PaymentItem> additional_display_items;
99 };
100
101 struct PaymentDetails {
102 PaymentItem total;
103 array<PaymentItem> display_items;
104 array<PaymentShippingOption> shipping_options;
105 array<PaymentDetailsModifier> modifiers;
106 string error;
107 };
108
109 struct PaymentOptions {
110 bool request_payer_name;
111 bool request_payer_email;
112 bool request_payer_phone;
113 bool request_shipping;
114 };
115
116 struct PaymentMethodData {
117 array<string> supported_methods;
118 // A JSON string built by the renderer from a JavaScript object that the
119 // merchant website provides. The renderer uses
120 // blink::JSONObject::toJSONString() to generate this string. The browser
121 // parses the string via JSONObject(JsonSanitizer.sanitize(stringified_data))
122 // and passes a part of the JSON object to the payment app, for example
123 // Android Pay. There's no one format for this object, so richer types cannot
124 // be used. A simple example:
125 //
126 // {"gateway": "stripe"}
127 string stringified_data;
128 };
129
130 enum PaymentComplete {
131 SUCCESS,
132 FAIL,
133 UNKNOWN
134 };
135
136 interface PaymentRequest {
137 Init(PaymentRequestClient client,
138 array<PaymentMethodData> methodData,
139 PaymentDetails details,
140 PaymentOptions options);
141 Show();
142 UpdateWith(PaymentDetails details);
143 Abort();
144 Complete(PaymentComplete result);
145 };
OLDNEW
« no previous file with comments | « third_party/WebKit/public/platform/modules/payments/OWNERS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698