Chromium Code Reviews| 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.payments.mojom"] | 5 [JavaPackage="org.chromium.payments.mojom"] |
| 6 module payments.mojom; | 6 module payments.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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 bool pending; | 99 bool pending; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 struct PaymentShippingOption { | 102 struct PaymentShippingOption { |
| 103 string id; | 103 string id; |
| 104 string label; | 104 string label; |
| 105 PaymentCurrencyAmount amount; | 105 PaymentCurrencyAmount amount; |
| 106 bool selected; | 106 bool selected; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 struct PaymentMethodData { | |
| 110 array<string> supported_methods; | |
| 111 | |
| 112 // A JSON string built by the renderer from a JavaScript object that the | |
| 113 // merchant website provides. The renderer uses | |
| 114 // blink::JSONObject::toJSONString() to generate this string. The browser does | |
| 115 // not parse the string and passes it as-is directly to payment apps. There's | |
| 116 // no one format for this object, so richer types cannot be used. A simple | |
|
palmer
2016/11/29 00:24:55
Nit: s/richer/more specific/
please use gerrit instead
2016/11/29 16:19:52
Done.
| |
| 117 // example: | |
| 118 // | |
| 119 // {"gateway": "stripe"} | |
| 120 string stringified_data; | |
| 121 | |
| 122 // Android Pay specific method data is parsed in the renderer. | |
| 123 // https://developers.google.com/web/fundamentals/getting-started/primers/paym ent-request/android-pay | |
| 124 // TODO(rouslan): Stop parsing Android Pay data. http://crbug.com/620173 | |
| 125 AndroidPayEnvironment environment; | |
| 126 string? merchant_name; | |
| 127 string? merchant_id; | |
| 128 array<AndroidPayCardNetwork> allowed_card_networks; | |
| 129 AndroidPayTokenization tokenization_type; | |
| 130 array<AndroidPayTokenizationParameter> parameters; | |
| 131 }; | |
| 132 | |
| 109 struct PaymentDetailsModifier { | 133 struct PaymentDetailsModifier { |
| 110 array<string> supported_methods; | |
| 111 PaymentItem? total; | 134 PaymentItem? total; |
| 112 array<PaymentItem> additional_display_items; | 135 array<PaymentItem> additional_display_items; |
| 136 PaymentMethodData method_data; | |
| 113 }; | 137 }; |
| 114 | 138 |
| 115 struct PaymentDetails { | 139 struct PaymentDetails { |
| 116 PaymentItem total; | 140 PaymentItem total; |
| 117 array<PaymentItem> display_items; | 141 array<PaymentItem> display_items; |
| 118 array<PaymentShippingOption> shipping_options; | 142 array<PaymentShippingOption> shipping_options; |
| 119 array<PaymentDetailsModifier> modifiers; | 143 array<PaymentDetailsModifier> modifiers; |
| 120 string error; | 144 string error; |
| 121 }; | 145 }; |
| 122 | 146 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 150 UNSPECIFIED, | 174 UNSPECIFIED, |
| 151 GATEWAY_TOKEN, | 175 GATEWAY_TOKEN, |
| 152 NETWORK_TOKEN | 176 NETWORK_TOKEN |
| 153 }; | 177 }; |
| 154 | 178 |
| 155 struct AndroidPayTokenizationParameter { | 179 struct AndroidPayTokenizationParameter { |
| 156 string? key; | 180 string? key; |
| 157 string? value; | 181 string? value; |
| 158 }; | 182 }; |
| 159 | 183 |
| 160 struct PaymentMethodData { | |
| 161 array<string> supported_methods; | |
| 162 | |
| 163 // A JSON string built by the renderer from a JavaScript object that the | |
| 164 // merchant website provides. The renderer uses | |
| 165 // blink::JSONObject::toJSONString() to generate this string. The browser does | |
| 166 // not parse the string and passes it as-is directly to payment apps. There's | |
| 167 // no one format for this object, so richer types cannot be used. A simple | |
| 168 // example: | |
| 169 // | |
| 170 // {"gateway": "stripe"} | |
| 171 string stringified_data; | |
| 172 | |
| 173 // Android Pay specific method data is parsed in the renderer. | |
| 174 // https://developers.google.com/web/fundamentals/getting-started/primers/paym ent-request/android-pay | |
| 175 // TODO(rouslan): Stop parsing Android Pay data. http://crbug.com/620173 | |
| 176 AndroidPayEnvironment environment; | |
| 177 string? merchant_name; | |
| 178 string? merchant_id; | |
| 179 array<AndroidPayCardNetwork> allowed_card_networks; | |
| 180 AndroidPayTokenization tokenization_type; | |
| 181 array<AndroidPayTokenizationParameter> parameters; | |
| 182 }; | |
| 183 | |
| 184 enum PaymentComplete { | 184 enum PaymentComplete { |
| 185 SUCCESS, | 185 SUCCESS, |
| 186 FAIL, | 186 FAIL, |
| 187 UNKNOWN | 187 UNKNOWN |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 interface PaymentRequest { | 190 interface PaymentRequest { |
| 191 Init(PaymentRequestClient client, | 191 Init(PaymentRequestClient client, |
| 192 array<PaymentMethodData> methodData, | 192 array<PaymentMethodData> methodData, |
| 193 PaymentDetails details, | 193 PaymentDetails details, |
| 194 PaymentOptions options); | 194 PaymentOptions options); |
| 195 Show(); | 195 Show(); |
| 196 UpdateWith(PaymentDetails details); | 196 UpdateWith(PaymentDetails details); |
| 197 Abort(); | 197 Abort(); |
| 198 Complete(PaymentComplete result); | 198 Complete(PaymentComplete result); |
| 199 CanMakeActivePayment(); | 199 CanMakeActivePayment(); |
| 200 }; | 200 }; |
| OLD | NEW |