| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 string organization; | 29 string organization; |
| 30 string recipient; | 30 string recipient; |
| 31 string careOf; | 31 string careOf; |
| 32 string phone; | 32 string phone; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // The currency amount that the renderer provides to the browser process. The | 35 // The currency amount that the renderer provides to the browser process. The |
| 36 // browser shows the amount in UI and forwards it on to the payment app, if it | 36 // browser shows the amount in UI and forwards it on to the payment app, if it |
| 37 // requires the amount. | 37 // requires the amount. |
| 38 struct CurrencyAmount { | 38 struct PaymentCurrencyAmount { |
| 39 // ISO 4217 currency code. Three upper case ASCII letters. | 39 // ISO 4217 currency code. Three upper case ASCII letters. |
| 40 string currency; | 40 string currency; |
| 41 | 41 |
| 42 // ISO 20022 CurrencyAnd30Amount. Up to 30 total digits. Up to 10 fraction | 42 // ISO 20022 CurrencyAnd30Amount. Up to 30 total digits. Up to 10 fraction |
| 43 // digits. Separated by a dot. | 43 // digits. Separated by a dot. |
| 44 string value; | 44 string value; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 struct PaymentResponse { | 47 struct PaymentResponse { |
| 48 string method_name; | 48 string method_name; |
| 49 CurrencyAmount total_amount; | 49 PaymentCurrencyAmount total_amount; |
| 50 | 50 |
| 51 // Payment method specific JSON string that is built either by the browser or | 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 | 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 | 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. | 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 | 55 // There's no one format for this object, so richer types cannot be used. A |
| 56 // simple example: | 56 // simple example: |
| 57 // | 57 // |
| 58 // {"nameOnCard": "Jon Doe", "pan": "4111 1111 1111 1111"} | 58 // {"nameOnCard": "Jon Doe", "pan": "4111 1111 1111 1111"} |
| 59 string stringified_details; | 59 string stringified_details; |
| 60 | 60 |
| 61 PaymentAddress? shipping_address; | 61 PaymentAddress? shipping_address; |
| 62 string? shipping_option_id; | 62 string? shipping_option_id; |
| 63 string? payer_email; | 63 string? payer_email; |
| 64 string? payer_phone; | 64 string? payer_phone; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 interface PaymentRequestClient { | 67 interface PaymentRequestClient { |
| 68 OnShippingAddressChange(PaymentAddress address); | 68 OnShippingAddressChange(PaymentAddress address); |
| 69 OnShippingOptionChange(string shipping_option_id); | 69 OnShippingOptionChange(string shipping_option_id); |
| 70 OnPaymentResponse(PaymentResponse response); | 70 OnPaymentResponse(PaymentResponse response); |
| 71 OnError(); | 71 OnError(); |
| 72 OnComplete(); | 72 OnComplete(); |
| 73 OnAbort(bool aborted_successfully); | 73 OnAbort(bool aborted_successfully); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 struct PaymentItem { | 76 struct PaymentItem { |
| 77 string label; | 77 string label; |
| 78 CurrencyAmount amount; | 78 PaymentCurrencyAmount amount; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 struct ShippingOption { | 81 struct PaymentShippingOption { |
| 82 string id; | 82 string id; |
| 83 string label; | 83 string label; |
| 84 CurrencyAmount amount; | 84 PaymentCurrencyAmount amount; |
| 85 bool selected; | 85 bool selected; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 struct PaymentDetails { | 88 struct PaymentDetails { |
| 89 PaymentItem total; | 89 PaymentItem total; |
| 90 array<PaymentItem> display_items; | 90 array<PaymentItem> display_items; |
| 91 array<ShippingOption> shipping_options; | 91 array<PaymentShippingOption> shipping_options; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 struct PaymentOptions { | 94 struct PaymentOptions { |
| 95 bool request_shipping; | 95 bool request_shipping; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 struct PaymentMethodData { | 98 struct PaymentMethodData { |
| 99 array<string> supported_methods; | 99 array<string> supported_methods; |
| 100 // A JSON string built by the renderer from a JavaScript object that the | 100 // A JSON string built by the renderer from a JavaScript object that the |
| 101 // merchant website provides. The renderer uses | 101 // merchant website provides. The renderer uses |
| (...skipping 15 matching lines...) Expand all Loading... |
| 117 | 117 |
| 118 interface PaymentRequest { | 118 interface PaymentRequest { |
| 119 SetClient(PaymentRequestClient client); | 119 SetClient(PaymentRequestClient client); |
| 120 Show(array<PaymentMethodData> methodData, | 120 Show(array<PaymentMethodData> methodData, |
| 121 PaymentDetails details, | 121 PaymentDetails details, |
| 122 PaymentOptions options); | 122 PaymentOptions options); |
| 123 UpdateWith(PaymentDetails details); | 123 UpdateWith(PaymentDetails details); |
| 124 Abort(); | 124 Abort(); |
| 125 Complete(PaymentComplete result); | 125 Complete(PaymentComplete result); |
| 126 }; | 126 }; |
| OLD | NEW |