Source code

Revision control

Other Tools

1
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
2
/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
include protocol PBrowser;
8
using refcounted class nsIPrincipal from "mozilla/dom/PermissionMessageUtils.h";
9
10
namespace mozilla {
11
namespace dom {
12
13
struct IPCPaymentMethodData
14
{
15
nsString supportedMethods;
16
nsString data;
17
};
18
19
struct IPCPaymentCurrencyAmount
20
{
21
nsString currency;
22
nsString value;
23
};
24
25
struct IPCPaymentItem
26
{
27
nsString label;
28
IPCPaymentCurrencyAmount amount;
29
bool pending;
30
};
31
32
struct IPCPaymentDetailsModifier
33
{
34
nsString supportedMethods;
35
IPCPaymentItem total;
36
IPCPaymentItem[] additionalDisplayItems;
37
nsString data;
38
bool additionalDisplayItemsPassed;
39
};
40
41
struct IPCPaymentShippingOption
42
{
43
nsString id;
44
nsString label;
45
IPCPaymentCurrencyAmount amount;
46
bool selected;
47
};
48
49
struct IPCPaymentDetails
50
{
51
nsString id;
52
IPCPaymentItem total;
53
IPCPaymentItem[] displayItems;
54
IPCPaymentShippingOption[] shippingOptions;
55
IPCPaymentDetailsModifier[] modifiers;
56
nsString error;
57
nsString shippingAddressErrors;
58
nsString payerErrors;
59
nsString paymentMethodErrors;
60
};
61
62
struct IPCPaymentOptions
63
{
64
bool requestPayerName;
65
bool requestPayerEmail;
66
bool requestPayerPhone;
67
bool requestShipping;
68
bool requestBillingAddress;
69
nsString shippingType;
70
};
71
72
struct IPCPaymentCreateActionRequest
73
{
74
uint64_t topOuterWindowId;
75
nsString requestId;
76
nsIPrincipal topLevelPrincipal;
77
IPCPaymentMethodData[] methodData;
78
IPCPaymentDetails details;
79
IPCPaymentOptions options;
80
nsString shippingOption;
81
};
82
83
struct IPCPaymentCanMakeActionRequest
84
{
85
nsString requestId;
86
};
87
88
struct IPCPaymentShowActionRequest
89
{
90
nsString requestId;
91
bool isUpdating;
92
};
93
94
struct IPCPaymentAbortActionRequest
95
{
96
nsString requestId;
97
};
98
99
struct IPCPaymentCompleteActionRequest
100
{
101
nsString requestId;
102
nsString completeStatus;
103
};
104
105
struct IPCPaymentUpdateActionRequest
106
{
107
nsString requestId;
108
IPCPaymentDetails details;
109
nsString shippingOption;
110
};
111
112
struct IPCPaymentCloseActionRequest
113
{
114
nsString requestId;
115
};
116
117
struct IPCPaymentRetryActionRequest
118
{
119
nsString requestId;
120
nsString error;
121
nsString payerErrors;
122
nsString paymentMethodErrors;
123
nsString shippingAddressErrors;
124
};
125
126
union IPCPaymentActionRequest
127
{
128
IPCPaymentCreateActionRequest;
129
IPCPaymentCanMakeActionRequest;
130
IPCPaymentShowActionRequest;
131
IPCPaymentAbortActionRequest;
132
IPCPaymentCompleteActionRequest;
133
IPCPaymentUpdateActionRequest;
134
IPCPaymentCloseActionRequest;
135
IPCPaymentRetryActionRequest;
136
};
137
138
struct IPCPaymentCanMakeActionResponse
139
{
140
nsString requestId;
141
bool result;
142
};
143
144
struct IPCPaymentAddress
145
{
146
nsString country;
147
nsString[] addressLine;
148
nsString region;
149
nsString regionCode;
150
nsString city;
151
nsString dependentLocality;
152
nsString postalCode;
153
nsString sortingCode;
154
nsString organization;
155
nsString recipient;
156
nsString phone;
157
};
158
159
struct IPCGeneralResponse
160
{
161
nsString data;
162
};
163
164
struct IPCBasicCardResponse
165
{
166
nsString cardholderName;
167
nsString cardNumber;
168
nsString expiryMonth;
169
nsString expiryYear;
170
nsString cardSecurityCode;
171
IPCPaymentAddress billingAddress;
172
};
173
174
union IPCPaymentResponseData
175
{
176
IPCGeneralResponse;
177
IPCBasicCardResponse;
178
};
179
180
struct IPCPaymentShowActionResponse
181
{
182
nsString requestId;
183
uint32_t status;
184
nsString methodName;
185
IPCPaymentResponseData data;
186
nsString payerName;
187
nsString payerEmail;
188
nsString payerPhone;
189
};
190
191
struct IPCPaymentAbortActionResponse
192
{
193
nsString requestId;
194
bool isSucceeded;
195
};
196
197
struct IPCPaymentCompleteActionResponse
198
{
199
nsString requestId;
200
bool isCompleted;
201
};
202
203
union IPCPaymentActionResponse
204
{
205
IPCPaymentCanMakeActionResponse;
206
IPCPaymentShowActionResponse;
207
IPCPaymentAbortActionResponse;
208
IPCPaymentCompleteActionResponse;
209
};
210
211
struct IPCGeneralChangeDetails
212
{
213
nsString details;
214
};
215
216
struct IPCBasicCardChangeDetails
217
{
218
IPCPaymentAddress billingAddress;
219
};
220
221
union IPCMethodChangeDetails
222
{
223
IPCGeneralChangeDetails;
224
IPCBasicCardChangeDetails;
225
};
226
227
sync protocol PPaymentRequest
228
{
229
manager PBrowser;
230
231
parent:
232
async __delete__();
233
234
async RequestPayment(IPCPaymentActionRequest aAction);
235
236
child:
237
async RespondPayment(IPCPaymentActionResponse aResponse);
238
async ChangeShippingAddress(nsString aRequestId,
239
IPCPaymentAddress aAddress);
240
async ChangeShippingOption(nsString aRequestId,
241
nsString aOption);
242
async ChangePayerDetail(nsString aRequestId,
243
nsString aPayerName,
244
nsString aPayerEmail,
245
nsString aPayerPhone);
246
async ChangePaymentMethod(nsString aRequestId,
247
nsString aMethodName,
248
IPCMethodChangeDetails aMethodDetails);
249
};
250
251
} // end of namespace dom
252
} // end of namespace mozilla