| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 string? currencySystem; | 51 string? currencySystem; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 struct PaymentResponse { | 54 struct PaymentResponse { |
| 55 string method_name; | 55 string method_name; |
| 56 | 56 |
| 57 // Payment method specific JSON string that is built either by the browser or | 57 // Payment method specific JSON string that is built either by the browser or |
| 58 // a payment app, for example Android Pay. Browser ensures that the string can | 58 // a payment app, for example Android Pay. Browser ensures that the string can |
| 59 // be successfully parsed into base::JSONParser. Renderer parses this string | 59 // be successfully parsed into base::JSONParser. Renderer parses this string |
| 60 // via v8::JSON::Parse() and hands off the result to the merchant website. | 60 // via v8::JSON::Parse() and hands off the result to the merchant website. |
| 61 // There's no one format for this object, so richer types cannot be used. A | 61 // There's no one format for this object, so more specific types cannot be |
| 62 // simple example: | 62 // used. A simple example: |
| 63 // | 63 // |
| 64 // {"nameOnCard": "Jon Doe", "pan": "4111 1111 1111 1111"} | 64 // {"nameOnCard": "Jon Doe", "pan": "4111 1111 1111 1111"} |
| 65 string stringified_details; | 65 string stringified_details; |
| 66 | 66 |
| 67 PaymentAddress? shipping_address; | 67 PaymentAddress? shipping_address; |
| 68 string? shipping_option; | 68 string? shipping_option; |
| 69 string? payer_name; | 69 string? payer_name; |
| 70 string? payer_email; | 70 string? payer_email; |
| 71 string? payer_phone; | 71 string? payer_phone; |
| 72 }; | 72 }; |
| (...skipping 26 matching lines...) Expand all 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 more specific types cannot be used. A |
| 117 // simple 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 |