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 [JavaPackage="org.chromium.mojom.payments"] | 5 [JavaPackage="org.chromium.mojom.payments"] |
6 module blink.mojom; | 6 module blink.mojom; |
7 | 7 |
8 // The shipping address that the browser process provides to the renderer | 8 // The shipping address that the browser process provides to the renderer |
9 // process. Built either by the browser or a payment app. | 9 // process. Built either by the browser or a payment app. |
10 struct PaymentAddress { | 10 struct PaymentAddress { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 struct PaymentDetails { | 84 struct PaymentDetails { |
85 PaymentItem total; | 85 PaymentItem total; |
86 array<PaymentItem> display_items; | 86 array<PaymentItem> display_items; |
87 array<ShippingOption> shipping_options; | 87 array<ShippingOption> shipping_options; |
88 }; | 88 }; |
89 | 89 |
90 struct PaymentOptions { | 90 struct PaymentOptions { |
91 bool request_shipping; | 91 bool request_shipping; |
92 }; | 92 }; |
93 | 93 |
| 94 struct PaymentMethodData { |
| 95 array<string> supported_methods; |
| 96 // A JSON string built by the renderer from a JavaScript object that the |
| 97 // merchant website provides. The renderer uses |
| 98 // blink::JSONObject::toJSONString() to generate this string. The browser |
| 99 // parses the string via JSONObject(JsonSanitizer.sanitize(stringified_data)) |
| 100 // and passes a part of the JSON object to the payment app, for example |
| 101 // Android Pay. There's no one format for this object, so richer types cannot |
| 102 // be used. A simple example: |
| 103 // |
| 104 // {"gateway": "stripe"} |
| 105 string stringified_data; |
| 106 }; |
| 107 |
94 interface PaymentRequest { | 108 interface PaymentRequest { |
95 SetClient(PaymentRequestClient client); | 109 SetClient(PaymentRequestClient client); |
96 Show(array<string> supported_methods, | 110 Show(array<PaymentMethodData> methodData, |
97 PaymentDetails details, | 111 PaymentDetails details, |
98 PaymentOptions options, | 112 PaymentOptions options); |
99 // A JSON string built by the renderer from a JavaScript object that the | |
100 // merchant website provides. The renderer uses | |
101 // blink::JSONObject::toJSONString() to generate this string. The browser | |
102 // parses the string via base::JSONParser and passes a part of the JSON | |
103 // object to the payment app, for example Android Pay. There's no one | |
104 // format for this object, so richer types cannot be used. A simple | |
105 // example: | |
106 // | |
107 // {"https://android.com/pay": {"gateway": "stripe"}} | |
108 string stringified_data); | |
109 UpdateWith(PaymentDetails details); | 113 UpdateWith(PaymentDetails details); |
110 Abort(); | 114 Abort(); |
111 Complete(bool success); | 115 Complete(bool success); |
112 }; | 116 }; |
OLD | NEW |