| 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 14 matching lines...) Expand all Loading... |
| 25 // Optional ISO 15924 script code. Four ASCII letters. The first letter is | 25 // Optional ISO 15924 script code. Four ASCII letters. The first letter is |
| 26 // upper case; the rest are lower case. | 26 // upper case; the rest are lower case. |
| 27 string script_code; | 27 string script_code; |
| 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 |
| 36 // browser shows the amount in UI and forwards it on to the payment app, if it |
| 37 // requires the amount. |
| 38 struct CurrencyAmount { |
| 39 // ISO 4217 currency code. Three upper case ASCII letters. |
| 40 string currency; |
| 41 |
| 42 // ISO 20022 CurrencyAnd30Amount. Up to 30 total digits. Up to 10 fraction |
| 43 // digits. Separated by a dot. |
| 44 string value; |
| 45 }; |
| 46 |
| 35 struct PaymentResponse { | 47 struct PaymentResponse { |
| 36 string method_name; | 48 string method_name; |
| 49 CurrencyAmount total_amount; |
| 37 | 50 |
| 38 // 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 |
| 39 // 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 |
| 40 // be successfully parsed into base::JSONParser. Renderer parses this string | 53 // be successfully parsed into base::JSONParser. Renderer parses this string |
| 41 // 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. |
| 42 // 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 |
| 43 // simple example: | 56 // simple example: |
| 44 // | 57 // |
| 45 // {"nameOnCard": "Jon Doe", "pan": "4111 1111 1111 1111"} | 58 // {"nameOnCard": "Jon Doe", "pan": "4111 1111 1111 1111"} |
| 46 string stringified_details; | 59 string stringified_details; |
| 47 | 60 |
| 48 PaymentAddress? shipping_address; | 61 PaymentAddress? shipping_address; |
| 49 string? shipping_option_id; | 62 string? shipping_option_id; |
| 50 }; | 63 }; |
| 51 | 64 |
| 52 interface PaymentRequestClient { | 65 interface PaymentRequestClient { |
| 53 OnShippingAddressChange(PaymentAddress address); | 66 OnShippingAddressChange(PaymentAddress address); |
| 54 OnShippingOptionChange(string shipping_option_id); | 67 OnShippingOptionChange(string shipping_option_id); |
| 55 OnPaymentResponse(PaymentResponse response); | 68 OnPaymentResponse(PaymentResponse response); |
| 56 OnError(); | 69 OnError(); |
| 57 OnComplete(); | 70 OnComplete(); |
| 58 }; | 71 }; |
| 59 | 72 |
| 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 | |
| 62 // requires the amount. | |
| 63 struct CurrencyAmount { | |
| 64 // ISO 4217 currency code. Three upper case ASCII letters. | |
| 65 string currency; | |
| 66 | |
| 67 // ISO 20022 CurrencyAnd30Amount. Up to 30 total digits. Up to 10 fraction | |
| 68 // digits. Separated by a dot. | |
| 69 string value; | |
| 70 }; | |
| 71 | |
| 72 struct PaymentItem { | 73 struct PaymentItem { |
| 73 string label; | 74 string label; |
| 74 CurrencyAmount amount; | 75 CurrencyAmount amount; |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 struct ShippingOption { | 78 struct ShippingOption { |
| 78 string id; | 79 string id; |
| 79 string label; | 80 string label; |
| 80 CurrencyAmount amount; | 81 CurrencyAmount amount; |
| 81 bool selected; | 82 bool selected; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 107 | 108 |
| 108 interface PaymentRequest { | 109 interface PaymentRequest { |
| 109 SetClient(PaymentRequestClient client); | 110 SetClient(PaymentRequestClient client); |
| 110 Show(array<PaymentMethodData> methodData, | 111 Show(array<PaymentMethodData> methodData, |
| 111 PaymentDetails details, | 112 PaymentDetails details, |
| 112 PaymentOptions options); | 113 PaymentOptions options); |
| 113 UpdateWith(PaymentDetails details); | 114 UpdateWith(PaymentDetails details); |
| 114 Abort(); | 115 Abort(); |
| 115 Complete(bool success); | 116 Complete(bool success); |
| 116 }; | 117 }; |
| OLD | NEW |