-
Notifications
You must be signed in to change notification settings - Fork 32
/
types.ts
220 lines (181 loc) · 4.58 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
import { ResultCode } from './constants';
/**
* General type for card.
*/
export class Card {
/** PAN of card. */
number?: string;
/** Month in format MM. */
expiryMonth?: string;
/** Year in format YYYY. */
expiryYear?: string;
/** 3 or 4 digits. */
cvv?: string;
}
/**
* {@link https://docs.adyen.com/api-explorer/Checkout/70/post/payments#responses-200-action API Explorer /payments action}
*/
export interface PaymentAction {
/**
* General type of action that needs to be taken by the client
*/
type: string;
/**
* Refinement of type of action that needs to be taken by the client (currently only applies to the new 'threeDS2' type)
*/
subtype?: string;
/**
* Specifies the payment method.
*/
paymentMethodType: string;
/**
* When non-empty, contains a value that you must submit to the /payments/details endpoint. In some cases, required for polling.
*/
paymentData?: string; // comes from the /payments endpoint
// Redirect Actions
/**
* Specifies the HTTP method, for example GET or POST.
*/
method?: string;
/**
* Specifies the URL to redirect to.
*/
url?: string;
// Vouchers
alternativeReference?: string;
downloadUrl?: string;
entity?: string;
expiresAt?: string;
instructionsUrl?: string;
issuer?: string;
maskedTelephoneNumber?: string;
merchantName?: string;
merchantReference?: string;
reference?: string;
shopperEmail?: string;
shopperName?: string;
// QR Code
qrCodeData?: string;
// 3DS2
/**
* A token to pass to the 3DS2 Component to get the fingerprint/challenge.
*/
token?: string;
/**
* A token needed to authorise a payment. Comes from the /submitThreeDS2Fingerprint endpoint
*/
authorisationToken?: string;
// SDK
/**
* An object containing data to be used in external SDKs like PayPal Buttons SDK.
*/
sdkData?: {
[key: string]: any;
};
}
export interface PaymentMethod {
/**
* The unique payment method code.
*/
type: string;
/**
* The displayable name of this payment method.
*/
name: string;
/**
* All input details to be provided to complete the payment with this payment method.
*/
details?: object;
/**
* Configuration props as set by the merchant in the CA and received in the PM object in the /paymentMethods response
*/
configuration?: object;
/**
* Brand for the selected gift card. For example: plastix, hmclub.
*/
brand?: string;
/**
* List of possible brands. For example: visa, mc.
*/
brands?: string[];
/**
* The funding source of the payment method.
*/
fundingSource?: string;
/**
* The group where this payment method belongs to.
*/
group?: PaymentMethodGroup;
}
/**
* The group where this payment method belongs to.
*/
export interface PaymentMethodGroup {
/**
* The name of the group.
*/
name: string;
/**
* Echo data to be used if the payment method is displayed as part of this group.
*/
paymentMethodData: string;
/**
* The unique code of the group.
*/
type: string;
}
export interface StoredPaymentMethod extends PaymentMethod {
/**
* The supported shopper interactions for this stored payment method.
*/
supportedShopperInteractions: string[];
/**
* A unique identifier of this stored payment method.
*/
id: string;
}
/**
* List of the available payment methods
* {@link https://docs.adyen.com/api-explorer/Checkout/70/post/paymentMethods#responses-200 API Explorer /paymentMethods}.
*/
export interface PaymentMethodsResponse {
/**
* Detailed list of payment methods required to generate payment forms.
*/
paymentMethods: PaymentMethod[];
/**
* List of all stored payment methods.
*/
storedPaymentMethods?: StoredPaymentMethod[];
}
/**
* {@link https://docs.adyen.com/api-explorer/Checkout/70/post/payments#responses-200 API Explorer /payments response}
*/
export interface PaymentResponse {
action?: PaymentAction;
resultCode: ResultCode;
}
/**
* {@link https://docs.adyen.com/api-explorer/Checkout/70/post/payments#request-amount API Explorer /payments amount}
*/
export interface PaymentAmount {
value: number;
currency: string;
}
/**
* {@link https://docs.adyen.com/api-explorer/Checkout/70/post/payments#request-amount API Explorer /payments amount}
*/
export interface PaymentMethodData {
paymentMethod: {
type: string;
[key: string]: any;
checkoutAttemptId?: string;
};
browserInfo?: {
userAgent: string;
};
/**
* Contains passed-throught value for iOS or `adyencheckout://${DeviceInfo.getBundleId()}` for Android
*/
returnUrl: string;
}