@payrails/web-sdk 5.29.0 → 5.29.1-rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -5
- package/package.json +1 -1
- package/payrails-styles.css +63 -12
- package/payrails.d.ts +759 -635
- package/payrails.js +4 -5
package/payrails.d.ts
CHANGED
|
@@ -1,144 +1,381 @@
|
|
|
1
|
-
import { LogLevel as LogLevel$1 } from '@payrails/logger';
|
|
2
1
|
import * as _payrails_iframe_event_bus from '@payrails/iframe-event-bus';
|
|
2
|
+
import { LogLevel as LogLevel$1 } from '@payrails/logger';
|
|
3
3
|
import { FraudProvider } from '@payrails/fraud-sdk';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
type JSONSchemaType = JSONSchemaProperty & {
|
|
6
|
+
required?: string[];
|
|
7
|
+
dependentSchemas?: Record<string, JSONSchemaDependentSchema>;
|
|
8
|
+
};
|
|
9
|
+
interface JSONSchemaDependentSchema {
|
|
10
|
+
oneOf: Array<{
|
|
11
|
+
properties: Record<string, {
|
|
12
|
+
const: string | number;
|
|
13
|
+
}>;
|
|
14
|
+
required: string[];
|
|
15
|
+
}>;
|
|
8
16
|
}
|
|
9
|
-
interface
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
interface JSONSchemaProperty {
|
|
18
|
+
type?: 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
19
|
+
title?: string;
|
|
20
|
+
oneOf?: JSONSchemaOneOfOption[];
|
|
21
|
+
pattern?: string;
|
|
22
|
+
minLength?: number;
|
|
23
|
+
maxLength?: number;
|
|
24
|
+
errorMessage?: Record<string, string>;
|
|
25
|
+
$ref?: string;
|
|
26
|
+
properties?: Record<string, JSONSchemaType>;
|
|
14
27
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
readonly id: string | undefined;
|
|
19
|
-
readonly dataTestId: string | undefined;
|
|
20
|
-
protected eventBus: _payrails_iframe_event_bus.IframeEventBus;
|
|
21
|
-
constructor(elementType: string, { id, className, dataTestId }?: ElementOptions);
|
|
22
|
-
get parentElement(): HTMLElement | null;
|
|
23
|
-
get selector(): string;
|
|
24
|
-
mount(location: string): void;
|
|
25
|
-
protected clean(): void;
|
|
26
|
-
unmount(): void;
|
|
28
|
+
interface JSONSchemaOneOfOption {
|
|
29
|
+
const: string | number;
|
|
30
|
+
title: string;
|
|
27
31
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
interface JSONSchemaOneOfOption {
|
|
33
|
+
const: string | number;
|
|
34
|
+
title: string;
|
|
35
|
+
}
|
|
36
|
+
interface DynamicElementFieldTranslation {
|
|
37
|
+
label?: string;
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
errors?: Partial<DynamicElementErrorTranslation>;
|
|
40
|
+
}
|
|
41
|
+
interface DynamicElementErrorTranslation {
|
|
42
|
+
required: string;
|
|
43
|
+
minLength: string;
|
|
44
|
+
maxLength: string;
|
|
45
|
+
pattern: string;
|
|
46
|
+
oneOf: string;
|
|
47
|
+
}
|
|
48
|
+
type DynamicElementTranslations = {
|
|
49
|
+
labels?: {
|
|
50
|
+
submitButton?: string;
|
|
34
51
|
};
|
|
35
|
-
|
|
52
|
+
fields?: Record<string, DynamicElementFieldTranslation>;
|
|
53
|
+
errors?: Partial<DynamicElementErrorTranslation>;
|
|
54
|
+
};
|
|
55
|
+
interface DynamicElementElementStyles {
|
|
56
|
+
base?: Partial<CSSStyleDeclaration>;
|
|
57
|
+
complete?: Partial<CSSStyleDeclaration>;
|
|
58
|
+
empty?: Partial<CSSStyleDeclaration>;
|
|
59
|
+
focus?: Partial<CSSStyleDeclaration>;
|
|
60
|
+
invalid?: Partial<CSSStyleDeclaration>;
|
|
36
61
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
62
|
+
type DynamicElementInputFieldStyles = DynamicElementElementStyles;
|
|
63
|
+
type DynamicElementSelectFieldStyles = DynamicElementElementStyles;
|
|
64
|
+
interface DynamicElementTabsFieldStyles {
|
|
65
|
+
tab: {
|
|
66
|
+
base?: Partial<CSSStyleDeclaration>;
|
|
67
|
+
active?: Partial<CSSStyleDeclaration>;
|
|
68
|
+
};
|
|
69
|
+
container?: DynamicElementElementStyles;
|
|
40
70
|
}
|
|
41
|
-
interface
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
71
|
+
interface DynamicElementFieldStyles {
|
|
72
|
+
base?: Partial<CSSStyleDeclaration>;
|
|
73
|
+
label?: Partial<CSSStyleDeclaration>;
|
|
74
|
+
errors?: Partial<CSSStyleDeclaration>;
|
|
75
|
+
input?: DynamicElementInputFieldStyles;
|
|
76
|
+
select?: DynamicElementSelectFieldStyles;
|
|
77
|
+
tabs?: DynamicElementTabsFieldStyles;
|
|
78
|
+
}
|
|
79
|
+
interface DynamicElementStyles {
|
|
80
|
+
all: Omit<DynamicElementFieldStyles, 'label'>;
|
|
81
|
+
fields?: Record<string, DynamicElementFieldStyles>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare enum PAYMENT_METHOD_CODES {
|
|
85
|
+
'CARD' = "card",
|
|
86
|
+
'GOOGLE_PAY' = "googlePay",
|
|
87
|
+
'PAYPAL' = "payPal",
|
|
88
|
+
'APPLE_PAY' = "applePay",
|
|
89
|
+
'GENERIC_REDIRECT' = "genericRedirect",
|
|
90
|
+
'MERCADO_PAGO' = "mercadoPago",
|
|
91
|
+
'PIX' = "pix",
|
|
92
|
+
'BANK_ACCOUNT' = "bankAccount"
|
|
93
|
+
}
|
|
94
|
+
declare enum PAYMENT_INSTRUMENT_STATUS {
|
|
95
|
+
'ENABLED' = "enabled",
|
|
96
|
+
'CREATED' = "created",
|
|
97
|
+
'DELETED' = "deleted",
|
|
98
|
+
'DISABLED' = "disabled",
|
|
99
|
+
'INVALID' = "invalid",
|
|
100
|
+
'TRANSIENT' = "transient"
|
|
101
|
+
}
|
|
102
|
+
declare class WorkflowExecution {
|
|
103
|
+
private static _response;
|
|
104
|
+
static get response(): WorkflowExecutionResponse;
|
|
105
|
+
static setResponse(response: WorkflowExecutionResponse): typeof WorkflowExecution;
|
|
106
|
+
static get lookup(): {
|
|
107
|
+
httpCode: number;
|
|
108
|
+
body: {
|
|
109
|
+
data: {
|
|
110
|
+
paymentCompositionOptions: Array<StorablePaymentCompositionOption>;
|
|
111
|
+
};
|
|
112
|
+
links: {
|
|
113
|
+
authorize: {
|
|
114
|
+
href: string;
|
|
115
|
+
method: "POST";
|
|
116
|
+
};
|
|
117
|
+
execution: string;
|
|
118
|
+
};
|
|
119
|
+
name: "lookup";
|
|
50
120
|
};
|
|
121
|
+
} | undefined;
|
|
122
|
+
static get holderReference(): string;
|
|
123
|
+
static get savedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
|
|
124
|
+
static get savedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
|
|
125
|
+
static get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
126
|
+
static get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
127
|
+
static get paypalConfig(): PayPalConfig;
|
|
128
|
+
static get googlePayConfig(): any;
|
|
129
|
+
static isPaymentMethodAvailable(paymentMethod: PAYMENT_METHOD_CODES): boolean;
|
|
130
|
+
static get applePayConfig(): {
|
|
131
|
+
merchantIdentifier: string;
|
|
132
|
+
supportedNetworks: string[];
|
|
133
|
+
countryCode: string;
|
|
134
|
+
merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
|
|
135
|
+
requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
|
|
51
136
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
137
|
+
static get url(): string;
|
|
138
|
+
static get meta(): {
|
|
139
|
+
customer?: {
|
|
140
|
+
country?: {
|
|
141
|
+
code?: string;
|
|
142
|
+
};
|
|
58
143
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
144
|
+
order?: {
|
|
145
|
+
billingAddress?: {
|
|
146
|
+
country?: {
|
|
147
|
+
code?: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
63
150
|
};
|
|
64
151
|
};
|
|
65
|
-
|
|
66
|
-
|
|
152
|
+
static get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
|
|
153
|
+
static get authorizeLink(): string | undefined;
|
|
154
|
+
static get createSessionLink(): string | undefined;
|
|
155
|
+
static get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
156
|
+
static get storedDropinInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
157
|
+
static getFullPaymentMethodConfig(paymentMethod: PAYMENT_METHOD_CODES): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
|
|
158
|
+
static isAddressSelectorEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
|
|
159
|
+
static isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
|
|
160
|
+
static getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
|
|
161
|
+
static getStoredInstrumentForPaymentMethod<T = CardMetadata | PayPalMetadata>(paymentMethod: PAYMENT_METHOD_CODES): Array<StoredPaymentInstrument<T>>;
|
|
162
|
+
static getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
|
|
163
|
+
id: string;
|
|
164
|
+
description?: string;
|
|
165
|
+
status: PAYMENT_INSTRUMENT_STATUS;
|
|
166
|
+
integrationType: INTEGRATION_TYPE;
|
|
167
|
+
config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
|
|
168
|
+
clientConfig?: {
|
|
169
|
+
flow?: PAYMENT_CLIENT_FLOW;
|
|
170
|
+
supportsInstallments?: boolean;
|
|
171
|
+
installments?: PaymentInstallmentsConfig;
|
|
172
|
+
supportsBillingInfo?: boolean;
|
|
173
|
+
schema?: JSONSchemaType;
|
|
174
|
+
additionalConfig?: any;
|
|
175
|
+
};
|
|
176
|
+
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
177
|
+
} | undefined;
|
|
178
|
+
static getPaymentMethodConfig(paymentMethod: StorablePaymentCompositionOption): {
|
|
179
|
+
id: string;
|
|
180
|
+
description?: string;
|
|
181
|
+
status: PAYMENT_INSTRUMENT_STATUS;
|
|
182
|
+
integrationType: INTEGRATION_TYPE;
|
|
183
|
+
config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
|
|
184
|
+
clientConfig?: {
|
|
185
|
+
flow?: PAYMENT_CLIENT_FLOW;
|
|
186
|
+
supportsInstallments?: boolean;
|
|
187
|
+
installments?: PaymentInstallmentsConfig;
|
|
188
|
+
supportsBillingInfo?: boolean;
|
|
189
|
+
schema?: JSONSchemaType;
|
|
190
|
+
additionalConfig?: any;
|
|
191
|
+
};
|
|
192
|
+
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
67
193
|
};
|
|
68
194
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
195
|
+
interface WorkflowExecutionResponse {
|
|
196
|
+
id: string;
|
|
197
|
+
merchantReference: string;
|
|
198
|
+
holderReference: string;
|
|
199
|
+
actionRequired?: string;
|
|
200
|
+
meta: {
|
|
201
|
+
customer?: {
|
|
202
|
+
country?: {
|
|
203
|
+
code?: string;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
order?: {
|
|
207
|
+
billingAddress?: {
|
|
208
|
+
country?: {
|
|
209
|
+
code?: string;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
78
212
|
};
|
|
79
213
|
};
|
|
80
|
-
|
|
81
|
-
|
|
214
|
+
status: Array<{
|
|
215
|
+
code: string;
|
|
216
|
+
time: string;
|
|
217
|
+
}>;
|
|
218
|
+
initialResults: Array<{
|
|
219
|
+
httpCode: number;
|
|
220
|
+
body: {
|
|
221
|
+
data: {
|
|
222
|
+
paymentCompositionOptions: Array<StorablePaymentCompositionOption>;
|
|
223
|
+
};
|
|
224
|
+
links: {
|
|
225
|
+
authorize: {
|
|
226
|
+
href: string;
|
|
227
|
+
method: 'POST';
|
|
228
|
+
};
|
|
229
|
+
execution: string;
|
|
230
|
+
};
|
|
231
|
+
name: 'lookup';
|
|
232
|
+
};
|
|
233
|
+
}>;
|
|
234
|
+
links: {
|
|
235
|
+
startPaymentSession?: {
|
|
236
|
+
href: string;
|
|
237
|
+
method: 'POST';
|
|
238
|
+
};
|
|
239
|
+
confirm?: {
|
|
240
|
+
href: string;
|
|
241
|
+
action?: {
|
|
242
|
+
parameters?: {
|
|
243
|
+
orderId?: string;
|
|
244
|
+
tokenId?: string;
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
redirect?: string;
|
|
249
|
+
'3ds'?: string;
|
|
250
|
+
self: string;
|
|
251
|
+
};
|
|
252
|
+
workflow: {
|
|
253
|
+
code: string;
|
|
254
|
+
version: number;
|
|
82
255
|
};
|
|
83
|
-
events?: PayrailsSDKEvents;
|
|
84
256
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
constructor(options: StoreInstrumentElementOptions);
|
|
88
|
-
get isChecked(): boolean;
|
|
89
|
-
private createHTML;
|
|
90
|
-
private applyStyles;
|
|
91
|
-
private addListeners;
|
|
257
|
+
interface BasePaymentMethodConfig {
|
|
258
|
+
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
92
259
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
|
|
97
|
-
protected get shouldStoreInstrument(): boolean;
|
|
260
|
+
interface BaseInstallmentOption {
|
|
261
|
+
count: number;
|
|
262
|
+
amount: number;
|
|
98
263
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
264
|
+
interface PaymentInstallmentsConfig {
|
|
265
|
+
[key: string]: BaseInstallmentOption[];
|
|
266
|
+
}
|
|
267
|
+
interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C = undefined | ApplePayConfig | PayPalConfig | GooglePayConfig> extends BasePaymentMethodConfig {
|
|
268
|
+
id: string;
|
|
269
|
+
description?: string;
|
|
270
|
+
status: PAYMENT_INSTRUMENT_STATUS;
|
|
271
|
+
integrationType: INTEGRATION_TYPE;
|
|
272
|
+
config: C;
|
|
273
|
+
clientConfig?: {
|
|
274
|
+
flow?: PAYMENT_CLIENT_FLOW;
|
|
275
|
+
supportsInstallments?: boolean;
|
|
276
|
+
installments?: PaymentInstallmentsConfig;
|
|
277
|
+
supportsBillingInfo?: boolean;
|
|
278
|
+
schema?: JSONSchemaType;
|
|
279
|
+
additionalConfig?: any;
|
|
105
280
|
};
|
|
106
|
-
|
|
107
|
-
type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
|
|
108
|
-
style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
|
|
109
|
-
} & StoreInstrumentElementOptions['styles'];
|
|
281
|
+
paymentInstruments?: Array<StoredPaymentInstrument<I>>;
|
|
110
282
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
283
|
+
interface GooglePayConfig {
|
|
284
|
+
parameters: {
|
|
285
|
+
allowedAuthMethods: google.payments.api.CardAuthMethod[];
|
|
286
|
+
allowedCardNetworks: google.payments.api.CardNetwork[];
|
|
287
|
+
billingAddressParameters?: {
|
|
288
|
+
format?: string;
|
|
289
|
+
};
|
|
290
|
+
billingAddressRequired?: boolean;
|
|
291
|
+
};
|
|
292
|
+
tokenizationSpecification: google.payments.api.PaymentMethodTokenizationSpecification;
|
|
293
|
+
type: google.payments.api.PaymentMethodType;
|
|
294
|
+
apiVersion?: number;
|
|
295
|
+
apiVersionMinor?: number;
|
|
296
|
+
allowedPaymentMethods?: google.payments.api.PaymentMethodSpecification[];
|
|
297
|
+
emailRequired?: boolean;
|
|
298
|
+
shippingAddressRequired?: boolean;
|
|
299
|
+
shippingAddressParameters?: google.payments.api.ShippingAddressParameters;
|
|
300
|
+
merchantInfo?: google.payments.api.MerchantInfo;
|
|
301
|
+
existingPaymentMethodRequired?: boolean;
|
|
115
302
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
303
|
+
interface PayPalConfig {
|
|
304
|
+
clientId: string;
|
|
305
|
+
merchantId: string;
|
|
306
|
+
captureMode: 'Delayed' | 'Instant' | 'Manual';
|
|
307
|
+
integrationMode: 'express' | 'normal';
|
|
308
|
+
}
|
|
309
|
+
interface ApplePayConfig {
|
|
310
|
+
parameters: {
|
|
311
|
+
merchantIdentifier: string;
|
|
312
|
+
supportedNetworks: string[];
|
|
313
|
+
countryCode: string;
|
|
314
|
+
merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
|
|
315
|
+
requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
|
|
316
|
+
};
|
|
317
|
+
type: string;
|
|
318
|
+
}
|
|
319
|
+
interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata> {
|
|
320
|
+
id: string;
|
|
321
|
+
status: PAYMENT_INSTRUMENT_STATUS;
|
|
322
|
+
paymentMethod: PAYMENT_METHOD_CODES;
|
|
323
|
+
displayName?: string;
|
|
324
|
+
data?: T;
|
|
325
|
+
}
|
|
326
|
+
interface PayPalMetadata {
|
|
327
|
+
email?: string;
|
|
328
|
+
}
|
|
329
|
+
interface CardMetadata {
|
|
330
|
+
bin?: string;
|
|
331
|
+
suffix?: string;
|
|
332
|
+
network?: string;
|
|
333
|
+
binLookup?: {
|
|
334
|
+
issuerCountry: {
|
|
335
|
+
code: string;
|
|
336
|
+
name: string;
|
|
337
|
+
iso3: string;
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
declare enum PAYMENT_CLIENT_FLOW {
|
|
342
|
+
'REDIRECT' = "redirect",
|
|
343
|
+
'DIRECT' = "direct",
|
|
344
|
+
'EMBEDDED' = "embedded"
|
|
345
|
+
}
|
|
346
|
+
declare enum INTEGRATION_TYPE {
|
|
347
|
+
API = "api",
|
|
348
|
+
HPP = "hpp"
|
|
127
349
|
}
|
|
128
350
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
351
|
+
interface SaveInstrumentResponse {
|
|
352
|
+
id: string;
|
|
353
|
+
createdAt: string;
|
|
354
|
+
holderId: string;
|
|
355
|
+
paymentMethod: PAYMENT_METHOD_CODES.CARD;
|
|
356
|
+
status: PAYMENT_INSTRUMENT_STATUS;
|
|
357
|
+
data: {
|
|
358
|
+
bin: string;
|
|
359
|
+
binLookup?: {
|
|
360
|
+
bin: string;
|
|
361
|
+
network: string;
|
|
362
|
+
issuer?: string;
|
|
363
|
+
issuerCountry?: {
|
|
364
|
+
code?: string;
|
|
365
|
+
name?: string;
|
|
366
|
+
iso3?: string;
|
|
367
|
+
};
|
|
368
|
+
type?: string;
|
|
369
|
+
};
|
|
370
|
+
holderName?: string;
|
|
371
|
+
network: string;
|
|
372
|
+
suffix: string;
|
|
373
|
+
expiryMonth?: string;
|
|
374
|
+
expiryYear?: string;
|
|
375
|
+
};
|
|
376
|
+
fingerprint?: string;
|
|
377
|
+
futureUsage?: string;
|
|
378
|
+
}
|
|
142
379
|
|
|
143
380
|
interface BinLookupResponse {
|
|
144
381
|
bin: string;
|
|
@@ -471,6 +708,40 @@ declare class Skyflow {
|
|
|
471
708
|
static get ValidationRuleType(): typeof ValidationRuleType;
|
|
472
709
|
}
|
|
473
710
|
|
|
711
|
+
interface Mountable {
|
|
712
|
+
mount(selector: string | PayrailsElement): void;
|
|
713
|
+
unmount(): void;
|
|
714
|
+
}
|
|
715
|
+
interface ElementOptions {
|
|
716
|
+
id?: string;
|
|
717
|
+
dataTestId?: string;
|
|
718
|
+
className?: string | string[];
|
|
719
|
+
styles?: Partial<CSSStyleDeclaration>;
|
|
720
|
+
}
|
|
721
|
+
declare class PayrailsElement implements Mountable {
|
|
722
|
+
protected element: HTMLElement;
|
|
723
|
+
protected subElements: Array<Mountable>;
|
|
724
|
+
readonly id: string | undefined;
|
|
725
|
+
readonly dataTestId: string | undefined;
|
|
726
|
+
protected eventBus: _payrails_iframe_event_bus.IframeEventBus;
|
|
727
|
+
constructor(elementType: string, { id, className, dataTestId }?: ElementOptions);
|
|
728
|
+
get parentElement(): HTMLElement | null;
|
|
729
|
+
get selector(): string;
|
|
730
|
+
mount(location: string): void;
|
|
731
|
+
protected clean(): void;
|
|
732
|
+
unmount(): void;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
interface TokenizeOptions {
|
|
736
|
+
futureUsage?: 'CardOnFile' | 'Subscription' | 'UnscheduledCardOnFile';
|
|
737
|
+
storeInstrument?: boolean;
|
|
738
|
+
}
|
|
739
|
+
declare abstract class Tokenizable extends PayrailsElement {
|
|
740
|
+
abstract collect(): Promise<any>;
|
|
741
|
+
protected abstract constructSaveInstrumentBody(tokens: any, opts?: TokenizeOptions): Promise<any>;
|
|
742
|
+
tokenize(_opts?: TokenizeOptions): Promise<any>;
|
|
743
|
+
}
|
|
744
|
+
|
|
474
745
|
declare enum ElementType {
|
|
475
746
|
CARD_NUMBER = "CARD_NUMBER",
|
|
476
747
|
CARDHOLDER_NAME = "CARDHOLDER_NAME",
|
|
@@ -566,10 +837,61 @@ declare class PayrailsCollectContainer implements Mountable {
|
|
|
566
837
|
bin: string;
|
|
567
838
|
}>;
|
|
568
839
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
840
|
+
|
|
841
|
+
interface IAddress {
|
|
842
|
+
country?: {
|
|
843
|
+
code?: string;
|
|
844
|
+
fullName?: string;
|
|
845
|
+
iso3?: string;
|
|
846
|
+
};
|
|
847
|
+
postalCode?: string;
|
|
848
|
+
}
|
|
849
|
+
interface IOnChange {
|
|
850
|
+
isValid: boolean;
|
|
851
|
+
billingAddress?: IAddress;
|
|
572
852
|
}
|
|
853
|
+
interface AddressSelectorElementOptions extends ElementOptions {
|
|
854
|
+
translations?: {
|
|
855
|
+
labels?: {
|
|
856
|
+
countrySelector?: string;
|
|
857
|
+
postalCodeInput?: string;
|
|
858
|
+
};
|
|
859
|
+
placeholders?: {
|
|
860
|
+
postalCodeInput?: string;
|
|
861
|
+
countrySelector?: string;
|
|
862
|
+
};
|
|
863
|
+
};
|
|
864
|
+
styles?: {
|
|
865
|
+
wrapper?: Partial<CSSStyleDeclaration>;
|
|
866
|
+
countrySelector?: {
|
|
867
|
+
wrapper?: Partial<CSSStyleDeclaration>;
|
|
868
|
+
element?: Partial<CSSStyleDeclaration>;
|
|
869
|
+
label?: Partial<CSSStyleDeclaration>;
|
|
870
|
+
};
|
|
871
|
+
postalCodeInput?: {
|
|
872
|
+
wrapper?: Partial<CSSStyleDeclaration>;
|
|
873
|
+
element?: Partial<CSSStyleDeclaration>;
|
|
874
|
+
label?: Partial<CSSStyleDeclaration>;
|
|
875
|
+
};
|
|
876
|
+
};
|
|
877
|
+
events?: {
|
|
878
|
+
onBillingAddressChanged?: (e: IOnChange) => void;
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
declare const regexes: {
|
|
883
|
+
visa: RegExp;
|
|
884
|
+
mastercard: RegExp;
|
|
885
|
+
amex: RegExp;
|
|
886
|
+
diners: RegExp;
|
|
887
|
+
discover: RegExp;
|
|
888
|
+
jcb: RegExp;
|
|
889
|
+
hipercard: RegExp;
|
|
890
|
+
unionpay: RegExp;
|
|
891
|
+
maestro: RegExp;
|
|
892
|
+
elo: RegExp;
|
|
893
|
+
};
|
|
894
|
+
type CardNetwork = keyof typeof regexes;
|
|
573
895
|
|
|
574
896
|
interface PaymentInstallmentsElementOptions extends ElementOptions {
|
|
575
897
|
showPaymentInstallmentsDropdown?: boolean;
|
|
@@ -608,26 +930,56 @@ declare class PayrailsElementWithPaymentInstallmentsDropdown extends PayrailsEle
|
|
|
608
930
|
setDisabled(state: boolean): void;
|
|
609
931
|
}
|
|
610
932
|
|
|
611
|
-
interface
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
billingAddress?: IAddress;
|
|
616
|
-
}
|
|
617
|
-
type cardFormField = keyof typeof ElementType;
|
|
618
|
-
type CardFormLayout = cardFormField[][];
|
|
619
|
-
interface CardFormOptions extends StoreInstrumentElementOptions {
|
|
620
|
-
showCardHolderName?: boolean;
|
|
621
|
-
showSingleExpiryDateField?: boolean;
|
|
622
|
-
enrollInstrumentToNetworkOffers?: boolean;
|
|
623
|
-
layout?: CardFormLayout;
|
|
933
|
+
interface StoreInstrumentElementOptions extends ElementOptions {
|
|
934
|
+
showStoreInstrumentCheckbox?: boolean;
|
|
935
|
+
alwaysStoreInstrument?: boolean;
|
|
936
|
+
defaultStoreInstrumentState?: 'checked' | 'unchecked';
|
|
624
937
|
translations?: {
|
|
625
|
-
placeholders?: {
|
|
626
|
-
[key in ElementType]?: string;
|
|
627
|
-
};
|
|
628
938
|
labels?: {
|
|
629
|
-
|
|
630
|
-
|
|
939
|
+
storeInstrument?: string;
|
|
940
|
+
saveInstrument?: string;
|
|
941
|
+
};
|
|
942
|
+
};
|
|
943
|
+
styles?: {
|
|
944
|
+
storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
|
|
945
|
+
};
|
|
946
|
+
events?: PayrailsSDKEvents;
|
|
947
|
+
}
|
|
948
|
+
declare class StoreInstrumentCheckbox extends PayrailsElement {
|
|
949
|
+
private options;
|
|
950
|
+
constructor(options: StoreInstrumentElementOptions);
|
|
951
|
+
get isChecked(): boolean;
|
|
952
|
+
private createHTML;
|
|
953
|
+
private applyStyles;
|
|
954
|
+
private addListeners;
|
|
955
|
+
}
|
|
956
|
+
declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
|
|
957
|
+
protected options?: StoreInstrumentElementOptions | undefined;
|
|
958
|
+
protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
|
|
959
|
+
protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
|
|
960
|
+
protected get shouldStoreInstrument(): boolean;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
interface OnChange {
|
|
964
|
+
isValid: boolean;
|
|
965
|
+
cardNetwork: CardNetwork | '';
|
|
966
|
+
bin?: string;
|
|
967
|
+
billingAddress?: IAddress;
|
|
968
|
+
}
|
|
969
|
+
type cardFormField = keyof typeof ElementType;
|
|
970
|
+
type CardFormLayout = cardFormField[][];
|
|
971
|
+
interface CardFormOptions extends StoreInstrumentElementOptions {
|
|
972
|
+
showCardHolderName?: boolean;
|
|
973
|
+
showSingleExpiryDateField?: boolean;
|
|
974
|
+
enrollInstrumentToNetworkOffers?: boolean;
|
|
975
|
+
layout?: CardFormLayout;
|
|
976
|
+
translations?: {
|
|
977
|
+
placeholders?: {
|
|
978
|
+
[key in ElementType]?: string;
|
|
979
|
+
};
|
|
980
|
+
labels?: {
|
|
981
|
+
[key in ElementType | 'saveCreditCard']?: string;
|
|
982
|
+
} & {
|
|
631
983
|
saveInstrument?: string;
|
|
632
984
|
storeInstrument?: string;
|
|
633
985
|
paymentInstallments?: string;
|
|
@@ -742,6 +1094,13 @@ declare class CardList extends PayrailsElement {
|
|
|
742
1094
|
reset(): void;
|
|
743
1095
|
}
|
|
744
1096
|
|
|
1097
|
+
declare enum RequestMethod {
|
|
1098
|
+
GET = "GET",
|
|
1099
|
+
POST = "POST",
|
|
1100
|
+
DELETE = "DELETE",
|
|
1101
|
+
PATCH = "PATCH"
|
|
1102
|
+
}
|
|
1103
|
+
|
|
745
1104
|
interface SdkConfiguration {
|
|
746
1105
|
token: string;
|
|
747
1106
|
amount: PayrailsAmount;
|
|
@@ -763,6 +1122,7 @@ interface SdkConfiguration {
|
|
|
763
1122
|
links: {
|
|
764
1123
|
saveInstrument: {
|
|
765
1124
|
href: string;
|
|
1125
|
+
method: RequestMethod;
|
|
766
1126
|
};
|
|
767
1127
|
};
|
|
768
1128
|
};
|
|
@@ -865,6 +1225,7 @@ interface LoadingScreenStyles {
|
|
|
865
1225
|
[StyleKeys.loader]?: Partial<CSSStyleDeclaration>;
|
|
866
1226
|
}
|
|
867
1227
|
|
|
1228
|
+
type GooglePayConfigInput = google.payments.api.IsReadyToPayPaymentMethodSpecification[] | GooglePayConfig;
|
|
868
1229
|
interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
|
|
869
1230
|
environment?: PayrailsEnvironment;
|
|
870
1231
|
merchantInfo?: google.payments.api.MerchantInfo;
|
|
@@ -887,8 +1248,9 @@ declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox
|
|
|
887
1248
|
private static googleSDKClient;
|
|
888
1249
|
private sdkLoadedCalled;
|
|
889
1250
|
private buttonElement;
|
|
1251
|
+
private static getGooglePayConfigAsArray;
|
|
890
1252
|
private static getSDKClient;
|
|
891
|
-
static isGooglePayAvailable(allowedPaymentMethods:
|
|
1253
|
+
static isGooglePayAvailable(allowedPaymentMethods: GooglePayConfigInput, environment?: PayrailsEnvironment, merchantInfo?: google.payments.api.MerchantInfo): Promise<boolean>;
|
|
892
1254
|
constructor(options: GooglePayButtonOptions);
|
|
893
1255
|
private sdkLoaded;
|
|
894
1256
|
private onLoadPaymentData;
|
|
@@ -1080,7 +1442,7 @@ declare class Dropin extends PayrailsElement {
|
|
|
1080
1442
|
private loadingScreen;
|
|
1081
1443
|
constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions);
|
|
1082
1444
|
private isHppIntegration;
|
|
1083
|
-
private
|
|
1445
|
+
private isEmbeddedElement;
|
|
1084
1446
|
private createStoredInstrumentElement;
|
|
1085
1447
|
private createInstallmentsDropdown;
|
|
1086
1448
|
private getInstallmentOptionsForInstrument;
|
|
@@ -1092,7 +1454,7 @@ declare class Dropin extends PayrailsElement {
|
|
|
1092
1454
|
private createCardForm;
|
|
1093
1455
|
private createApplePayButton;
|
|
1094
1456
|
private createCardPaymentButton;
|
|
1095
|
-
private
|
|
1457
|
+
private createEmbeddedElement;
|
|
1096
1458
|
private onAuthorizeSuccess;
|
|
1097
1459
|
private getElementEvents;
|
|
1098
1460
|
private onAuthorizePending;
|
|
@@ -1164,513 +1526,68 @@ interface DropinOptions {
|
|
|
1164
1526
|
addressSelector?: AddressSelectorElementOptions['styles'];
|
|
1165
1527
|
mercadoPago?: GenericRedirectDropinOptions['styles'];
|
|
1166
1528
|
};
|
|
1167
|
-
configuration?: {
|
|
1168
|
-
authFailMsg?: AuthFailedMsgOptions['configuration'];
|
|
1169
|
-
};
|
|
1170
|
-
}
|
|
1171
|
-
interface ContainerStyles {
|
|
1172
|
-
styles?: Partial<CSSStyleDeclaration>;
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
declare enum RequestMethod {
|
|
1176
|
-
GET = "GET",
|
|
1177
|
-
POST = "POST",
|
|
1178
|
-
DELETE = "DELETE",
|
|
1179
|
-
PATCH = "PATCH"
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
type Operations = {
|
|
1183
|
-
deleteInstrument: OperationConfig<void, DeleteInstrumentResponse>;
|
|
1184
|
-
updateInstrument: OperationConfig<UpdateInstrumentBody, UpdateInstrumentResponse>;
|
|
1185
|
-
};
|
|
1186
|
-
interface UpdateInstrumentBody {
|
|
1187
|
-
status?: 'enabled' | 'disabled';
|
|
1188
|
-
networkTransactionReference?: string;
|
|
1189
|
-
merchantReference?: string;
|
|
1190
|
-
paymentMethod?: 'applepay' | 'card' | 'googlepay' | 'paypal';
|
|
1191
|
-
default?: boolean;
|
|
1192
|
-
}
|
|
1193
|
-
interface UpdateInstrumentResponse {
|
|
1194
|
-
id: string;
|
|
1195
|
-
createdAt: string;
|
|
1196
|
-
holderId: string;
|
|
1197
|
-
paymentMethod: PAYMENT_METHOD_CODES;
|
|
1198
|
-
status: PAYMENT_INSTRUMENT_STATUS;
|
|
1199
|
-
data: {
|
|
1200
|
-
bin?: string;
|
|
1201
|
-
binLookup?: {
|
|
1202
|
-
bin?: string;
|
|
1203
|
-
network?: string;
|
|
1204
|
-
issuer?: string;
|
|
1205
|
-
issuerCountry?: {
|
|
1206
|
-
code?: string;
|
|
1207
|
-
name?: string;
|
|
1208
|
-
iso3?: string;
|
|
1209
|
-
};
|
|
1210
|
-
type?: string;
|
|
1211
|
-
};
|
|
1212
|
-
holderName?: string;
|
|
1213
|
-
network?: string;
|
|
1214
|
-
suffix?: string;
|
|
1215
|
-
expiryMonth?: string;
|
|
1216
|
-
expiryYear?: string;
|
|
1217
|
-
};
|
|
1218
|
-
fingerprint?: string;
|
|
1219
|
-
futureUsage?: string;
|
|
1220
|
-
}
|
|
1221
|
-
interface DeleteInstrumentResponse {
|
|
1222
|
-
success: boolean;
|
|
1223
|
-
}
|
|
1224
|
-
type RequestCreator<TReq, TOperation extends keyof Operations> = (config: ApiConfig<TReq> & {
|
|
1225
|
-
operation: TOperation;
|
|
1226
|
-
}) => {
|
|
1227
|
-
url: string;
|
|
1228
|
-
body?: TReq;
|
|
1229
|
-
};
|
|
1230
|
-
interface OperationConfig<TReq, TRes> {
|
|
1231
|
-
linkKey: keyof NonNullable<SdkConfiguration['links']>;
|
|
1232
|
-
method: RequestMethod;
|
|
1233
|
-
createRequest: RequestCreator<TReq, keyof Operations>;
|
|
1234
|
-
requestType: TReq;
|
|
1235
|
-
responseType: TRes;
|
|
1236
|
-
}
|
|
1237
|
-
interface ApiConfig<TReq> {
|
|
1238
|
-
operation: keyof Operations;
|
|
1239
|
-
resourceId?: string;
|
|
1240
|
-
body?: TReq;
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
declare class SdkLoader {
|
|
1244
|
-
private static readonly scriptMap;
|
|
1245
|
-
static load<T = void>(sdk: ThirdPartySDK, params?: PayPalScriptConfig): Promise<T>;
|
|
1246
|
-
static reset(): void;
|
|
1247
|
-
static preloadCardForm(): void;
|
|
1248
|
-
private static loadScript;
|
|
1249
|
-
private static loadPayPalScript;
|
|
1250
|
-
private constructor();
|
|
1251
|
-
private static logLoadError;
|
|
1252
|
-
}
|
|
1253
|
-
interface PayPalScriptConfig {
|
|
1254
|
-
clientId: string;
|
|
1255
|
-
currency: string;
|
|
1256
|
-
vault: boolean;
|
|
1257
|
-
intent: 'tokenize' | 'capture' | 'authorize';
|
|
1258
|
-
}
|
|
1259
|
-
declare enum ThirdPartySDK {
|
|
1260
|
-
ApplePay = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",
|
|
1261
|
-
GooglePay = "https://pay.google.com/gp/p/js/pay.js",
|
|
1262
|
-
PayPal = "paypal-sdk"
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
interface QueryDefinition<T> {
|
|
1266
|
-
path: string[];
|
|
1267
|
-
returnType: T;
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
interface ConfigurationQueryTypes {
|
|
1271
|
-
holderReference: QueryDefinition<string>;
|
|
1272
|
-
amount: QueryDefinition<PayrailsAmount>;
|
|
1273
|
-
binLookup: QueryDefinition<Links | undefined>;
|
|
1274
|
-
instrumentDelete: QueryDefinition<Links | undefined>;
|
|
1275
|
-
instrumentUpdate: QueryDefinition<Links | undefined>;
|
|
1276
|
-
executionId: QueryDefinition<string | undefined>;
|
|
1277
|
-
paymentMethodConfig: QueryDefinition<StorablePaymentCompositionOption | undefined>;
|
|
1278
|
-
paymentMethodInstruments: QueryDefinition<StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined>;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
interface InitOptions {
|
|
1282
|
-
version: string;
|
|
1283
|
-
data: string;
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
interface PayrailsClientOptions {
|
|
1287
|
-
environment?: PayrailsEnvironment;
|
|
1288
|
-
events?: ClientEvents;
|
|
1289
|
-
redirectFor3DS?: boolean;
|
|
1290
|
-
returnInfo?: ReturnInfo;
|
|
1291
|
-
telemetry?: {
|
|
1292
|
-
enabled?: boolean;
|
|
1293
|
-
logLevel?: LogLevel$1;
|
|
1294
|
-
};
|
|
1295
|
-
}
|
|
1296
|
-
declare class Payrails {
|
|
1297
|
-
private vaultClient;
|
|
1298
|
-
private options?;
|
|
1299
|
-
private __container;
|
|
1300
|
-
private __cardForm;
|
|
1301
|
-
private __cardList;
|
|
1302
|
-
private __cardPaymentButton;
|
|
1303
|
-
private __paypalButton;
|
|
1304
|
-
private __genericRedirectButton;
|
|
1305
|
-
private __dropin;
|
|
1306
|
-
static preloadCardForm: typeof SdkLoader.preloadCardForm;
|
|
1307
|
-
static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
|
|
1308
|
-
update(amount: PayrailsAmount): void;
|
|
1309
|
-
collectContainer(containerOptions: CollectContainerOptions): PayrailsCollectContainer;
|
|
1310
|
-
googlePayButton(options: GooglePayButtonOptions): GooglePayButton;
|
|
1311
|
-
isGooglePayAvailable(merchantInfo: google.payments.api.MerchantInfo): Promise<boolean>;
|
|
1312
|
-
applePayButton(options: ApplePayButtonOptions): ApplePayButton;
|
|
1313
|
-
isApplePayAvailable(): Promise<boolean>;
|
|
1314
|
-
cardList(options?: CardListOptions): CardList;
|
|
1315
|
-
cardForm(options?: CardFormOptions): CardForm;
|
|
1316
|
-
dropin(options: DropinOptions): Dropin;
|
|
1317
|
-
getSavedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
|
|
1318
|
-
getSavedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1319
|
-
getSavedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1320
|
-
query<K extends keyof ConfigurationQueryTypes>(key: K, params?: Record<string, any>): ConfigurationQueryTypes[K]['returnType'] | null;
|
|
1321
|
-
api<TOperation extends keyof Operations>(config: ApiConfig<Operations[TOperation]['requestType']> & {
|
|
1322
|
-
operation: TOperation;
|
|
1323
|
-
}): Promise<Operations[TOperation]['responseType']>;
|
|
1324
|
-
getStoredInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
1325
|
-
getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
|
|
1326
|
-
paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
|
|
1327
|
-
paypalButton(options?: PaypalButtonOptions): PaypalButton;
|
|
1328
|
-
genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
|
|
1329
|
-
getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
|
|
1330
|
-
private logIntegrationMode;
|
|
1331
|
-
private constructor();
|
|
1332
|
-
private getContainerLayout;
|
|
1333
|
-
binLookup(): Promise<any>;
|
|
1334
|
-
}
|
|
1335
|
-
interface ClientEvents {
|
|
1336
|
-
onClientInitialized?: (execution?: typeof WorkflowExecution) => void;
|
|
1337
|
-
onSessionExpired?: () => Promise<InitOptions>;
|
|
1338
|
-
}
|
|
1339
|
-
interface PaymentEvents {
|
|
1340
|
-
onAuthorizeSuccess?: (e?: any) => void;
|
|
1341
|
-
onAuthorizeFailed?: (e?: any) => void;
|
|
1342
|
-
onAuthorizePending?: (e?: any) => void;
|
|
1343
|
-
onPaymentButtonClicked?: (e?: {
|
|
1344
|
-
bin?: string;
|
|
1345
|
-
}) => Promise<boolean>;
|
|
1346
|
-
onAuthorizeRequestStart?: () => void;
|
|
1347
|
-
onPaymentSessionExpired?: () => void;
|
|
1348
|
-
onThreeDSecureChallenge?: () => void;
|
|
1349
|
-
}
|
|
1350
|
-
interface UIEvents {
|
|
1351
|
-
onSaveInstrumentCheckboxChanged?: ({ checked }: {
|
|
1352
|
-
checked: boolean;
|
|
1353
|
-
}) => void;
|
|
1354
|
-
onBillingAddressChanged?: (e: {
|
|
1355
|
-
isValid: boolean;
|
|
1356
|
-
billingAddress?: IAddress;
|
|
1357
|
-
}) => void;
|
|
1358
|
-
onDeliveryAddressChanged?: (data?: onDeliveryAddressChangedResponse) => Promise<boolean>;
|
|
1359
|
-
}
|
|
1360
|
-
type onPaymentMethodSelectedParams = {
|
|
1361
|
-
paymentMethod?: StorablePaymentCompositionOption;
|
|
1362
|
-
instrument?: StoredPaymentInstrument<CardMetadata & PayPalMetadata>;
|
|
1363
|
-
};
|
|
1364
|
-
interface DropinEvents {
|
|
1365
|
-
onPaymentOptionSelected?: (e: onPaymentMethodSelectedParams) => void;
|
|
1366
|
-
}
|
|
1367
|
-
type PayrailsSDKEvents = PaymentEvents & UIEvents & DropinEvents;
|
|
1368
|
-
type onDeliveryAddressChangedResponse = {
|
|
1369
|
-
deliveryAddress?: {
|
|
1370
|
-
street?: string;
|
|
1371
|
-
doorNumber?: string;
|
|
1372
|
-
complement?: string;
|
|
1373
|
-
area?: string;
|
|
1374
|
-
city?: string;
|
|
1375
|
-
postalCode?: string;
|
|
1376
|
-
state?: string;
|
|
1377
|
-
country?: {
|
|
1378
|
-
code?: string;
|
|
1379
|
-
iso3?: string;
|
|
1380
|
-
name?: string;
|
|
1381
|
-
};
|
|
1382
|
-
latitude?: number;
|
|
1383
|
-
longitude?: number;
|
|
1384
|
-
phone?: {
|
|
1385
|
-
countryCode?: string;
|
|
1386
|
-
number?: string;
|
|
1387
|
-
};
|
|
1388
|
-
name?: string;
|
|
1389
|
-
lastName?: string;
|
|
1390
|
-
email?: string;
|
|
1391
|
-
};
|
|
1392
|
-
};
|
|
1393
|
-
declare enum PayrailsEnvironment {
|
|
1394
|
-
TEST = "TEST",
|
|
1395
|
-
PRODUCTION = "PRODUCTION"
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
type JSONSchemaType = JSONSchemaProperty & {
|
|
1399
|
-
required?: string[];
|
|
1400
|
-
};
|
|
1401
|
-
interface JSONSchemaProperty {
|
|
1402
|
-
type?: 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
1403
|
-
title?: string;
|
|
1404
|
-
enum?: any[];
|
|
1405
|
-
pattern?: string;
|
|
1406
|
-
minLength?: number;
|
|
1407
|
-
maxLength?: number;
|
|
1408
|
-
errorMessage?: Record<string, string>;
|
|
1409
|
-
properties?: Record<string, JSONSchemaType>;
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
declare enum PAYMENT_METHOD_CODES {
|
|
1413
|
-
'CARD' = "card",
|
|
1414
|
-
'GOOGLE_PAY' = "googlePay",
|
|
1415
|
-
'PAYPAL' = "payPal",
|
|
1416
|
-
'APPLE_PAY' = "applePay",
|
|
1417
|
-
'GENERIC_REDIRECT' = "genericRedirect",
|
|
1418
|
-
'MERCADO_PAGO' = "mercadoPago",
|
|
1419
|
-
'PIX' = "pix",
|
|
1420
|
-
'BANK_ACCOUNT' = "bankAccount"
|
|
1421
|
-
}
|
|
1422
|
-
declare enum PAYMENT_INSTRUMENT_STATUS {
|
|
1423
|
-
'ENABLED' = "enabled",
|
|
1424
|
-
'CREATED' = "created",
|
|
1425
|
-
'DELETED' = "deleted",
|
|
1426
|
-
'DISABLED' = "disabled",
|
|
1427
|
-
'INVALID' = "invalid",
|
|
1428
|
-
'TRANSIENT' = "transient"
|
|
1429
|
-
}
|
|
1430
|
-
declare class WorkflowExecution {
|
|
1431
|
-
private static _response;
|
|
1432
|
-
static get response(): WorkflowExecutionResponse;
|
|
1433
|
-
static setResponse(response: WorkflowExecutionResponse): typeof WorkflowExecution;
|
|
1434
|
-
static get lookup(): {
|
|
1435
|
-
httpCode: number;
|
|
1436
|
-
body: {
|
|
1437
|
-
data: {
|
|
1438
|
-
paymentCompositionOptions: Array<StorablePaymentCompositionOption>;
|
|
1439
|
-
};
|
|
1440
|
-
links: {
|
|
1441
|
-
authorize: {
|
|
1442
|
-
href: string;
|
|
1443
|
-
method: "POST";
|
|
1444
|
-
};
|
|
1445
|
-
execution: string;
|
|
1446
|
-
};
|
|
1447
|
-
name: "lookup";
|
|
1448
|
-
};
|
|
1449
|
-
} | undefined;
|
|
1450
|
-
static get holderReference(): string;
|
|
1451
|
-
static get savedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
|
|
1452
|
-
static get savedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
|
|
1453
|
-
static get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1454
|
-
static get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1455
|
-
static get paypalConfig(): PayPalConfig;
|
|
1456
|
-
static get googlePayConfig(): GooglePayConfig[];
|
|
1457
|
-
static isPaymentMethodAvailable(paymentMethod: PAYMENT_METHOD_CODES): boolean;
|
|
1458
|
-
static get applePayConfig(): {
|
|
1459
|
-
merchantIdentifier: string;
|
|
1460
|
-
supportedNetworks: string[];
|
|
1461
|
-
countryCode: string;
|
|
1462
|
-
merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
|
|
1463
|
-
requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
|
|
1464
|
-
};
|
|
1465
|
-
static get url(): string;
|
|
1466
|
-
static get meta(): {
|
|
1467
|
-
customer?: {
|
|
1468
|
-
country?: {
|
|
1469
|
-
code?: string;
|
|
1470
|
-
};
|
|
1471
|
-
};
|
|
1472
|
-
order?: {
|
|
1473
|
-
billingAddress?: {
|
|
1474
|
-
country?: {
|
|
1475
|
-
code?: string;
|
|
1476
|
-
};
|
|
1477
|
-
};
|
|
1478
|
-
};
|
|
1479
|
-
};
|
|
1480
|
-
static get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
|
|
1481
|
-
static get authorizeLink(): string | undefined;
|
|
1482
|
-
static get createSessionLink(): string | undefined;
|
|
1483
|
-
static get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
1484
|
-
static get storedDropinInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
1485
|
-
static getFullPaymentMethodConfig(paymentMethod: PAYMENT_METHOD_CODES): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
|
|
1486
|
-
static isAddressSelectorEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
|
|
1487
|
-
static isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
|
|
1488
|
-
static getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
|
|
1489
|
-
static getStoredInstrumentForPaymentMethod<T = CardMetadata | PayPalMetadata>(paymentMethod: PAYMENT_METHOD_CODES): Array<StoredPaymentInstrument<T>>;
|
|
1490
|
-
static getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
|
|
1491
|
-
id: string;
|
|
1492
|
-
description?: string;
|
|
1493
|
-
status: PAYMENT_INSTRUMENT_STATUS;
|
|
1494
|
-
integrationType: INTEGRATION_TYPE;
|
|
1495
|
-
config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
|
|
1496
|
-
clientConfig?: {
|
|
1497
|
-
flow?: PAYMENT_CLIENT_FLOW;
|
|
1498
|
-
supportsInstallments?: boolean;
|
|
1499
|
-
installments?: PaymentInstallmentsConfig;
|
|
1500
|
-
supportsBillingInfo?: boolean;
|
|
1501
|
-
schema?: JSONSchemaType;
|
|
1502
|
-
};
|
|
1503
|
-
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
1504
|
-
} | undefined;
|
|
1505
|
-
static getPaymentMethodConfig(paymentMethod: StorablePaymentCompositionOption): {
|
|
1506
|
-
id: string;
|
|
1507
|
-
description?: string;
|
|
1508
|
-
status: PAYMENT_INSTRUMENT_STATUS;
|
|
1509
|
-
integrationType: INTEGRATION_TYPE;
|
|
1510
|
-
config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
|
|
1511
|
-
clientConfig?: {
|
|
1512
|
-
flow?: PAYMENT_CLIENT_FLOW;
|
|
1513
|
-
supportsInstallments?: boolean;
|
|
1514
|
-
installments?: PaymentInstallmentsConfig;
|
|
1515
|
-
supportsBillingInfo?: boolean;
|
|
1516
|
-
schema?: JSONSchemaType;
|
|
1517
|
-
};
|
|
1518
|
-
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
1519
|
-
};
|
|
1520
|
-
}
|
|
1521
|
-
interface WorkflowExecutionResponse {
|
|
1522
|
-
id: string;
|
|
1523
|
-
merchantReference: string;
|
|
1524
|
-
holderReference: string;
|
|
1525
|
-
actionRequired?: string;
|
|
1526
|
-
meta: {
|
|
1527
|
-
customer?: {
|
|
1528
|
-
country?: {
|
|
1529
|
-
code?: string;
|
|
1530
|
-
};
|
|
1531
|
-
};
|
|
1532
|
-
order?: {
|
|
1533
|
-
billingAddress?: {
|
|
1534
|
-
country?: {
|
|
1535
|
-
code?: string;
|
|
1536
|
-
};
|
|
1537
|
-
};
|
|
1538
|
-
};
|
|
1539
|
-
};
|
|
1540
|
-
status: Array<{
|
|
1541
|
-
code: string;
|
|
1542
|
-
time: string;
|
|
1543
|
-
}>;
|
|
1544
|
-
initialResults: Array<{
|
|
1545
|
-
httpCode: number;
|
|
1546
|
-
body: {
|
|
1547
|
-
data: {
|
|
1548
|
-
paymentCompositionOptions: Array<StorablePaymentCompositionOption>;
|
|
1549
|
-
};
|
|
1550
|
-
links: {
|
|
1551
|
-
authorize: {
|
|
1552
|
-
href: string;
|
|
1553
|
-
method: 'POST';
|
|
1554
|
-
};
|
|
1555
|
-
execution: string;
|
|
1556
|
-
};
|
|
1557
|
-
name: 'lookup';
|
|
1558
|
-
};
|
|
1559
|
-
}>;
|
|
1560
|
-
links: {
|
|
1561
|
-
startPaymentSession?: {
|
|
1562
|
-
href: string;
|
|
1563
|
-
method: 'POST';
|
|
1564
|
-
};
|
|
1565
|
-
confirm?: {
|
|
1566
|
-
href: string;
|
|
1567
|
-
action?: {
|
|
1568
|
-
parameters?: {
|
|
1569
|
-
orderId?: string;
|
|
1570
|
-
tokenId?: string;
|
|
1571
|
-
};
|
|
1572
|
-
};
|
|
1573
|
-
};
|
|
1574
|
-
redirect?: string;
|
|
1575
|
-
'3ds'?: string;
|
|
1576
|
-
self: string;
|
|
1577
|
-
};
|
|
1578
|
-
workflow: {
|
|
1579
|
-
code: string;
|
|
1580
|
-
version: number;
|
|
1581
|
-
};
|
|
1582
|
-
}
|
|
1583
|
-
interface BasePaymentMethodConfig {
|
|
1584
|
-
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
1585
|
-
}
|
|
1586
|
-
interface BaseInstallmentOption {
|
|
1587
|
-
count: number;
|
|
1588
|
-
amount: number;
|
|
1589
|
-
}
|
|
1590
|
-
interface PaymentInstallmentsConfig {
|
|
1591
|
-
[key: string]: BaseInstallmentOption[];
|
|
1592
|
-
}
|
|
1593
|
-
interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C = undefined | ApplePayConfig | PayPalConfig | GooglePayConfig> extends BasePaymentMethodConfig {
|
|
1594
|
-
id: string;
|
|
1595
|
-
description?: string;
|
|
1596
|
-
status: PAYMENT_INSTRUMENT_STATUS;
|
|
1597
|
-
integrationType: INTEGRATION_TYPE;
|
|
1598
|
-
config: C;
|
|
1599
|
-
clientConfig?: {
|
|
1600
|
-
flow?: PAYMENT_CLIENT_FLOW;
|
|
1601
|
-
supportsInstallments?: boolean;
|
|
1602
|
-
installments?: PaymentInstallmentsConfig;
|
|
1603
|
-
supportsBillingInfo?: boolean;
|
|
1604
|
-
schema?: JSONSchemaType;
|
|
1605
|
-
};
|
|
1606
|
-
paymentInstruments?: Array<StoredPaymentInstrument<I>>;
|
|
1607
|
-
}
|
|
1608
|
-
interface GooglePayConfig {
|
|
1609
|
-
parameters: {
|
|
1610
|
-
allowedAuthMethods: google.payments.api.CardAuthMethod[];
|
|
1611
|
-
allowedCardNetworks: google.payments.api.CardNetwork[];
|
|
1612
|
-
};
|
|
1613
|
-
tokenizationSpecification: google.payments.api.PaymentMethodTokenizationSpecification;
|
|
1614
|
-
type: google.payments.api.PaymentMethodType;
|
|
1615
|
-
}
|
|
1616
|
-
interface PayPalConfig {
|
|
1617
|
-
clientId: string;
|
|
1618
|
-
merchantId: string;
|
|
1619
|
-
captureMode: 'Delayed' | 'Instant' | 'Manual';
|
|
1620
|
-
integrationMode: 'express' | 'normal';
|
|
1621
|
-
}
|
|
1622
|
-
interface ApplePayConfig {
|
|
1623
|
-
parameters: {
|
|
1624
|
-
merchantIdentifier: string;
|
|
1625
|
-
supportedNetworks: string[];
|
|
1626
|
-
countryCode: string;
|
|
1627
|
-
merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
|
|
1628
|
-
requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
|
|
1629
|
-
};
|
|
1630
|
-
type: string;
|
|
1631
|
-
}
|
|
1632
|
-
interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata> {
|
|
1633
|
-
id: string;
|
|
1634
|
-
status: PAYMENT_INSTRUMENT_STATUS;
|
|
1635
|
-
paymentMethod: PAYMENT_METHOD_CODES;
|
|
1636
|
-
displayName?: string;
|
|
1637
|
-
data?: T;
|
|
1529
|
+
configuration?: {
|
|
1530
|
+
authFailMsg?: AuthFailedMsgOptions['configuration'];
|
|
1531
|
+
};
|
|
1638
1532
|
}
|
|
1639
|
-
interface
|
|
1640
|
-
|
|
1533
|
+
interface ContainerStyles {
|
|
1534
|
+
styles?: Partial<CSSStyleDeclaration>;
|
|
1641
1535
|
}
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
code: string;
|
|
1649
|
-
name: string;
|
|
1650
|
-
iso3: string;
|
|
1651
|
-
};
|
|
1652
|
-
};
|
|
1536
|
+
|
|
1537
|
+
interface DynamicElementOptions {
|
|
1538
|
+
styles?: DynamicElementStyles;
|
|
1539
|
+
translations?: DynamicElementTranslations;
|
|
1540
|
+
events?: PaymentEvents;
|
|
1541
|
+
paymentMethod: BasePaymentMethodConfig;
|
|
1653
1542
|
}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
'DIRECT' = "direct"
|
|
1543
|
+
interface FormConfig {
|
|
1544
|
+
schema: JSONSchemaType;
|
|
1657
1545
|
}
|
|
1658
|
-
declare
|
|
1659
|
-
|
|
1660
|
-
|
|
1546
|
+
declare class DynamicElementForm extends Tokenizable {
|
|
1547
|
+
protected options: DynamicElementOptions;
|
|
1548
|
+
protected readonly formConfig: FormConfig;
|
|
1549
|
+
private readonly returnInfo?;
|
|
1550
|
+
private formFields;
|
|
1551
|
+
private formData;
|
|
1552
|
+
private __schema;
|
|
1553
|
+
constructor(options: DynamicElementOptions, formConfig: FormConfig, returnInfo?: ReturnInfo | undefined);
|
|
1554
|
+
collect(): Promise<Record<string, any>>;
|
|
1555
|
+
protected constructSaveInstrumentBody(tokens: any, opts?: TokenizeOptions): Promise<any>;
|
|
1556
|
+
private isFormValid;
|
|
1557
|
+
mount(location: string): Promise<void>;
|
|
1558
|
+
private makeForm;
|
|
1559
|
+
private createField;
|
|
1560
|
+
private createFieldSync;
|
|
1561
|
+
private createOneOfField;
|
|
1562
|
+
private createStringField;
|
|
1563
|
+
private createFieldByType;
|
|
1564
|
+
private extractStyles;
|
|
1565
|
+
private makeFieldEvents;
|
|
1566
|
+
private evaluateDependencies;
|
|
1661
1567
|
}
|
|
1662
1568
|
|
|
1663
|
-
|
|
1569
|
+
type Operations = {
|
|
1570
|
+
deleteInstrument: OperationConfig<void, DeleteInstrumentResponse>;
|
|
1571
|
+
updateInstrument: OperationConfig<UpdateInstrumentBody, UpdateInstrumentResponse>;
|
|
1572
|
+
};
|
|
1573
|
+
interface UpdateInstrumentBody {
|
|
1574
|
+
status?: 'enabled' | 'disabled';
|
|
1575
|
+
networkTransactionReference?: string;
|
|
1576
|
+
merchantReference?: string;
|
|
1577
|
+
paymentMethod?: 'applepay' | 'card' | 'googlepay' | 'paypal';
|
|
1578
|
+
default?: boolean;
|
|
1579
|
+
}
|
|
1580
|
+
interface UpdateInstrumentResponse {
|
|
1664
1581
|
id: string;
|
|
1665
1582
|
createdAt: string;
|
|
1666
1583
|
holderId: string;
|
|
1667
|
-
paymentMethod: PAYMENT_METHOD_CODES
|
|
1584
|
+
paymentMethod: PAYMENT_METHOD_CODES;
|
|
1668
1585
|
status: PAYMENT_INSTRUMENT_STATUS;
|
|
1669
1586
|
data: {
|
|
1670
|
-
bin
|
|
1587
|
+
bin?: string;
|
|
1671
1588
|
binLookup?: {
|
|
1672
|
-
bin
|
|
1673
|
-
network
|
|
1589
|
+
bin?: string;
|
|
1590
|
+
network?: string;
|
|
1674
1591
|
issuer?: string;
|
|
1675
1592
|
issuerCountry?: {
|
|
1676
1593
|
code?: string;
|
|
@@ -1680,14 +1597,221 @@ interface SaveInstrumentResponse {
|
|
|
1680
1597
|
type?: string;
|
|
1681
1598
|
};
|
|
1682
1599
|
holderName?: string;
|
|
1683
|
-
network
|
|
1684
|
-
suffix
|
|
1600
|
+
network?: string;
|
|
1601
|
+
suffix?: string;
|
|
1685
1602
|
expiryMonth?: string;
|
|
1686
1603
|
expiryYear?: string;
|
|
1687
1604
|
};
|
|
1688
1605
|
fingerprint?: string;
|
|
1689
1606
|
futureUsage?: string;
|
|
1690
1607
|
}
|
|
1608
|
+
interface DeleteInstrumentResponse {
|
|
1609
|
+
success: boolean;
|
|
1610
|
+
}
|
|
1611
|
+
type RequestCreator<TReq, TOperation extends keyof Operations> = (config: ApiConfig<TReq> & {
|
|
1612
|
+
operation: TOperation;
|
|
1613
|
+
}) => {
|
|
1614
|
+
url: string;
|
|
1615
|
+
body?: TReq;
|
|
1616
|
+
};
|
|
1617
|
+
interface OperationConfig<TReq, TRes> {
|
|
1618
|
+
linkKey: keyof NonNullable<SdkConfiguration['links']>;
|
|
1619
|
+
method: RequestMethod;
|
|
1620
|
+
createRequest: RequestCreator<TReq, keyof Operations>;
|
|
1621
|
+
requestType: TReq;
|
|
1622
|
+
responseType: TRes;
|
|
1623
|
+
}
|
|
1624
|
+
interface ApiConfig<TReq> {
|
|
1625
|
+
operation: keyof Operations;
|
|
1626
|
+
resourceId?: string;
|
|
1627
|
+
body?: TReq;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
declare class SdkLoader {
|
|
1631
|
+
private static readonly scriptMap;
|
|
1632
|
+
static load<T = void>(sdk: ThirdPartySDK, params?: PayPalScriptConfig): Promise<T>;
|
|
1633
|
+
static reset(): void;
|
|
1634
|
+
static preloadCardForm(): void;
|
|
1635
|
+
private static loadScript;
|
|
1636
|
+
private static loadPayPalScript;
|
|
1637
|
+
private constructor();
|
|
1638
|
+
private static logLoadError;
|
|
1639
|
+
}
|
|
1640
|
+
interface PayPalScriptConfig {
|
|
1641
|
+
clientId: string;
|
|
1642
|
+
currency: string;
|
|
1643
|
+
vault: boolean;
|
|
1644
|
+
intent: 'tokenize' | 'capture' | 'authorize';
|
|
1645
|
+
}
|
|
1646
|
+
declare enum ThirdPartySDK {
|
|
1647
|
+
ApplePay = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",
|
|
1648
|
+
GooglePay = "https://pay.google.com/gp/p/js/pay.js",
|
|
1649
|
+
PayPal = "paypal-sdk"
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
interface QueryDefinition<T> {
|
|
1653
|
+
path: string[];
|
|
1654
|
+
returnType: T;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
interface ConfigurationQueryTypes {
|
|
1658
|
+
holderReference: QueryDefinition<string>;
|
|
1659
|
+
amount: QueryDefinition<PayrailsAmount>;
|
|
1660
|
+
binLookup: QueryDefinition<Links | undefined>;
|
|
1661
|
+
instrumentDelete: QueryDefinition<Links | undefined>;
|
|
1662
|
+
instrumentUpdate: QueryDefinition<Links | undefined>;
|
|
1663
|
+
executionId: QueryDefinition<string | undefined>;
|
|
1664
|
+
paymentMethodConfig: QueryDefinition<StorablePaymentCompositionOption | undefined>;
|
|
1665
|
+
paymentMethodInstruments: QueryDefinition<StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined>;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
interface InitOptions {
|
|
1669
|
+
version: string;
|
|
1670
|
+
data: string;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
interface PayrailsClientOptions {
|
|
1674
|
+
environment?: PayrailsEnvironment;
|
|
1675
|
+
events?: ClientEvents;
|
|
1676
|
+
redirectFor3DS?: boolean;
|
|
1677
|
+
returnInfo?: ReturnInfo;
|
|
1678
|
+
telemetry?: {
|
|
1679
|
+
enabled?: boolean;
|
|
1680
|
+
logLevel?: LogLevel$1;
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
declare class Payrails {
|
|
1684
|
+
private vaultClient;
|
|
1685
|
+
private options?;
|
|
1686
|
+
private __container;
|
|
1687
|
+
private __cardForm;
|
|
1688
|
+
private __cardList;
|
|
1689
|
+
private __cardPaymentButton;
|
|
1690
|
+
private __paypalButton;
|
|
1691
|
+
private __genericRedirectButton;
|
|
1692
|
+
private __dynamicElementForm;
|
|
1693
|
+
private __dropin;
|
|
1694
|
+
static preloadCardForm: typeof SdkLoader.preloadCardForm;
|
|
1695
|
+
static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
|
|
1696
|
+
update(amount: PayrailsAmount): void;
|
|
1697
|
+
collectContainer(containerOptions: CollectContainerOptions): PayrailsCollectContainer;
|
|
1698
|
+
googlePayButton(options: GooglePayButtonOptions): GooglePayButton;
|
|
1699
|
+
isGooglePayAvailable(merchantInfo: google.payments.api.MerchantInfo): Promise<boolean>;
|
|
1700
|
+
applePayButton(options: ApplePayButtonOptions): ApplePayButton;
|
|
1701
|
+
isApplePayAvailable(): Promise<boolean>;
|
|
1702
|
+
cardList(options?: CardListOptions): CardList;
|
|
1703
|
+
cardForm(options?: CardFormOptions): CardForm;
|
|
1704
|
+
dropin(options: DropinOptions): Dropin;
|
|
1705
|
+
getSavedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
|
|
1706
|
+
getSavedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1707
|
+
getSavedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1708
|
+
query<K extends keyof ConfigurationQueryTypes>(key: K, params?: Record<string, any>): ConfigurationQueryTypes[K]['returnType'] | null;
|
|
1709
|
+
api<TOperation extends keyof Operations>(config: ApiConfig<Operations[TOperation]['requestType']> & {
|
|
1710
|
+
operation: TOperation;
|
|
1711
|
+
}): Promise<Operations[TOperation]['responseType']>;
|
|
1712
|
+
getStoredInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
1713
|
+
getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
|
|
1714
|
+
paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
|
|
1715
|
+
paypalButton(options?: PaypalButtonOptions): PaypalButton;
|
|
1716
|
+
genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
|
|
1717
|
+
dynamicElement(options: DynamicElementOptions): DynamicElementForm;
|
|
1718
|
+
getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
|
|
1719
|
+
private logIntegrationMode;
|
|
1720
|
+
private constructor();
|
|
1721
|
+
private getContainerLayout;
|
|
1722
|
+
binLookup(): Promise<any>;
|
|
1723
|
+
}
|
|
1724
|
+
interface ClientEvents {
|
|
1725
|
+
onClientInitialized?: (execution?: typeof WorkflowExecution) => void;
|
|
1726
|
+
onSessionExpired?: () => Promise<InitOptions>;
|
|
1727
|
+
}
|
|
1728
|
+
interface PaymentEvents {
|
|
1729
|
+
onAuthorizeSuccess?: (e?: any) => void;
|
|
1730
|
+
onAuthorizeFailed?: (e?: any) => void;
|
|
1731
|
+
onAuthorizePending?: (e?: any) => void;
|
|
1732
|
+
onPaymentButtonClicked?: (e?: {
|
|
1733
|
+
bin?: string;
|
|
1734
|
+
}) => Promise<boolean>;
|
|
1735
|
+
onAuthorizeRequestStart?: () => Promise<boolean>;
|
|
1736
|
+
onPaymentSessionExpired?: () => void;
|
|
1737
|
+
onThreeDSecureChallenge?: () => void;
|
|
1738
|
+
}
|
|
1739
|
+
interface UIEvents {
|
|
1740
|
+
onSaveInstrumentCheckboxChanged?: ({ checked }: {
|
|
1741
|
+
checked: boolean;
|
|
1742
|
+
}) => void;
|
|
1743
|
+
onBillingAddressChanged?: (e: {
|
|
1744
|
+
isValid: boolean;
|
|
1745
|
+
billingAddress?: IAddress;
|
|
1746
|
+
}) => void;
|
|
1747
|
+
onDeliveryAddressChanged?: (data?: onDeliveryAddressChangedResponse) => Promise<boolean>;
|
|
1748
|
+
}
|
|
1749
|
+
type onPaymentMethodSelectedParams = {
|
|
1750
|
+
paymentMethod?: StorablePaymentCompositionOption;
|
|
1751
|
+
instrument?: StoredPaymentInstrument<CardMetadata & PayPalMetadata>;
|
|
1752
|
+
};
|
|
1753
|
+
interface DropinEvents {
|
|
1754
|
+
onPaymentOptionSelected?: (e: onPaymentMethodSelectedParams) => void;
|
|
1755
|
+
}
|
|
1756
|
+
type PayrailsSDKEvents = PaymentEvents & UIEvents & DropinEvents;
|
|
1757
|
+
type onDeliveryAddressChangedResponse = {
|
|
1758
|
+
deliveryAddress?: {
|
|
1759
|
+
street?: string;
|
|
1760
|
+
doorNumber?: string;
|
|
1761
|
+
complement?: string;
|
|
1762
|
+
area?: string;
|
|
1763
|
+
city?: string;
|
|
1764
|
+
postalCode?: string;
|
|
1765
|
+
state?: string;
|
|
1766
|
+
country?: {
|
|
1767
|
+
code?: string;
|
|
1768
|
+
iso3?: string;
|
|
1769
|
+
name?: string;
|
|
1770
|
+
};
|
|
1771
|
+
latitude?: number;
|
|
1772
|
+
longitude?: number;
|
|
1773
|
+
phone?: {
|
|
1774
|
+
countryCode?: string;
|
|
1775
|
+
number?: string;
|
|
1776
|
+
};
|
|
1777
|
+
name?: string;
|
|
1778
|
+
lastName?: string;
|
|
1779
|
+
email?: string;
|
|
1780
|
+
};
|
|
1781
|
+
};
|
|
1782
|
+
declare enum PayrailsEnvironment {
|
|
1783
|
+
TEST = "TEST",
|
|
1784
|
+
PRODUCTION = "PRODUCTION"
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
|
|
1788
|
+
clientDomain?: string;
|
|
1789
|
+
showPaymentMethodLogo?: boolean;
|
|
1790
|
+
events?: PaymentEvents & {
|
|
1791
|
+
onApplePayAvailable?: () => void;
|
|
1792
|
+
};
|
|
1793
|
+
styles?: {
|
|
1794
|
+
type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
|
|
1795
|
+
style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
|
|
1796
|
+
} & StoreInstrumentElementOptions['styles'];
|
|
1797
|
+
}
|
|
1798
|
+
declare global {
|
|
1799
|
+
interface Window {
|
|
1800
|
+
ApplePaySession?: ApplePaySession;
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
1804
|
+
protected options: ApplePayButtonOptions;
|
|
1805
|
+
private appleButton;
|
|
1806
|
+
private paymentExecutor;
|
|
1807
|
+
static isApplePayAvailable(): Promise<boolean>;
|
|
1808
|
+
constructor(options: ApplePayButtonOptions);
|
|
1809
|
+
mount(location: string): void;
|
|
1810
|
+
unmount(): void;
|
|
1811
|
+
private mountApplePayButton;
|
|
1812
|
+
private createApplePaySession;
|
|
1813
|
+
private onApplePayAuthorized;
|
|
1814
|
+
}
|
|
1691
1815
|
|
|
1692
1816
|
export { AuthorizationFailureReasons, ElementType, INTEGRATION_TYPE, PAYMENT_METHOD_CODES, Payrails, PayrailsEnvironment };
|
|
1693
1817
|
export type { ApplePayButtonOptions, CardFormOptions, CardListOptions, CardPaymentButtonOptions, DropinOptions, GooglePayButtonOptions, InitOptions, PaymentEvents, PaypalButtonOptions, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsSecureField, PayrailsSecureFieldEvent, SaveInstrumentResponse, WorkflowExecutionResponse };
|