| 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 module payments.mojom; | 5 module payments.mojom; |
| 6 | 6 |
| 7 import "components/payments/mojom/payment_request.mojom"; | 7 import "components/payments/mojom/payment_request.mojom"; |
| 8 import "mojo/common/time.mojom"; | 8 import "mojo/common/time.mojom"; |
| 9 import "url/mojo/url.mojom"; | 9 import "url/mojo/url.mojom"; |
| 10 | 10 |
| 11 enum PaymentHandlerStatus { | 11 enum PaymentHandlerStatus { |
| 12 SUCCESS, | 12 SUCCESS, |
| 13 NOT_IMPLEMENTED, | 13 NOT_IMPLEMENTED, |
| 14 NOT_FOUND, | 14 NOT_FOUND, |
| 15 NO_ACTIVE_WORKER, | 15 NO_ACTIVE_WORKER, |
| 16 STORAGE_OPERATION_FAILED, | 16 STORAGE_OPERATION_FAILED, |
| 17 FETCH_INSTRUMENT_ICON_FAILED, |
| 17 }; | 18 }; |
| 18 | 19 |
| 20 // This struct is provided to hold an image object from render side |
| 21 // (ImageObject.idl). |
| 22 struct ImageObject { |
| 23 url.mojom.Url src; |
| 24 }; |
| 25 |
| 26 // This struct is provided to hold a payment instrument from render |
| 27 // side (PaymentInstrument.idl). |
| 19 struct PaymentInstrument { | 28 struct PaymentInstrument { |
| 20 string name; | 29 string name; |
| 30 array<ImageObject> icons; |
| 21 array<string> enabled_methods; | 31 array<string> enabled_methods; |
| 22 string stringified_capabilities; | 32 string stringified_capabilities; |
| 23 }; | 33 }; |
| 24 | 34 |
| 35 // This interface provides implementation of PaymentInstruments.idl |
| 36 // in render side. |
| 25 interface PaymentManager { | 37 interface PaymentManager { |
| 26 Init(string service_worker_scope); | 38 Init(string service_worker_scope); |
| 27 DeletePaymentInstrument(string instrument_key) | 39 DeletePaymentInstrument(string instrument_key) |
| 28 => (PaymentHandlerStatus status); | 40 => (PaymentHandlerStatus status); |
| 29 GetPaymentInstrument(string instrument_key) | 41 GetPaymentInstrument(string instrument_key) |
| 30 => (PaymentInstrument instrument, PaymentHandlerStatus status); | 42 => (PaymentInstrument instrument, PaymentHandlerStatus status); |
| 31 KeysOfPaymentInstruments() | 43 KeysOfPaymentInstruments() |
| 32 => (array<string> keys, PaymentHandlerStatus status); | 44 => (array<string> keys, PaymentHandlerStatus status); |
| 33 HasPaymentInstrument(string instrument_key) | 45 HasPaymentInstrument(string instrument_key) |
| 34 => (PaymentHandlerStatus status); | 46 => (PaymentHandlerStatus status); |
| 35 SetPaymentInstrument(string instrument_key, PaymentInstrument instrument) | 47 SetPaymentInstrument(string instrument_key, PaymentInstrument instrument) |
| 36 => (PaymentHandlerStatus status); | 48 => (PaymentHandlerStatus status); |
| 37 ClearPaymentInstruments() | 49 ClearPaymentInstruments() |
| 38 => (PaymentHandlerStatus status); | 50 => (PaymentHandlerStatus status); |
| 39 }; | 51 }; |
| 40 | 52 |
| 53 // This struct is provided to send payment request data to render side |
| 54 // (PaymentRequestEvent.idl). |
| 41 struct PaymentRequestEventData { | 55 struct PaymentRequestEventData { |
| 42 url.mojom.Url top_level_origin; | 56 url.mojom.Url top_level_origin; |
| 43 url.mojom.Url payment_request_origin; | 57 url.mojom.Url payment_request_origin; |
| 44 string payment_request_id; | 58 string payment_request_id; |
| 45 array<PaymentMethodData> method_data; | 59 array<PaymentMethodData> method_data; |
| 46 PaymentItem total; | 60 PaymentItem total; |
| 47 array<PaymentDetailsModifier> modifiers; | 61 array<PaymentDetailsModifier> modifiers; |
| 48 string instrument_key; | 62 string instrument_key; |
| 49 }; | 63 }; |
| 50 | 64 |
| 65 // This struct is provided to receive payment app response from render |
| 66 // side (PaymentAppResponse.idl). |
| 51 struct PaymentAppResponse { | 67 struct PaymentAppResponse { |
| 52 string method_name; | 68 string method_name; |
| 53 string stringified_details; | 69 string stringified_details; |
| 54 }; | 70 }; |
| 55 | 71 |
| 56 // This interface is provided to pass a payment app response from payment | 72 // This interface is provided to pass a payment app response from payment |
| 57 // request event in renderer side to browser side by calling respondWith(). | 73 // request event in renderer side to browser side by calling respondWith(). |
| 58 interface PaymentAppResponseCallback { | 74 interface PaymentAppResponseCallback { |
| 59 OnPaymentAppResponse(PaymentAppResponse response, | 75 OnPaymentAppResponse(PaymentAppResponse response, |
| 60 mojo.common.mojom.Time dispatch_event_time); | 76 mojo.common.mojom.Time dispatch_event_time); |
| 61 }; | 77 }; |
| OLD | NEW |