| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 OnShippingAddressChange(PaymentAddress address); | 53 OnShippingAddressChange(PaymentAddress address); |
| 54 OnShippingOptionChange(string shipping_option_id); | 54 OnShippingOptionChange(string shipping_option_id); |
| 55 OnPaymentResponse(PaymentResponse response); | 55 OnPaymentResponse(PaymentResponse response); |
| 56 OnError(); | 56 OnError(); |
| 57 OnComplete(); | 57 OnComplete(); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 // The currency amount that the renderer provides to the browser process. The | 60 // The currency amount that the renderer provides to the browser process. The |
| 61 // browser shows the amount in UI and forwards it on to the payment app, if it | 61 // browser shows the amount in UI and forwards it on to the payment app, if it |
| 62 // requires the amount. | 62 // requires the amount. |
| 63 struct CurrencyAmount { | 63 struct PaymentCurrencyAmount { |
| 64 // ISO 4217 currency code. Three upper case ASCII letters. | 64 // ISO 4217 currency code. Three upper case ASCII letters. |
| 65 string currency_code; | 65 string currency_code; |
| 66 | 66 |
| 67 // ISO 20022 CurrencyAnd30Amount. Up to 30 total digits. Up to 10 fraction | 67 // ISO 20022 CurrencyAnd30Amount. Up to 30 total digits. Up to 10 fraction |
| 68 // digits. Separated by a dot. | 68 // digits. Separated by a dot. |
| 69 string value; | 69 string value; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 struct PaymentItem { | 72 struct PaymentItem { |
| 73 string label; | 73 string label; |
| 74 CurrencyAmount amount; | 74 PaymentCurrencyAmount amount; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 struct ShippingOption { | 77 struct PaymentShippingOption { |
| 78 string id; | 78 string id; |
| 79 string label; | 79 string label; |
| 80 CurrencyAmount amount; | 80 PaymentCurrencyAmount amount; |
| 81 bool selected; | 81 bool selected; |
| 82 }; | 82 }; |
| 83 | 83 |
| 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<PaymentShippingOption> 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 { | 94 struct PaymentMethodData { |
| 95 array<string> supported_methods; | 95 array<string> supported_methods; |
| 96 // A JSON string built by the renderer from a JavaScript object that the | 96 // A JSON string built by the renderer from a JavaScript object that the |
| 97 // merchant website provides. The renderer uses | 97 // merchant website provides. The renderer uses |
| 98 // blink::JSONObject::toJSONString() to generate this string. The browser | 98 // blink::JSONObject::toJSONString() to generate this string. The browser |
| 99 // parses the string via JSONObject(JsonSanitizer.sanitize(stringified_data)) | 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 | 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 | 101 // Android Pay. There's no one format for this object, so richer types cannot |
| 102 // be used. A simple example: | 102 // be used. A simple example: |
| 103 // | 103 // |
| 104 // {"gateway": "stripe"} | 104 // {"gateway": "stripe"} |
| 105 string stringified_data; | 105 string stringified_data; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 interface PaymentRequest { | 108 interface PaymentRequest { |
| 109 SetClient(PaymentRequestClient client); | 109 SetClient(PaymentRequestClient client); |
| 110 Show(array<PaymentMethodData> methodData, | 110 Show(array<PaymentMethodData> methodData, |
| 111 PaymentDetails details, | 111 PaymentDetails details, |
| 112 PaymentOptions options); | 112 PaymentOptions options); |
| 113 UpdateWith(PaymentDetails details); | 113 UpdateWith(PaymentDetails details); |
| 114 Abort(); | 114 Abort(); |
| 115 Complete(bool success); | 115 Complete(bool success); |
| 116 }; | 116 }; |
| OLD | NEW |