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 (ImageObject .idl). | |
dcheng
2017/06/13 09:02:55
Nit: 80 chars
gogerald1
2017/06/13 15:37:19
Done.
| |
21 struct ImageObject { | |
22 url.mojom.Url src; | |
23 }; | |
24 | |
25 // This struct is provided to hold a payment instrument from render side (Paymen tInstrument.idl). | |
dcheng
2017/06/13 09:02:55
To elaborate: my questions are more of "what is a
gogerald1
2017/06/13 15:37:19
These structures and interfaces are almost exactly
dcheng
2017/06/13 17:33:15
- Web specs are not the easiest thing to understan
zino
2017/06/13 18:02:43
There are two specs PaymentRequest API and Payment
gogerald1
2017/06/14 01:28:16
Acknowledged.
| |
19 struct PaymentInstrument { | 26 struct PaymentInstrument { |
20 string name; | 27 string name; |
28 array<ImageObject> icons; | |
21 array<string> enabled_methods; | 29 array<string> enabled_methods; |
22 string stringified_capabilities; | 30 string stringified_capabilities; |
23 }; | 31 }; |
24 | 32 |
33 // This interface provides implementation of PaymentInstruments.idl in render si de. | |
25 interface PaymentManager { | 34 interface PaymentManager { |
26 Init(string service_worker_scope); | 35 Init(string service_worker_scope); |
27 DeletePaymentInstrument(string instrument_key) | 36 DeletePaymentInstrument(string instrument_key) |
28 => (PaymentHandlerStatus status); | 37 => (PaymentHandlerStatus status); |
29 GetPaymentInstrument(string instrument_key) | 38 GetPaymentInstrument(string instrument_key) |
30 => (PaymentInstrument instrument, PaymentHandlerStatus status); | 39 => (PaymentInstrument instrument, PaymentHandlerStatus status); |
31 KeysOfPaymentInstruments() | 40 KeysOfPaymentInstruments() |
32 => (array<string> keys, PaymentHandlerStatus status); | 41 => (array<string> keys, PaymentHandlerStatus status); |
33 HasPaymentInstrument(string instrument_key) | 42 HasPaymentInstrument(string instrument_key) |
34 => (PaymentHandlerStatus status); | 43 => (PaymentHandlerStatus status); |
35 SetPaymentInstrument(string instrument_key, PaymentInstrument instrument) | 44 SetPaymentInstrument(string instrument_key, PaymentInstrument instrument) |
36 => (PaymentHandlerStatus status); | 45 => (PaymentHandlerStatus status); |
37 ClearPaymentInstruments() | 46 ClearPaymentInstruments() |
38 => (PaymentHandlerStatus status); | 47 => (PaymentHandlerStatus status); |
39 }; | 48 }; |
40 | 49 |
50 // This struct is provided to send payment request data to render side (PaymentR equestEvent.idl). | |
41 struct PaymentRequestEventData { | 51 struct PaymentRequestEventData { |
42 url.mojom.Url top_level_origin; | 52 url.mojom.Url top_level_origin; |
dcheng
2017/06/13 09:02:55
Similarly, what are the two origins here, why do w
gogerald1
2017/06/13 15:37:19
Please refer the spec here https://w3c.github.io/p
| |
43 url.mojom.Url payment_request_origin; | 53 url.mojom.Url payment_request_origin; |
44 string payment_request_id; | 54 string payment_request_id; |
dcheng
2017/06/13 09:02:55
Is there any structure to the payment request IDs?
gogerald1
2017/06/13 15:37:19
Please refer the spec here https://w3c.github.io/p
| |
45 array<PaymentMethodData> method_data; | 55 array<PaymentMethodData> method_data; |
46 PaymentItem total; | 56 PaymentItem total; |
47 array<PaymentDetailsModifier> modifiers; | 57 array<PaymentDetailsModifier> modifiers; |
48 string instrument_key; | 58 string instrument_key; |
49 }; | 59 }; |
50 | 60 |
61 // This struct is provided to receive payment app response from render side (Pay mentAppResponse.idl). | |
51 struct PaymentAppResponse { | 62 struct PaymentAppResponse { |
52 string method_name; | 63 string method_name; |
53 string stringified_details; | 64 string stringified_details; |
54 }; | 65 }; |
55 | 66 |
56 // This interface is provided to pass a payment app response from payment | 67 // This interface is provided to pass a payment app response from payment |
57 // request event in renderer side to browser side by calling respondWith(). | 68 // request event in renderer side to browser side by calling respondWith(). |
58 interface PaymentAppResponseCallback { | 69 interface PaymentAppResponseCallback { |
59 OnPaymentAppResponse(PaymentAppResponse response, | 70 OnPaymentAppResponse(PaymentAppResponse response, |
60 mojo.common.mojom.Time dispatch_event_time); | 71 mojo.common.mojom.Time dispatch_event_time); |
61 }; | 72 }; |
OLD | NEW |