@payrails/web-sdk 5.28.1 → 5.29.0
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/README.md +6 -1
- package/index.js +4 -4
- package/package.json +1 -1
- package/payrails-styles.css +71 -2
- package/payrails.d.ts +748 -601
- package/payrails.js +4 -4
package/payrails.d.ts
CHANGED
|
@@ -1,282 +1,144 @@
|
|
|
1
|
-
import * as _payrails_iframe_event_bus from '@payrails/iframe-event-bus';
|
|
2
1
|
import { LogLevel as LogLevel$1 } from '@payrails/logger';
|
|
2
|
+
import * as _payrails_iframe_event_bus from '@payrails/iframe-event-bus';
|
|
3
3
|
import { FraudProvider } from '@payrails/fraud-sdk';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
'PAYPAL' = "payPal",
|
|
9
|
-
'APPLE_PAY' = "applePay",
|
|
10
|
-
'GENERIC_REDIRECT' = "genericRedirect",
|
|
11
|
-
'MERCADO_PAGO' = "mercadoPago",
|
|
12
|
-
'PIX' = "pix"
|
|
5
|
+
interface Mountable {
|
|
6
|
+
mount(selector: string | PayrailsElement): void;
|
|
7
|
+
unmount(): void;
|
|
13
8
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'INVALID' = "invalid",
|
|
20
|
-
'TRANSIENT' = "transient"
|
|
9
|
+
interface ElementOptions {
|
|
10
|
+
id?: string;
|
|
11
|
+
dataTestId?: string;
|
|
12
|
+
className?: string | string[];
|
|
13
|
+
styles?: Partial<CSSStyleDeclaration>;
|
|
21
14
|
}
|
|
22
|
-
declare class
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} | undefined;
|
|
42
|
-
static get holderReference(): string;
|
|
43
|
-
static get savedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
|
|
44
|
-
static get savedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
|
|
45
|
-
static get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
46
|
-
static get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
47
|
-
static get paypalConfig(): PayPalConfig;
|
|
48
|
-
static get googlePayConfig(): GooglePayConfig[];
|
|
49
|
-
static isPaymentMethodAvailable(paymentMethod: PAYMENT_METHOD_CODES): boolean;
|
|
50
|
-
static get applePayConfig(): {
|
|
51
|
-
merchantIdentifier: string;
|
|
52
|
-
supportedNetworks: string[];
|
|
53
|
-
countryCode: string;
|
|
54
|
-
merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
|
|
55
|
-
requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
|
|
15
|
+
declare class PayrailsElement implements Mountable {
|
|
16
|
+
protected element: HTMLElement;
|
|
17
|
+
protected subElements: Array<Mountable>;
|
|
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;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface IAddress {
|
|
30
|
+
country?: {
|
|
31
|
+
code?: string;
|
|
32
|
+
fullName?: string;
|
|
33
|
+
iso3?: string;
|
|
56
34
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
35
|
+
postalCode?: string;
|
|
36
|
+
}
|
|
37
|
+
interface IOnChange {
|
|
38
|
+
isValid: boolean;
|
|
39
|
+
billingAddress?: IAddress;
|
|
40
|
+
}
|
|
41
|
+
interface AddressSelectorElementOptions extends ElementOptions {
|
|
42
|
+
translations?: {
|
|
43
|
+
labels?: {
|
|
44
|
+
countrySelector?: string;
|
|
45
|
+
postalCodeInput?: string;
|
|
63
46
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
code?: string;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
47
|
+
placeholders?: {
|
|
48
|
+
postalCodeInput?: string;
|
|
49
|
+
countrySelector?: string;
|
|
70
50
|
};
|
|
71
51
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
static isAddressSelectorEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
|
|
79
|
-
static isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
|
|
80
|
-
static getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
|
|
81
|
-
static getStoredInstrumentForPaymentMethod<T = CardMetadata | PayPalMetadata>(paymentMethod: PAYMENT_METHOD_CODES): Array<StoredPaymentInstrument<T>>;
|
|
82
|
-
static getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
|
|
83
|
-
id: string;
|
|
84
|
-
description?: string;
|
|
85
|
-
status: PAYMENT_INSTRUMENT_STATUS;
|
|
86
|
-
integrationType: INTEGRATION_TYPE;
|
|
87
|
-
config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
|
|
88
|
-
clientConfig?: {
|
|
89
|
-
flow?: PAYMENT_CLIENT_FLOW;
|
|
90
|
-
supportsInstallments?: boolean;
|
|
91
|
-
installments?: PaymentInstallmentsConfig;
|
|
92
|
-
supportsBillingInfo?: boolean;
|
|
52
|
+
styles?: {
|
|
53
|
+
wrapper?: Partial<CSSStyleDeclaration>;
|
|
54
|
+
countrySelector?: {
|
|
55
|
+
wrapper?: Partial<CSSStyleDeclaration>;
|
|
56
|
+
element?: Partial<CSSStyleDeclaration>;
|
|
57
|
+
label?: Partial<CSSStyleDeclaration>;
|
|
93
58
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
description?: string;
|
|
99
|
-
status: PAYMENT_INSTRUMENT_STATUS;
|
|
100
|
-
integrationType: INTEGRATION_TYPE;
|
|
101
|
-
config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
|
|
102
|
-
clientConfig?: {
|
|
103
|
-
flow?: PAYMENT_CLIENT_FLOW;
|
|
104
|
-
supportsInstallments?: boolean;
|
|
105
|
-
installments?: PaymentInstallmentsConfig;
|
|
106
|
-
supportsBillingInfo?: boolean;
|
|
59
|
+
postalCodeInput?: {
|
|
60
|
+
wrapper?: Partial<CSSStyleDeclaration>;
|
|
61
|
+
element?: Partial<CSSStyleDeclaration>;
|
|
62
|
+
label?: Partial<CSSStyleDeclaration>;
|
|
107
63
|
};
|
|
108
|
-
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
109
64
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
id: string;
|
|
113
|
-
merchantReference: string;
|
|
114
|
-
holderReference: string;
|
|
115
|
-
actionRequired?: string;
|
|
116
|
-
meta: {
|
|
117
|
-
customer?: {
|
|
118
|
-
country?: {
|
|
119
|
-
code?: string;
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
order?: {
|
|
123
|
-
billingAddress?: {
|
|
124
|
-
country?: {
|
|
125
|
-
code?: string;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
};
|
|
65
|
+
events?: {
|
|
66
|
+
onBillingAddressChanged?: (e: IOnChange) => void;
|
|
129
67
|
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
links: {
|
|
141
|
-
authorize: {
|
|
142
|
-
href: string;
|
|
143
|
-
method: 'POST';
|
|
144
|
-
};
|
|
145
|
-
execution: string;
|
|
146
|
-
};
|
|
147
|
-
name: 'lookup';
|
|
148
|
-
};
|
|
149
|
-
}>;
|
|
150
|
-
links: {
|
|
151
|
-
startPaymentSession?: {
|
|
152
|
-
href: string;
|
|
153
|
-
method: 'POST';
|
|
154
|
-
};
|
|
155
|
-
confirm?: {
|
|
156
|
-
href: string;
|
|
157
|
-
action?: {
|
|
158
|
-
parameters?: {
|
|
159
|
-
orderId?: string;
|
|
160
|
-
tokenId?: string;
|
|
161
|
-
};
|
|
162
|
-
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface StoreInstrumentElementOptions extends ElementOptions {
|
|
71
|
+
showStoreInstrumentCheckbox?: boolean;
|
|
72
|
+
alwaysStoreInstrument?: boolean;
|
|
73
|
+
defaultStoreInstrumentState?: 'checked' | 'unchecked';
|
|
74
|
+
translations?: {
|
|
75
|
+
labels?: {
|
|
76
|
+
storeInstrument?: string;
|
|
77
|
+
saveInstrument?: string;
|
|
163
78
|
};
|
|
164
|
-
redirect?: string;
|
|
165
|
-
'3ds'?: string;
|
|
166
|
-
self: string;
|
|
167
79
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
version: number;
|
|
80
|
+
styles?: {
|
|
81
|
+
storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
|
|
171
82
|
};
|
|
83
|
+
events?: PayrailsSDKEvents;
|
|
172
84
|
}
|
|
173
|
-
|
|
174
|
-
|
|
85
|
+
declare class StoreInstrumentCheckbox extends PayrailsElement {
|
|
86
|
+
private options;
|
|
87
|
+
constructor(options: StoreInstrumentElementOptions);
|
|
88
|
+
get isChecked(): boolean;
|
|
89
|
+
private createHTML;
|
|
90
|
+
private applyStyles;
|
|
91
|
+
private addListeners;
|
|
175
92
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
93
|
+
declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
|
|
94
|
+
protected options?: StoreInstrumentElementOptions | undefined;
|
|
95
|
+
protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
|
|
96
|
+
protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
|
|
97
|
+
protected get shouldStoreInstrument(): boolean;
|
|
179
98
|
}
|
|
180
|
-
|
|
181
|
-
|
|
99
|
+
|
|
100
|
+
interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
|
|
101
|
+
clientDomain?: string;
|
|
102
|
+
showPaymentMethodLogo?: boolean;
|
|
103
|
+
events?: PaymentEvents & {
|
|
104
|
+
onApplePayAvailable?: () => void;
|
|
105
|
+
};
|
|
106
|
+
styles?: {
|
|
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'];
|
|
182
110
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
integrationType: INTEGRATION_TYPE;
|
|
188
|
-
config: C;
|
|
189
|
-
clientConfig?: {
|
|
190
|
-
flow?: PAYMENT_CLIENT_FLOW;
|
|
191
|
-
supportsInstallments?: boolean;
|
|
192
|
-
installments?: PaymentInstallmentsConfig;
|
|
193
|
-
supportsBillingInfo?: boolean;
|
|
194
|
-
};
|
|
195
|
-
paymentInstruments?: Array<StoredPaymentInstrument<I>>;
|
|
196
|
-
}
|
|
197
|
-
interface GooglePayConfig {
|
|
198
|
-
parameters: {
|
|
199
|
-
allowedAuthMethods: google.payments.api.CardAuthMethod[];
|
|
200
|
-
allowedCardNetworks: google.payments.api.CardNetwork[];
|
|
201
|
-
};
|
|
202
|
-
tokenizationSpecification: google.payments.api.PaymentMethodTokenizationSpecification;
|
|
203
|
-
type: google.payments.api.PaymentMethodType;
|
|
204
|
-
}
|
|
205
|
-
interface PayPalConfig {
|
|
206
|
-
clientId: string;
|
|
207
|
-
merchantId: string;
|
|
208
|
-
captureMode: 'Delayed' | 'Instant' | 'Manual';
|
|
209
|
-
integrationMode: 'express' | 'normal';
|
|
210
|
-
}
|
|
211
|
-
interface ApplePayConfig {
|
|
212
|
-
parameters: {
|
|
213
|
-
merchantIdentifier: string;
|
|
214
|
-
supportedNetworks: string[];
|
|
215
|
-
countryCode: string;
|
|
216
|
-
merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
|
|
217
|
-
requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
|
|
218
|
-
};
|
|
219
|
-
type: string;
|
|
220
|
-
}
|
|
221
|
-
interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata> {
|
|
222
|
-
id: string;
|
|
223
|
-
status: PAYMENT_INSTRUMENT_STATUS;
|
|
224
|
-
paymentMethod: PAYMENT_METHOD_CODES;
|
|
225
|
-
displayName?: string;
|
|
226
|
-
data?: T;
|
|
227
|
-
}
|
|
228
|
-
interface PayPalMetadata {
|
|
229
|
-
email?: string;
|
|
230
|
-
}
|
|
231
|
-
interface CardMetadata {
|
|
232
|
-
bin?: string;
|
|
233
|
-
suffix?: string;
|
|
234
|
-
network?: string;
|
|
235
|
-
binLookup?: {
|
|
236
|
-
issuerCountry: {
|
|
237
|
-
code: string;
|
|
238
|
-
name: string;
|
|
239
|
-
iso3: string;
|
|
240
|
-
};
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
declare enum PAYMENT_CLIENT_FLOW {
|
|
244
|
-
'REDIRECT' = "redirect",
|
|
245
|
-
'DIRECT' = "direct"
|
|
111
|
+
declare global {
|
|
112
|
+
interface Window {
|
|
113
|
+
ApplePaySession?: ApplePaySession;
|
|
114
|
+
}
|
|
246
115
|
}
|
|
247
|
-
declare
|
|
248
|
-
|
|
249
|
-
|
|
116
|
+
declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
117
|
+
protected options: ApplePayButtonOptions;
|
|
118
|
+
private appleButton;
|
|
119
|
+
private paymentExecutor;
|
|
120
|
+
static isApplePayAvailable(): Promise<boolean>;
|
|
121
|
+
constructor(options: ApplePayButtonOptions);
|
|
122
|
+
mount(location: string): void;
|
|
123
|
+
unmount(): void;
|
|
124
|
+
private mountApplePayButton;
|
|
125
|
+
private createApplePaySession;
|
|
126
|
+
private onApplePayAuthorized;
|
|
250
127
|
}
|
|
251
128
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
code?: string;
|
|
266
|
-
name?: string;
|
|
267
|
-
iso3?: string;
|
|
268
|
-
};
|
|
269
|
-
type?: string;
|
|
270
|
-
};
|
|
271
|
-
holderName?: string;
|
|
272
|
-
network: string;
|
|
273
|
-
suffix: string;
|
|
274
|
-
expiryMonth?: string;
|
|
275
|
-
expiryYear?: string;
|
|
276
|
-
};
|
|
277
|
-
fingerprint?: string;
|
|
278
|
-
futureUsage?: string;
|
|
279
|
-
}
|
|
129
|
+
declare const regexes: {
|
|
130
|
+
visa: RegExp;
|
|
131
|
+
mastercard: RegExp;
|
|
132
|
+
amex: RegExp;
|
|
133
|
+
diners: RegExp;
|
|
134
|
+
discover: RegExp;
|
|
135
|
+
jcb: RegExp;
|
|
136
|
+
hipercard: RegExp;
|
|
137
|
+
unionpay: RegExp;
|
|
138
|
+
maestro: RegExp;
|
|
139
|
+
elo: RegExp;
|
|
140
|
+
};
|
|
141
|
+
type CardNetwork = keyof typeof regexes;
|
|
280
142
|
|
|
281
143
|
interface BinLookupResponse {
|
|
282
144
|
bin: string;
|
|
@@ -453,6 +315,10 @@ declare class ComposableElement {
|
|
|
453
315
|
update: (options: any) => void;
|
|
454
316
|
}
|
|
455
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Configuration interface for creating collect elements
|
|
320
|
+
* Defines the structure and styling options for form input elements
|
|
321
|
+
*/
|
|
456
322
|
interface CollectElementInput {
|
|
457
323
|
table?: string;
|
|
458
324
|
column?: string;
|
|
@@ -466,23 +332,116 @@ interface CollectElementInput {
|
|
|
466
332
|
validations?: IValidationRule[];
|
|
467
333
|
skyflowID?: string;
|
|
468
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Options interface for the collect operation
|
|
337
|
+
* Controls how data is collected and processed
|
|
338
|
+
*/
|
|
469
339
|
interface ICollectOptions {
|
|
470
340
|
tokens?: boolean;
|
|
471
341
|
additionalFields?: IInsertRecordInput;
|
|
472
342
|
upsert?: Array<IUpsertOptions>;
|
|
473
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* ComposableContainer class - Main container for managing secure form elements
|
|
346
|
+
*
|
|
347
|
+
* This class extends the base Container and provides functionality to:
|
|
348
|
+
* - Create and manage secure iframe-based form elements
|
|
349
|
+
* - Handle secure communication between parent and iframe contexts
|
|
350
|
+
* - Collect and tokenize sensitive data while maintaining PCI compliance
|
|
351
|
+
* - Manage element lifecycle (create, mount, validate, collect, destroy)
|
|
352
|
+
*/
|
|
474
353
|
declare class ComposableContainer extends Container {
|
|
475
354
|
#private;
|
|
476
355
|
type: string;
|
|
477
356
|
private bus;
|
|
478
357
|
private iframe;
|
|
358
|
+
/**
|
|
359
|
+
* Constructor - Initializes the composable container
|
|
360
|
+
*
|
|
361
|
+
* Sets up the secure iframe, establishes communication channels,
|
|
362
|
+
* and prepares the container for element creation and management.
|
|
363
|
+
*
|
|
364
|
+
* @param options - Container configuration (layout, styles, etc.)
|
|
365
|
+
* @param metaData - Client metadata and configuration
|
|
366
|
+
* @param skyflowElements - Global elements registry
|
|
367
|
+
* @param context - Application context with logging and config
|
|
368
|
+
*/
|
|
479
369
|
constructor(options: any, metaData: any, skyflowElements: any, context: any);
|
|
370
|
+
/**
|
|
371
|
+
* Creates a new composable form element
|
|
372
|
+
*
|
|
373
|
+
* This method creates a secure form element (like card number, CVV, etc.)
|
|
374
|
+
* that will be rendered inside the secure iframe. The element is added to
|
|
375
|
+
* the container's element list but not yet mounted to the DOM.
|
|
376
|
+
*
|
|
377
|
+
* @param input - Element configuration (type, styles, validations, etc.)
|
|
378
|
+
* @param options - Additional options like required field validation
|
|
379
|
+
* @returns ComposableElement instance for further configuration
|
|
380
|
+
*/
|
|
480
381
|
create: (input: CollectElementInput, options?: any) => ComposableElement;
|
|
382
|
+
/**
|
|
383
|
+
* Registers an event listener for container events
|
|
384
|
+
*
|
|
385
|
+
* Allows the application to listen for events like form submission,
|
|
386
|
+
* validation errors, or other container-level events.
|
|
387
|
+
*
|
|
388
|
+
* @param eventName - The name of the event to listen for
|
|
389
|
+
* @param handler - The callback function to execute when the event occurs
|
|
390
|
+
*/
|
|
481
391
|
on: (eventName: string, handler: any) => void;
|
|
392
|
+
/**
|
|
393
|
+
* Mounts the container and its elements to a DOM element
|
|
394
|
+
*
|
|
395
|
+
* This method organizes the created elements according to the specified layout,
|
|
396
|
+
* applies styling, and renders them within the provided DOM element.
|
|
397
|
+
* The elements are rendered inside secure iframes for PCI compliance.
|
|
398
|
+
*
|
|
399
|
+
* @param domElement - The DOM element where the form should be mounted
|
|
400
|
+
*/
|
|
482
401
|
mount: (domElement: any) => void;
|
|
402
|
+
/**
|
|
403
|
+
* Mounts the container element to the DOM and triggers a mounted event
|
|
404
|
+
*
|
|
405
|
+
* This method mounts the container element to the specified DOM element
|
|
406
|
+
* and then emits an event to notify the SDK that the container has been mounted.
|
|
407
|
+
*
|
|
408
|
+
* @param domElement - The DOM element where the container should be mounted
|
|
409
|
+
*/
|
|
410
|
+
mountContainerElement: (domElement: string) => void;
|
|
411
|
+
/**
|
|
412
|
+
* Unmounts the container and cleans up all resources
|
|
413
|
+
*
|
|
414
|
+
* This method removes all elements from the DOM, clears internal state,
|
|
415
|
+
* and removes the iframe to prevent memory leaks.
|
|
416
|
+
*/
|
|
483
417
|
unmount: () => void;
|
|
418
|
+
/**
|
|
419
|
+
* Validates all elements in the container
|
|
420
|
+
*
|
|
421
|
+
* Checks that all elements are mounted and triggers validation
|
|
422
|
+
* in the secure iframe. Returns a promise that resolves with
|
|
423
|
+
* validation results.
|
|
424
|
+
*
|
|
425
|
+
* @returns Promise that resolves with validation results
|
|
426
|
+
*/
|
|
484
427
|
validate: () => Promise<unknown>;
|
|
428
|
+
/**
|
|
429
|
+
* Collects data from all elements in the container
|
|
430
|
+
*
|
|
431
|
+
* This method securely collects sensitive data from all mounted elements,
|
|
432
|
+
* validates the data, and optionally tokenizes it. The actual data collection
|
|
433
|
+
* happens within the secure iframe to maintain PCI compliance.
|
|
434
|
+
*
|
|
435
|
+
* @param options - Collection options (tokenization, additional fields, etc.)
|
|
436
|
+
* @returns Promise that resolves with collected/tokenized data
|
|
437
|
+
*/
|
|
485
438
|
collect: (options?: ICollectOptions) => Promise<unknown>;
|
|
439
|
+
/**
|
|
440
|
+
* Resets all form elements to their initial state
|
|
441
|
+
*
|
|
442
|
+
* Clears all input values and resets validation states
|
|
443
|
+
* by sending a reset command to the secure iframe.
|
|
444
|
+
*/
|
|
486
445
|
reset(): void;
|
|
487
446
|
}
|
|
488
447
|
|
|
@@ -512,30 +471,6 @@ declare class Skyflow {
|
|
|
512
471
|
static get ValidationRuleType(): typeof ValidationRuleType;
|
|
513
472
|
}
|
|
514
473
|
|
|
515
|
-
interface Mountable {
|
|
516
|
-
mount(selector: string | PayrailsElement): void;
|
|
517
|
-
unmount(): void;
|
|
518
|
-
}
|
|
519
|
-
interface ElementOptions {
|
|
520
|
-
id?: string;
|
|
521
|
-
dataTestId?: string;
|
|
522
|
-
className?: string | string[];
|
|
523
|
-
styles?: Partial<CSSStyleDeclaration>;
|
|
524
|
-
}
|
|
525
|
-
declare class PayrailsElement implements Mountable {
|
|
526
|
-
protected element: HTMLElement;
|
|
527
|
-
protected subElements: Array<Mountable>;
|
|
528
|
-
readonly id: string | undefined;
|
|
529
|
-
readonly dataTestId: string | undefined;
|
|
530
|
-
protected eventBus: _payrails_iframe_event_bus.IframeEventBus;
|
|
531
|
-
constructor(elementType: string, { id, className, dataTestId }?: ElementOptions);
|
|
532
|
-
get parentElement(): HTMLElement | null;
|
|
533
|
-
get selector(): string;
|
|
534
|
-
mount(location: string): void;
|
|
535
|
-
protected clean(): void;
|
|
536
|
-
unmount(): void;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
474
|
declare enum ElementType {
|
|
540
475
|
CARD_NUMBER = "CARD_NUMBER",
|
|
541
476
|
CARDHOLDER_NAME = "CARDHOLDER_NAME",
|
|
@@ -564,6 +499,11 @@ interface CollectElementOptions {
|
|
|
564
499
|
errorTextStyles?: object;
|
|
565
500
|
required?: boolean;
|
|
566
501
|
enableCardIcon?: boolean;
|
|
502
|
+
translations?: {
|
|
503
|
+
error?: {
|
|
504
|
+
default?: string;
|
|
505
|
+
};
|
|
506
|
+
};
|
|
567
507
|
}
|
|
568
508
|
type PayrailsContainerType = 'COLLECT' | 'COMPOSABLE';
|
|
569
509
|
interface CollectContainerOptions {
|
|
@@ -595,11 +535,14 @@ interface PayrailsSecureField {
|
|
|
595
535
|
resetError?: () => void;
|
|
596
536
|
setValue?: (elementValue: string) => void;
|
|
597
537
|
clearValue?: () => void;
|
|
538
|
+
update?: (data: Partial<CollectElementOptions>) => void;
|
|
598
539
|
}
|
|
599
540
|
declare class PayrailsCollectContainer implements Mountable {
|
|
600
541
|
bin: string;
|
|
601
542
|
isBinLookupEnabled: boolean;
|
|
602
543
|
readonly id = "payrails-container-wrapper";
|
|
544
|
+
readonly dataTestId = "payrails-container-wrapper";
|
|
545
|
+
readonly className = "payrails-container-wrapper";
|
|
603
546
|
private static instance;
|
|
604
547
|
private readonly __container;
|
|
605
548
|
private element;
|
|
@@ -628,61 +571,6 @@ interface TokenizeOptions {
|
|
|
628
571
|
storeInstrument?: boolean;
|
|
629
572
|
}
|
|
630
573
|
|
|
631
|
-
interface IAddress {
|
|
632
|
-
country?: {
|
|
633
|
-
code?: string;
|
|
634
|
-
fullName?: string;
|
|
635
|
-
iso3?: string;
|
|
636
|
-
};
|
|
637
|
-
postalCode?: string;
|
|
638
|
-
}
|
|
639
|
-
interface IOnChange {
|
|
640
|
-
isValid: boolean;
|
|
641
|
-
billingAddress?: IAddress;
|
|
642
|
-
}
|
|
643
|
-
interface AddressSelectorElementOptions extends ElementOptions {
|
|
644
|
-
translations?: {
|
|
645
|
-
labels?: {
|
|
646
|
-
countrySelector?: string;
|
|
647
|
-
postalCodeInput?: string;
|
|
648
|
-
};
|
|
649
|
-
placeholders?: {
|
|
650
|
-
postalCodeInput?: string;
|
|
651
|
-
countrySelector?: string;
|
|
652
|
-
};
|
|
653
|
-
};
|
|
654
|
-
styles?: {
|
|
655
|
-
wrapper?: Partial<CSSStyleDeclaration>;
|
|
656
|
-
countrySelector?: {
|
|
657
|
-
wrapper?: Partial<CSSStyleDeclaration>;
|
|
658
|
-
element?: Partial<CSSStyleDeclaration>;
|
|
659
|
-
label?: Partial<CSSStyleDeclaration>;
|
|
660
|
-
};
|
|
661
|
-
postalCodeInput?: {
|
|
662
|
-
wrapper?: Partial<CSSStyleDeclaration>;
|
|
663
|
-
element?: Partial<CSSStyleDeclaration>;
|
|
664
|
-
label?: Partial<CSSStyleDeclaration>;
|
|
665
|
-
};
|
|
666
|
-
};
|
|
667
|
-
events?: {
|
|
668
|
-
onBillingAddressChanged?: (e: IOnChange) => void;
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
declare const regexes: {
|
|
673
|
-
visa: RegExp;
|
|
674
|
-
mastercard: RegExp;
|
|
675
|
-
amex: RegExp;
|
|
676
|
-
diners: RegExp;
|
|
677
|
-
discover: RegExp;
|
|
678
|
-
jcb: RegExp;
|
|
679
|
-
hipercard: RegExp;
|
|
680
|
-
unionpay: RegExp;
|
|
681
|
-
maestro: RegExp;
|
|
682
|
-
elo: RegExp;
|
|
683
|
-
};
|
|
684
|
-
type CardNetwork = keyof typeof regexes;
|
|
685
|
-
|
|
686
574
|
interface PaymentInstallmentsElementOptions extends ElementOptions {
|
|
687
575
|
showPaymentInstallmentsDropdown?: boolean;
|
|
688
576
|
installmentOptions?: BaseInstallmentOption[] | null;
|
|
@@ -720,36 +608,6 @@ declare class PayrailsElementWithPaymentInstallmentsDropdown extends PayrailsEle
|
|
|
720
608
|
setDisabled(state: boolean): void;
|
|
721
609
|
}
|
|
722
610
|
|
|
723
|
-
interface StoreInstrumentElementOptions extends ElementOptions {
|
|
724
|
-
showStoreInstrumentCheckbox?: boolean;
|
|
725
|
-
alwaysStoreInstrument?: boolean;
|
|
726
|
-
defaultStoreInstrumentState?: 'checked' | 'unchecked';
|
|
727
|
-
translations?: {
|
|
728
|
-
labels?: {
|
|
729
|
-
storeInstrument?: string;
|
|
730
|
-
saveInstrument?: string;
|
|
731
|
-
};
|
|
732
|
-
};
|
|
733
|
-
styles?: {
|
|
734
|
-
storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
|
|
735
|
-
};
|
|
736
|
-
events?: PayrailsSDKEvents;
|
|
737
|
-
}
|
|
738
|
-
declare class StoreInstrumentCheckbox extends PayrailsElement {
|
|
739
|
-
private options;
|
|
740
|
-
constructor(options: StoreInstrumentElementOptions);
|
|
741
|
-
get isChecked(): boolean;
|
|
742
|
-
private createHTML;
|
|
743
|
-
private applyStyles;
|
|
744
|
-
private addListeners;
|
|
745
|
-
}
|
|
746
|
-
declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
|
|
747
|
-
protected options?: StoreInstrumentElementOptions | undefined;
|
|
748
|
-
protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
|
|
749
|
-
protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
|
|
750
|
-
protected get shouldStoreInstrument(): boolean;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
611
|
interface OnChange {
|
|
754
612
|
isValid: boolean;
|
|
755
613
|
cardNetwork: CardNetwork | '';
|
|
@@ -814,9 +672,14 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
|
814
672
|
private throttledFetchBinLookup;
|
|
815
673
|
private lastBin;
|
|
816
674
|
private lastBinLookup;
|
|
675
|
+
private defaultStyles;
|
|
676
|
+
private defaultTranslations;
|
|
817
677
|
constructor(collectContainer: PayrailsCollectContainer, options?: CardFormOptions | undefined);
|
|
818
678
|
private initializeFormFields;
|
|
819
679
|
getErrorTextStyles(errorTextStyles: any): any;
|
|
680
|
+
private updateStyles;
|
|
681
|
+
private updateTranslations;
|
|
682
|
+
update(options: Partial<Pick<CardFormOptions, 'styles' | 'translations'>>): void;
|
|
820
683
|
private createFormField;
|
|
821
684
|
private initializeCustomLayout;
|
|
822
685
|
private hasFieldBeenUsed;
|
|
@@ -829,8 +692,9 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
|
829
692
|
reset?: boolean;
|
|
830
693
|
}): void;
|
|
831
694
|
private triggerOnReady;
|
|
695
|
+
private prepareErrorStyles;
|
|
832
696
|
private prepareLabelStyles;
|
|
833
|
-
|
|
697
|
+
prepareInputStyles(styles: CardFieldStyles, type: ElementType): CardFieldStyles;
|
|
834
698
|
validate(): Promise<{
|
|
835
699
|
isValid: boolean;
|
|
836
700
|
errors: string;
|
|
@@ -854,6 +718,8 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
|
854
718
|
bin: string;
|
|
855
719
|
}>;
|
|
856
720
|
private getinstallmentOptions;
|
|
721
|
+
unmount(): void;
|
|
722
|
+
mount(selector: string): void;
|
|
857
723
|
}
|
|
858
724
|
interface LabelStyles {
|
|
859
725
|
base?: Partial<CSSStyleDeclaration>;
|
|
@@ -949,6 +815,7 @@ declare class CardPaymentButton extends PayrailsElement {
|
|
|
949
815
|
private readonly returnInfo?;
|
|
950
816
|
selectedInstrument: StoredPaymentInstrument | null;
|
|
951
817
|
paymentInstallmentElement: PayrailsElementWithPaymentInstallmentsDropdown | null;
|
|
818
|
+
private isLoading;
|
|
952
819
|
get bin(): string | undefined;
|
|
953
820
|
private readonly paymentExecutor;
|
|
954
821
|
private cardForm;
|
|
@@ -966,6 +833,9 @@ declare class CardPaymentButton extends PayrailsElement {
|
|
|
966
833
|
private onAuthorizationFailed;
|
|
967
834
|
private onPay;
|
|
968
835
|
private constructEncryptedPayment;
|
|
836
|
+
private updateStyles;
|
|
837
|
+
private updateTranslations;
|
|
838
|
+
update(options: Partial<Pick<CardPaymentButtonOptions, 'styles' | 'translations'>>): void;
|
|
969
839
|
private handleAuthorizationResult;
|
|
970
840
|
}
|
|
971
841
|
declare enum AuthorizationFailureReasons {
|
|
@@ -1074,7 +944,6 @@ interface ButtonOptions {
|
|
|
1074
944
|
hover?: Partial<CSSStyleDeclaration>;
|
|
1075
945
|
};
|
|
1076
946
|
}
|
|
1077
|
-
|
|
1078
947
|
interface GenericRedirectButtonOptions {
|
|
1079
948
|
styles?: ButtonOptions['styles'];
|
|
1080
949
|
translations?: {
|
|
@@ -1086,14 +955,24 @@ interface GenericRedirectButtonOptions {
|
|
|
1086
955
|
declare class GenericRedirectButton extends PayrailsElement {
|
|
1087
956
|
protected options: GenericRedirectButtonOptions;
|
|
1088
957
|
private readonly returnInfo?;
|
|
1089
|
-
constructor(options: GenericRedirectButtonOptions, returnInfo?: ReturnInfo | undefined);
|
|
1090
958
|
private popup;
|
|
1091
|
-
private buildRedirectButton;
|
|
1092
959
|
private readonly paymentExecutor;
|
|
960
|
+
private isDisabled;
|
|
961
|
+
private isLoading;
|
|
962
|
+
constructor(options: GenericRedirectButtonOptions, returnInfo?: ReturnInfo | undefined);
|
|
963
|
+
private setStyles;
|
|
964
|
+
private removeStyles;
|
|
965
|
+
private triggerLoading;
|
|
1093
966
|
private onClick;
|
|
1094
967
|
private handleAuthorizationResult;
|
|
1095
968
|
private createPopupWithTimeout;
|
|
1096
969
|
private redirectToPaymentLink;
|
|
970
|
+
private updateStyles;
|
|
971
|
+
private updateTranslations;
|
|
972
|
+
update(options: {
|
|
973
|
+
styles?: ButtonOptions['styles'];
|
|
974
|
+
translations?: ButtonOptions['translations'];
|
|
975
|
+
}): void;
|
|
1097
976
|
}
|
|
1098
977
|
|
|
1099
978
|
interface GenericRedirectDropinOptions {
|
|
@@ -1201,6 +1080,7 @@ declare class Dropin extends PayrailsElement {
|
|
|
1201
1080
|
private loadingScreen;
|
|
1202
1081
|
constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions);
|
|
1203
1082
|
private isHppIntegration;
|
|
1083
|
+
private isGenericDirect;
|
|
1204
1084
|
private createStoredInstrumentElement;
|
|
1205
1085
|
private createInstallmentsDropdown;
|
|
1206
1086
|
private getInstallmentOptionsForInstrument;
|
|
@@ -1212,6 +1092,7 @@ declare class Dropin extends PayrailsElement {
|
|
|
1212
1092
|
private createCardForm;
|
|
1213
1093
|
private createApplePayButton;
|
|
1214
1094
|
private createCardPaymentButton;
|
|
1095
|
+
private createGenericDirectElement;
|
|
1215
1096
|
private onAuthorizeSuccess;
|
|
1216
1097
|
private getElementEvents;
|
|
1217
1098
|
private onAuthorizePending;
|
|
@@ -1287,39 +1168,509 @@ interface DropinOptions {
|
|
|
1287
1168
|
authFailMsg?: AuthFailedMsgOptions['configuration'];
|
|
1288
1169
|
};
|
|
1289
1170
|
}
|
|
1290
|
-
interface ContainerStyles {
|
|
1291
|
-
styles?: Partial<CSSStyleDeclaration>;
|
|
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;
|
|
1638
|
+
}
|
|
1639
|
+
interface PayPalMetadata {
|
|
1640
|
+
email?: string;
|
|
1641
|
+
}
|
|
1642
|
+
interface CardMetadata {
|
|
1643
|
+
bin?: string;
|
|
1644
|
+
suffix?: string;
|
|
1645
|
+
network?: string;
|
|
1646
|
+
binLookup?: {
|
|
1647
|
+
issuerCountry: {
|
|
1648
|
+
code: string;
|
|
1649
|
+
name: string;
|
|
1650
|
+
iso3: string;
|
|
1651
|
+
};
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
declare enum PAYMENT_CLIENT_FLOW {
|
|
1655
|
+
'REDIRECT' = "redirect",
|
|
1656
|
+
'DIRECT' = "direct"
|
|
1292
1657
|
}
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
POST = "POST",
|
|
1297
|
-
DELETE = "DELETE",
|
|
1298
|
-
PATCH = "PATCH"
|
|
1658
|
+
declare enum INTEGRATION_TYPE {
|
|
1659
|
+
API = "api",
|
|
1660
|
+
HPP = "hpp"
|
|
1299
1661
|
}
|
|
1300
1662
|
|
|
1301
|
-
|
|
1302
|
-
deleteInstrument: OperationConfig<void, DeleteInstrumentResponse>;
|
|
1303
|
-
updateInstrument: OperationConfig<UpdateInstrumentBody, UpdateInstrumentResponse>;
|
|
1304
|
-
};
|
|
1305
|
-
interface UpdateInstrumentBody {
|
|
1306
|
-
status?: 'enabled' | 'disabled';
|
|
1307
|
-
networkTransactionReference?: string;
|
|
1308
|
-
merchantReference?: string;
|
|
1309
|
-
paymentMethod?: 'applepay' | 'card' | 'googlepay' | 'paypal';
|
|
1310
|
-
default?: boolean;
|
|
1311
|
-
}
|
|
1312
|
-
interface UpdateInstrumentResponse {
|
|
1663
|
+
interface SaveInstrumentResponse {
|
|
1313
1664
|
id: string;
|
|
1314
1665
|
createdAt: string;
|
|
1315
1666
|
holderId: string;
|
|
1316
|
-
paymentMethod: PAYMENT_METHOD_CODES;
|
|
1667
|
+
paymentMethod: PAYMENT_METHOD_CODES.CARD;
|
|
1317
1668
|
status: PAYMENT_INSTRUMENT_STATUS;
|
|
1318
1669
|
data: {
|
|
1319
|
-
bin
|
|
1670
|
+
bin: string;
|
|
1320
1671
|
binLookup?: {
|
|
1321
|
-
bin
|
|
1322
|
-
network
|
|
1672
|
+
bin: string;
|
|
1673
|
+
network: string;
|
|
1323
1674
|
issuer?: string;
|
|
1324
1675
|
issuerCountry?: {
|
|
1325
1676
|
code?: string;
|
|
@@ -1329,218 +1680,14 @@ interface UpdateInstrumentResponse {
|
|
|
1329
1680
|
type?: string;
|
|
1330
1681
|
};
|
|
1331
1682
|
holderName?: string;
|
|
1332
|
-
network
|
|
1333
|
-
suffix
|
|
1683
|
+
network: string;
|
|
1684
|
+
suffix: string;
|
|
1334
1685
|
expiryMonth?: string;
|
|
1335
1686
|
expiryYear?: string;
|
|
1336
1687
|
};
|
|
1337
1688
|
fingerprint?: string;
|
|
1338
1689
|
futureUsage?: string;
|
|
1339
1690
|
}
|
|
1340
|
-
interface DeleteInstrumentResponse {
|
|
1341
|
-
success: boolean;
|
|
1342
|
-
}
|
|
1343
|
-
type RequestCreator<TReq, TOperation extends keyof Operations> = (config: ApiConfig<TReq> & {
|
|
1344
|
-
operation: TOperation;
|
|
1345
|
-
}) => {
|
|
1346
|
-
url: string;
|
|
1347
|
-
body?: TReq;
|
|
1348
|
-
};
|
|
1349
|
-
interface OperationConfig<TReq, TRes> {
|
|
1350
|
-
linkKey: keyof NonNullable<SdkConfiguration['links']>;
|
|
1351
|
-
method: RequestMethod;
|
|
1352
|
-
createRequest: RequestCreator<TReq, keyof Operations>;
|
|
1353
|
-
requestType: TReq;
|
|
1354
|
-
responseType: TRes;
|
|
1355
|
-
}
|
|
1356
|
-
interface ApiConfig<TReq> {
|
|
1357
|
-
operation: keyof Operations;
|
|
1358
|
-
resourceId?: string;
|
|
1359
|
-
body?: TReq;
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
declare class SdkLoader {
|
|
1363
|
-
private static readonly scriptMap;
|
|
1364
|
-
static load<T = void>(sdk: ThirdPartySDK, params?: PayPalScriptConfig): Promise<T>;
|
|
1365
|
-
static reset(): void;
|
|
1366
|
-
static preloadCardForm(): void;
|
|
1367
|
-
private static loadScript;
|
|
1368
|
-
private static loadPayPalScript;
|
|
1369
|
-
private constructor();
|
|
1370
|
-
private static logLoadError;
|
|
1371
|
-
}
|
|
1372
|
-
interface PayPalScriptConfig {
|
|
1373
|
-
clientId: string;
|
|
1374
|
-
currency: string;
|
|
1375
|
-
vault: boolean;
|
|
1376
|
-
intent: 'tokenize' | 'capture' | 'authorize';
|
|
1377
|
-
}
|
|
1378
|
-
declare enum ThirdPartySDK {
|
|
1379
|
-
ApplePay = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",
|
|
1380
|
-
GooglePay = "https://pay.google.com/gp/p/js/pay.js",
|
|
1381
|
-
PayPal = "paypal-sdk"
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
interface QueryDefinition<T> {
|
|
1385
|
-
path: string[];
|
|
1386
|
-
returnType: T;
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
interface ConfigurationQueryTypes {
|
|
1390
|
-
holderReference: QueryDefinition<string>;
|
|
1391
|
-
amount: QueryDefinition<PayrailsAmount>;
|
|
1392
|
-
binLookup: QueryDefinition<Links | undefined>;
|
|
1393
|
-
instrumentDelete: QueryDefinition<Links | undefined>;
|
|
1394
|
-
instrumentUpdate: QueryDefinition<Links | undefined>;
|
|
1395
|
-
executionId: QueryDefinition<string | undefined>;
|
|
1396
|
-
paymentMethodConfig: QueryDefinition<StorablePaymentCompositionOption | undefined>;
|
|
1397
|
-
paymentMethodInstruments: QueryDefinition<StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined>;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
interface InitOptions {
|
|
1401
|
-
version: string;
|
|
1402
|
-
data: string;
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
interface PayrailsClientOptions {
|
|
1406
|
-
environment?: PayrailsEnvironment;
|
|
1407
|
-
events?: ClientEvents;
|
|
1408
|
-
redirectFor3DS?: boolean;
|
|
1409
|
-
returnInfo?: ReturnInfo;
|
|
1410
|
-
telemetry?: {
|
|
1411
|
-
enabled?: boolean;
|
|
1412
|
-
logLevel?: LogLevel$1;
|
|
1413
|
-
};
|
|
1414
|
-
}
|
|
1415
|
-
declare class Payrails {
|
|
1416
|
-
private vaultClient;
|
|
1417
|
-
private options?;
|
|
1418
|
-
private __container;
|
|
1419
|
-
private __cardForm;
|
|
1420
|
-
private __cardList;
|
|
1421
|
-
private __cardPaymentButton;
|
|
1422
|
-
private __paypalButton;
|
|
1423
|
-
private __genericRedirectButton;
|
|
1424
|
-
private __dropin;
|
|
1425
|
-
static preloadCardForm: typeof SdkLoader.preloadCardForm;
|
|
1426
|
-
static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
|
|
1427
|
-
update(amount: PayrailsAmount): void;
|
|
1428
|
-
collectContainer(containerOptions: CollectContainerOptions): PayrailsCollectContainer;
|
|
1429
|
-
googlePayButton(options: GooglePayButtonOptions): GooglePayButton;
|
|
1430
|
-
isGooglePayAvailable(merchantInfo: google.payments.api.MerchantInfo): Promise<boolean>;
|
|
1431
|
-
applePayButton(options: ApplePayButtonOptions): ApplePayButton;
|
|
1432
|
-
isApplePayAvailable(): Promise<boolean>;
|
|
1433
|
-
cardList(options?: CardListOptions): CardList;
|
|
1434
|
-
cardForm(options?: CardFormOptions): CardForm;
|
|
1435
|
-
dropin(options: DropinOptions): Dropin;
|
|
1436
|
-
getSavedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
|
|
1437
|
-
getSavedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1438
|
-
getSavedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1439
|
-
query<K extends keyof ConfigurationQueryTypes>(key: K, params?: Record<string, any>): ConfigurationQueryTypes[K]['returnType'] | null;
|
|
1440
|
-
api<TOperation extends keyof Operations>(config: ApiConfig<Operations[TOperation]['requestType']> & {
|
|
1441
|
-
operation: TOperation;
|
|
1442
|
-
}): Promise<Operations[TOperation]['responseType']>;
|
|
1443
|
-
getStoredInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
1444
|
-
getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
|
|
1445
|
-
paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
|
|
1446
|
-
paypalButton(options?: PaypalButtonOptions): PaypalButton;
|
|
1447
|
-
genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
|
|
1448
|
-
getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
|
|
1449
|
-
private logIntegrationMode;
|
|
1450
|
-
private constructor();
|
|
1451
|
-
private getContainerLayout;
|
|
1452
|
-
binLookup(): Promise<any>;
|
|
1453
|
-
}
|
|
1454
|
-
interface ClientEvents {
|
|
1455
|
-
onClientInitialized?: (execution?: typeof WorkflowExecution) => void;
|
|
1456
|
-
onSessionExpired?: () => Promise<InitOptions>;
|
|
1457
|
-
}
|
|
1458
|
-
interface PaymentEvents {
|
|
1459
|
-
onAuthorizeSuccess?: (e?: any) => void;
|
|
1460
|
-
onAuthorizeFailed?: (e?: any) => void;
|
|
1461
|
-
onAuthorizePending?: (e?: any) => void;
|
|
1462
|
-
onPaymentButtonClicked?: (e?: {
|
|
1463
|
-
bin?: string;
|
|
1464
|
-
}) => Promise<boolean>;
|
|
1465
|
-
onAuthorizeRequestStart?: () => void;
|
|
1466
|
-
onPaymentSessionExpired?: () => void;
|
|
1467
|
-
onThreeDSecureChallenge?: () => void;
|
|
1468
|
-
}
|
|
1469
|
-
interface UIEvents {
|
|
1470
|
-
onSaveInstrumentCheckboxChanged?: ({ checked }: {
|
|
1471
|
-
checked: boolean;
|
|
1472
|
-
}) => void;
|
|
1473
|
-
onBillingAddressChanged?: (e: {
|
|
1474
|
-
isValid: boolean;
|
|
1475
|
-
billingAddress?: IAddress;
|
|
1476
|
-
}) => void;
|
|
1477
|
-
onDeliveryAddressChanged?: (data?: onDeliveryAddressChangedResponse) => Promise<boolean>;
|
|
1478
|
-
}
|
|
1479
|
-
type onPaymentMethodSelectedParams = {
|
|
1480
|
-
paymentMethod?: StorablePaymentCompositionOption;
|
|
1481
|
-
instrument?: StoredPaymentInstrument<CardMetadata & PayPalMetadata>;
|
|
1482
|
-
};
|
|
1483
|
-
interface DropinEvents {
|
|
1484
|
-
onPaymentOptionSelected?: (e: onPaymentMethodSelectedParams) => void;
|
|
1485
|
-
}
|
|
1486
|
-
type PayrailsSDKEvents = PaymentEvents & UIEvents & DropinEvents;
|
|
1487
|
-
type onDeliveryAddressChangedResponse = {
|
|
1488
|
-
deliveryAddress?: {
|
|
1489
|
-
street?: string;
|
|
1490
|
-
doorNumber?: string;
|
|
1491
|
-
complement?: string;
|
|
1492
|
-
area?: string;
|
|
1493
|
-
city?: string;
|
|
1494
|
-
postalCode?: string;
|
|
1495
|
-
state?: string;
|
|
1496
|
-
country?: {
|
|
1497
|
-
code?: string;
|
|
1498
|
-
iso3?: string;
|
|
1499
|
-
name?: string;
|
|
1500
|
-
};
|
|
1501
|
-
latitude?: number;
|
|
1502
|
-
longitude?: number;
|
|
1503
|
-
phone?: {
|
|
1504
|
-
countryCode?: string;
|
|
1505
|
-
number?: string;
|
|
1506
|
-
};
|
|
1507
|
-
name?: string;
|
|
1508
|
-
lastName?: string;
|
|
1509
|
-
email?: string;
|
|
1510
|
-
};
|
|
1511
|
-
};
|
|
1512
|
-
declare enum PayrailsEnvironment {
|
|
1513
|
-
TEST = "TEST",
|
|
1514
|
-
PRODUCTION = "PRODUCTION"
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
|
|
1518
|
-
clientDomain?: string;
|
|
1519
|
-
showPaymentMethodLogo?: boolean;
|
|
1520
|
-
events?: PaymentEvents & {
|
|
1521
|
-
onApplePayAvailable?: () => void;
|
|
1522
|
-
};
|
|
1523
|
-
styles?: {
|
|
1524
|
-
type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
|
|
1525
|
-
style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
|
|
1526
|
-
} & StoreInstrumentElementOptions['styles'];
|
|
1527
|
-
}
|
|
1528
|
-
declare global {
|
|
1529
|
-
interface Window {
|
|
1530
|
-
ApplePaySession?: ApplePaySession;
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
1534
|
-
protected options: ApplePayButtonOptions;
|
|
1535
|
-
private appleButton;
|
|
1536
|
-
private paymentExecutor;
|
|
1537
|
-
static isApplePayAvailable(): Promise<boolean>;
|
|
1538
|
-
constructor(options: ApplePayButtonOptions);
|
|
1539
|
-
mount(location: string): void;
|
|
1540
|
-
unmount(): void;
|
|
1541
|
-
private mountApplePayButton;
|
|
1542
|
-
private createApplePaySession;
|
|
1543
|
-
private onApplePayAuthorized;
|
|
1544
|
-
}
|
|
1545
1691
|
|
|
1546
|
-
export {
|
|
1692
|
+
export { AuthorizationFailureReasons, ElementType, INTEGRATION_TYPE, PAYMENT_METHOD_CODES, Payrails, PayrailsEnvironment };
|
|
1693
|
+
export type { ApplePayButtonOptions, CardFormOptions, CardListOptions, CardPaymentButtonOptions, DropinOptions, GooglePayButtonOptions, InitOptions, PaymentEvents, PaypalButtonOptions, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsSecureField, PayrailsSecureFieldEvent, SaveInstrumentResponse, WorkflowExecutionResponse };
|