@payrails/web-sdk 5.10.0 → 5.12.0-RC.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/payrails.d.ts CHANGED
@@ -1,1130 +1,1266 @@
1
- /// <reference types="applepayjs" />
2
- /// <reference types="googlepay" />
3
1
  import { LogLevel as LogLevel$1 } from '@payrails/logger';
2
+ import { FraudProvider } from '@payrails/fraud-sdk';
4
3
 
5
- declare enum PAYMENT_METHOD_CODES {
6
- 'CARD' = "card",
7
- 'GOOGLE_PAY' = "googlePay",
8
- 'PAYPAL' = "payPal",
9
- 'APPLE_PAY' = "applePay",
10
- 'GENERIC_REDIRECT' = "genericRedirect"
11
- }
12
- declare enum PAYMENT_INSTRUMENT_STATUS {
13
- 'ENABLED' = "enabled",
14
- 'CREATED' = "created",
15
- 'DELETED' = "deleted",
16
- 'DISABLED' = "disabled",
17
- 'INVALID' = "invalid",
18
- 'TRANSIENT' = "transient"
19
- }
20
- declare class WorkflowExecution {
21
- private executionResponse;
22
- constructor(executionResponse: WorkflowExecutionResponse);
23
- get lookup(): {
24
- httpCode: number;
25
- body: {
26
- data: {
27
- paymentCompositionOptions: StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
28
- };
29
- links: {
30
- authorize: {
31
- href: string;
32
- method: "POST";
33
- };
34
- execution: string;
35
- };
36
- name: "lookup";
37
- };
38
- } | undefined;
39
- get holderReference(): string;
40
- get savedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
41
- get savedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
42
- get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
43
- get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
44
- get paypalConfig(): PayPalConfig;
45
- get googlePayConfig(): GooglePayConfig[];
46
- isPaymentMethodAvailable(paymentMethod: PAYMENT_METHOD_CODES): boolean;
47
- get applePayConfig(): {
48
- merchantIdentifier: string;
49
- supportedNetworks: string[];
50
- countryCode: string;
51
- merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
52
- };
53
- get url(): string;
54
- get response(): WorkflowExecutionResponse;
55
- get meta(): {
56
- customer?: {
57
- country?: {
58
- code?: string | undefined;
59
- } | undefined;
60
- } | undefined;
61
- order?: {
62
- billingAddress?: {
63
- country?: {
64
- code?: string | undefined;
65
- } | undefined;
66
- } | undefined;
67
- } | undefined;
68
- };
69
- get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
70
- get authorizeLink(): string | undefined;
71
- get createSessionLink(): string | undefined;
72
- get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
73
- private getStoredInstrumentForPaymentMethod;
74
- }
75
- interface WorkflowExecutionResponse {
76
- id: string;
77
- merchantReference: string;
78
- holderReference: string;
79
- actionRequired?: string;
80
- meta: {
81
- customer?: {
82
- country?: {
83
- code?: string;
84
- };
85
- };
86
- order?: {
87
- billingAddress?: {
88
- country?: {
89
- code?: string;
90
- };
91
- };
92
- };
93
- };
94
- status: Array<{
95
- code: string;
96
- time: string;
97
- }>;
98
- initialResults: Array<{
99
- httpCode: number;
100
- body: {
101
- data: {
102
- paymentCompositionOptions: Array<StorablePaymentCompositionOption>;
103
- };
104
- links: {
105
- authorize: {
106
- href: string;
107
- method: 'POST';
108
- };
109
- execution: string;
110
- };
111
- name: 'lookup';
112
- };
113
- }>;
114
- links: {
115
- startPaymentSession?: {
116
- href: string;
117
- method: 'POST';
118
- };
119
- confirm?: {
120
- href: string;
121
- action?: {
122
- parameters?: {
123
- orderId?: string;
124
- tokenId?: string;
125
- };
126
- };
127
- };
128
- redirect?: string;
129
- '3ds'?: string;
130
- self: string;
131
- };
132
- workflow: {
133
- code: string;
134
- version: number;
135
- };
136
- }
137
- interface BasePaymentMethodConfig {
138
- paymentMethodCode: PAYMENT_METHOD_CODES;
139
- }
140
- interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C = undefined | ApplePayConfig | PayPalConfig | GooglePayConfig> extends BasePaymentMethodConfig {
141
- id: string;
142
- description?: string;
143
- status: PAYMENT_INSTRUMENT_STATUS;
144
- integrationType: INTEGRATION_TYPE;
145
- config: C;
146
- clientConfig?: {
147
- flow?: PAYMENT_CLIENT_FLOW;
148
- };
149
- paymentInstruments?: Array<StoredPaymentInstrument<I>>;
150
- }
151
- interface GooglePayConfig {
152
- parameters: {
153
- allowedAuthMethods: google.payments.api.CardAuthMethod[];
154
- allowedCardNetworks: google.payments.api.CardNetwork[];
155
- };
156
- tokenizationSpecification: google.payments.api.PaymentMethodTokenizationSpecification;
157
- type: google.payments.api.PaymentMethodType;
158
- }
159
- interface PayPalConfig {
160
- clientId: string;
161
- merchantId: string;
162
- captureMode: 'Delayed' | 'Instant' | 'Manual';
163
- }
164
- interface ApplePayConfig {
165
- parameters: {
166
- merchantIdentifier: string;
167
- supportedNetworks: string[];
168
- countryCode: string;
169
- merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
170
- };
171
- type: string;
172
- }
173
- interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata> {
174
- id: string;
175
- status: PAYMENT_INSTRUMENT_STATUS;
176
- paymentMethod: PAYMENT_METHOD_CODES;
177
- displayName?: string;
178
- data?: T;
179
- }
180
- interface PayPalMetadata {
181
- email?: string;
182
- }
183
- interface CardMetadata {
184
- bin?: string;
185
- suffix?: string;
186
- network?: string;
187
- }
188
- declare enum PAYMENT_CLIENT_FLOW {
189
- 'REDIRECT' = "redirect",
190
- 'DIRECT' = "direct"
191
- }
192
- declare enum INTEGRATION_TYPE {
193
- API = "api",
194
- HPP = "hpp"
4
+ declare enum PAYMENT_METHOD_CODES {
5
+ 'CARD' = "card",
6
+ 'GOOGLE_PAY' = "googlePay",
7
+ 'PAYPAL' = "payPal",
8
+ 'APPLE_PAY' = "applePay",
9
+ 'GENERIC_REDIRECT' = "genericRedirect"
10
+ }
11
+ declare enum PAYMENT_INSTRUMENT_STATUS {
12
+ 'ENABLED' = "enabled",
13
+ 'CREATED' = "created",
14
+ 'DELETED' = "deleted",
15
+ 'DISABLED' = "disabled",
16
+ 'INVALID' = "invalid",
17
+ 'TRANSIENT' = "transient"
18
+ }
19
+ declare class WorkflowExecution {
20
+ private executionResponse;
21
+ constructor(executionResponse: WorkflowExecutionResponse);
22
+ get lookup(): {
23
+ httpCode: number;
24
+ body: {
25
+ data: {
26
+ paymentCompositionOptions: Array<StorablePaymentCompositionOption>;
27
+ };
28
+ links: {
29
+ authorize: {
30
+ href: string;
31
+ method: "POST";
32
+ };
33
+ execution: string;
34
+ };
35
+ name: "lookup";
36
+ };
37
+ } | undefined;
38
+ get holderReference(): string;
39
+ get savedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
40
+ get savedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
41
+ get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
42
+ get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
43
+ get paypalConfig(): PayPalConfig;
44
+ get googlePayConfig(): GooglePayConfig[];
45
+ isPaymentMethodAvailable(paymentMethod: PAYMENT_METHOD_CODES): boolean;
46
+ get applePayConfig(): {
47
+ merchantIdentifier: string;
48
+ supportedNetworks: string[];
49
+ countryCode: string;
50
+ merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
51
+ };
52
+ get url(): string;
53
+ get response(): WorkflowExecutionResponse;
54
+ get meta(): {
55
+ customer?: {
56
+ country?: {
57
+ code?: string;
58
+ };
59
+ };
60
+ order?: {
61
+ billingAddress?: {
62
+ country?: {
63
+ code?: string;
64
+ };
65
+ };
66
+ };
67
+ };
68
+ get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
69
+ get authorizeLink(): string | undefined;
70
+ get createSessionLink(): string | undefined;
71
+ get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
72
+ isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
73
+ getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
74
+ private getStoredInstrumentForPaymentMethod;
75
+ getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
76
+ id: string;
77
+ description?: string;
78
+ status: PAYMENT_INSTRUMENT_STATUS;
79
+ integrationType: INTEGRATION_TYPE;
80
+ config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
81
+ clientConfig?: {
82
+ flow?: PAYMENT_CLIENT_FLOW;
83
+ supportsInstallments?: boolean;
84
+ installments?: PaymentInstallmentsConfig;
85
+ };
86
+ paymentMethodCode: PAYMENT_METHOD_CODES;
87
+ } | undefined;
88
+ getPaymentMethodConfig(paymentMethod: StorablePaymentCompositionOption): {
89
+ id: string;
90
+ description?: string;
91
+ status: PAYMENT_INSTRUMENT_STATUS;
92
+ integrationType: INTEGRATION_TYPE;
93
+ config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
94
+ clientConfig?: {
95
+ flow?: PAYMENT_CLIENT_FLOW;
96
+ supportsInstallments?: boolean;
97
+ installments?: PaymentInstallmentsConfig;
98
+ };
99
+ paymentMethodCode: PAYMENT_METHOD_CODES;
100
+ };
101
+ }
102
+ interface WorkflowExecutionResponse {
103
+ id: string;
104
+ merchantReference: string;
105
+ holderReference: string;
106
+ actionRequired?: string;
107
+ meta: {
108
+ customer?: {
109
+ country?: {
110
+ code?: string;
111
+ };
112
+ };
113
+ order?: {
114
+ billingAddress?: {
115
+ country?: {
116
+ code?: string;
117
+ };
118
+ };
119
+ };
120
+ };
121
+ status: Array<{
122
+ code: string;
123
+ time: string;
124
+ }>;
125
+ initialResults: Array<{
126
+ httpCode: number;
127
+ body: {
128
+ data: {
129
+ paymentCompositionOptions: Array<StorablePaymentCompositionOption>;
130
+ };
131
+ links: {
132
+ authorize: {
133
+ href: string;
134
+ method: 'POST';
135
+ };
136
+ execution: string;
137
+ };
138
+ name: 'lookup';
139
+ };
140
+ }>;
141
+ links: {
142
+ startPaymentSession?: {
143
+ href: string;
144
+ method: 'POST';
145
+ };
146
+ confirm?: {
147
+ href: string;
148
+ action?: {
149
+ parameters?: {
150
+ orderId?: string;
151
+ tokenId?: string;
152
+ };
153
+ };
154
+ };
155
+ redirect?: string;
156
+ '3ds'?: string;
157
+ self: string;
158
+ };
159
+ workflow: {
160
+ code: string;
161
+ version: number;
162
+ };
163
+ }
164
+ interface BasePaymentMethodConfig {
165
+ paymentMethodCode: PAYMENT_METHOD_CODES;
166
+ }
167
+ interface BaseInstallmentOption {
168
+ count: number;
169
+ amount: number;
170
+ }
171
+ interface PaymentInstallmentsConfig {
172
+ [key: string]: BaseInstallmentOption[];
173
+ }
174
+ interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C = undefined | ApplePayConfig | PayPalConfig | GooglePayConfig> extends BasePaymentMethodConfig {
175
+ id: string;
176
+ description?: string;
177
+ status: PAYMENT_INSTRUMENT_STATUS;
178
+ integrationType: INTEGRATION_TYPE;
179
+ config: C;
180
+ clientConfig?: {
181
+ flow?: PAYMENT_CLIENT_FLOW;
182
+ supportsInstallments?: boolean;
183
+ installments?: PaymentInstallmentsConfig;
184
+ };
185
+ paymentInstruments?: Array<StoredPaymentInstrument<I>>;
186
+ }
187
+ interface GooglePayConfig {
188
+ parameters: {
189
+ allowedAuthMethods: google.payments.api.CardAuthMethod[];
190
+ allowedCardNetworks: google.payments.api.CardNetwork[];
191
+ };
192
+ tokenizationSpecification: google.payments.api.PaymentMethodTokenizationSpecification;
193
+ type: google.payments.api.PaymentMethodType;
194
+ }
195
+ interface PayPalConfig {
196
+ clientId: string;
197
+ merchantId: string;
198
+ captureMode: 'Delayed' | 'Instant' | 'Manual';
199
+ }
200
+ interface ApplePayConfig {
201
+ parameters: {
202
+ merchantIdentifier: string;
203
+ supportedNetworks: string[];
204
+ countryCode: string;
205
+ merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
206
+ };
207
+ type: string;
208
+ }
209
+ interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata> {
210
+ id: string;
211
+ status: PAYMENT_INSTRUMENT_STATUS;
212
+ paymentMethod: PAYMENT_METHOD_CODES;
213
+ displayName?: string;
214
+ data?: T;
215
+ }
216
+ interface PayPalMetadata {
217
+ email?: string;
218
+ }
219
+ interface CardMetadata {
220
+ bin?: string;
221
+ suffix?: string;
222
+ network?: string;
223
+ binLookup?: {
224
+ issuerCountry: {
225
+ code: string;
226
+ name: string;
227
+ iso3: string;
228
+ };
229
+ };
230
+ }
231
+ declare enum PAYMENT_CLIENT_FLOW {
232
+ 'REDIRECT' = "redirect",
233
+ 'DIRECT' = "direct"
234
+ }
235
+ declare enum INTEGRATION_TYPE {
236
+ API = "api",
237
+ HPP = "hpp"
238
+ }
239
+
240
+ interface SaveInstrumentResponse {
241
+ id: string;
242
+ createdAt: string;
243
+ holderId: string;
244
+ paymentMethod: PAYMENT_METHOD_CODES.CARD;
245
+ status: PAYMENT_INSTRUMENT_STATUS;
246
+ data: {
247
+ bin: string;
248
+ binLookup?: {
249
+ bin: string;
250
+ network: string;
251
+ issuer?: string;
252
+ issuerCountry?: {
253
+ code?: string;
254
+ name?: string;
255
+ iso3?: string;
256
+ };
257
+ type?: string;
258
+ };
259
+ holderName?: string;
260
+ network: string;
261
+ suffix: string;
262
+ expiryMonth?: string;
263
+ expiryYear?: string;
264
+ };
265
+ fingerprint?: string;
266
+ futureUsage?: string;
195
267
  }
196
268
 
197
- interface SaveInstrumentResponse {
198
- id: string;
199
- createdAt: string;
200
- holderId: string;
201
- paymentMethod: PAYMENT_METHOD_CODES.CARD;
202
- status: PAYMENT_INSTRUMENT_STATUS;
203
- data: {
204
- bin: string;
205
- binLookup?: {
206
- bin: string;
207
- network: string;
208
- issuer?: string;
209
- issuerCountry?: {
210
- code?: string;
211
- name?: string;
212
- iso3?: string;
213
- };
214
- type?: string;
215
- };
216
- holderName?: string;
217
- network: string;
218
- suffix: string;
219
- expiryMonth?: string;
220
- expiryYear?: string;
221
- };
222
- fingerprint?: string;
223
- futureUsage?: string;
269
+ interface BinLookupResponse {
270
+ bin: string;
271
+ network: string;
272
+ issuer?: string;
273
+ issuerCountry?: {
274
+ code?: string;
275
+ name?: string;
276
+ iso3?: string;
277
+ };
278
+ type?: string;
224
279
  }
225
280
 
226
- declare enum ElementType$1 {
227
- CVV = "CVV",
228
- EXPIRATION_DATE = "EXPIRATION_DATE",
229
- CARD_NUMBER = "CARD_NUMBER",
230
- CARDHOLDER_NAME = "CARDHOLDER_NAME",
231
- INPUT_FIELD = "INPUT_FIELD",
232
- PIN = "PIN",
233
- EXPIRATION_MONTH = "EXPIRATION_MONTH",
234
- EXPIRATION_YEAR = "EXPIRATION_YEAR"
281
+ declare enum ElementType$1 {
282
+ CVV = "CVV",
283
+ EXPIRATION_DATE = "EXPIRATION_DATE",
284
+ CARD_NUMBER = "CARD_NUMBER",
285
+ CARDHOLDER_NAME = "CARDHOLDER_NAME",
286
+ INPUT_FIELD = "INPUT_FIELD",
287
+ PIN = "PIN",
288
+ EXPIRATION_MONTH = "EXPIRATION_MONTH",
289
+ EXPIRATION_YEAR = "EXPIRATION_YEAR"
235
290
  }
236
291
 
237
- declare enum RedactionType {
238
- DEFAULT = "DEFAULT",
239
- PLAIN_TEXT = "PLAIN_TEXT",
240
- MASKED = "MASKED",
241
- REDACTED = "REDACTED"
242
- }
243
- declare enum RequestMethod {
244
- GET = "GET",
245
- POST = "POST",
246
- PUT = "PUT",
247
- PATCH = "PATCH",
248
- DELETE = "DELETE"
249
- }
250
- declare enum EventName {
251
- CHANGE = "CHANGE",
252
- READY = "READY",
253
- FOCUS = "FOCUS",
254
- BLUR = "BLUR",
255
- SUBMIT = "SUBMIT"
256
- }
257
- declare enum LogLevel {
258
- WARN = "WARN",
259
- INFO = "INFO",
260
- DEBUG = "DEBUG",
261
- ERROR = "ERROR"
262
- }
263
- declare enum Env {
264
- DEV = "DEV",
265
- PROD = "PROD"
266
- }
267
- declare enum ValidationRuleType {
268
- REGEX_MATCH_RULE = "REGEX_MATCH_RULE",
269
- LENGTH_MATCH_RULE = "LENGTH_MATCH_RULE",
270
- ELEMENT_VALUE_MATCH_RULE = "ELEMENT_VALUE_MATCH_RULE"
271
- }
272
- interface IInsertRecordInput {
273
- records: IInsertRecord[];
274
- }
275
- interface IInsertRecord {
276
- table: string;
277
- fields: Record<string, any>;
278
- skyflowID?: string;
279
- }
280
- interface Context {
281
- logLevel: LogLevel;
282
- env: Env;
283
- }
284
- interface IValidationRule {
285
- type: ValidationRuleType;
286
- params: any;
292
+ declare enum RedactionType {
293
+ DEFAULT = "DEFAULT",
294
+ PLAIN_TEXT = "PLAIN_TEXT",
295
+ MASKED = "MASKED",
296
+ REDACTED = "REDACTED"
297
+ }
298
+ declare enum RequestMethod {
299
+ GET = "GET",
300
+ POST = "POST",
301
+ PUT = "PUT",
302
+ PATCH = "PATCH",
303
+ DELETE = "DELETE"
304
+ }
305
+ declare enum EventName {
306
+ CHANGE = "CHANGE",
307
+ READY = "READY",
308
+ FOCUS = "FOCUS",
309
+ BLUR = "BLUR",
310
+ SUBMIT = "SUBMIT"
311
+ }
312
+ declare enum LogLevel {
313
+ WARN = "WARN",
314
+ INFO = "INFO",
315
+ DEBUG = "DEBUG",
316
+ ERROR = "ERROR"
317
+ }
318
+ declare enum Env {
319
+ DEV = "DEV",
320
+ PROD = "PROD"
321
+ }
322
+ declare enum ValidationRuleType {
323
+ REGEX_MATCH_RULE = "REGEX_MATCH_RULE",
324
+ LENGTH_MATCH_RULE = "LENGTH_MATCH_RULE",
325
+ ELEMENT_VALUE_MATCH_RULE = "ELEMENT_VALUE_MATCH_RULE"
326
+ }
327
+ interface IInsertRecordInput {
328
+ records: IInsertRecord[];
329
+ }
330
+ interface IInsertRecord {
331
+ table: string;
332
+ fields: Record<string, any>;
333
+ skyflowID?: string;
334
+ }
335
+ interface Context {
336
+ logLevel: LogLevel;
337
+ env: Env;
338
+ }
339
+ interface IValidationRule {
340
+ type: ValidationRuleType;
341
+ params: any;
287
342
  }
288
343
 
289
- interface IUpsertOptions {
290
- table: string;
291
- column: string;
344
+ interface IUpsertOptions {
345
+ table: string;
346
+ column: string;
292
347
  }
293
348
 
294
- declare abstract class Container {
349
+ declare abstract class Container {
295
350
  }
296
351
 
297
- declare class EventEmitter {
298
- events: Record<string, {
299
- priority: boolean;
300
- callback: Function;
301
- }[]>;
302
- constructor();
303
- on(event: string, callback: Function, priority?: boolean): void;
304
- off(event: string, callback: Function): void;
305
- _emit(event: string, ...args: any[]): void;
306
- hasListener(event: string): boolean;
307
- resetEvents(): void;
308
- static createChild(ChildObject: any): void;
352
+ declare class EventEmitter {
353
+ events: Record<string, {
354
+ priority: boolean;
355
+ callback: Function;
356
+ }[]>;
357
+ constructor();
358
+ on(event: string, callback: Function, priority?: boolean): void;
359
+ off(event: string, callback: Function): void;
360
+ _emit(event: string, ...args: any[]): void;
361
+ hasListener(event: string): boolean;
362
+ resetEvents(): void;
363
+ static createChild(ChildObject: any): void;
309
364
  }
310
365
 
311
- declare abstract class SkyflowElement {
312
- abstract mount(domElementSelector: any): any;
313
- abstract unmount(): any;
314
- abstract setError(clientErrorText: string): any;
315
- abstract resetError(): any;
316
- abstract iframeName(): any;
317
- abstract getID(): any;
366
+ declare abstract class SkyflowElement {
367
+ abstract mount(domElementSelector: any): any;
368
+ abstract unmount(): any;
369
+ abstract setError(clientErrorText: string): any;
370
+ abstract resetError(): any;
371
+ abstract iframeName(): any;
372
+ abstract getID(): any;
318
373
  }
319
374
 
320
- declare class CollectElement extends SkyflowElement {
321
- #private;
322
- elementType: string;
323
- type: string;
324
- containerId: string;
325
- constructor(elementId: string, elementGroup: any, metaData: any, container: any, isSingleElementAPI: boolean | undefined, destroyCallback: Function, updateCallback: Function, context: Context, groupEventEmitter?: EventEmitter);
326
- getID: () => string;
327
- mount: (domElement: any) => void;
328
- unmount: () => void;
329
- update: (group: any) => void;
330
- updateElement: (elementOptions: any) => void;
331
- getState: () => {
332
- isEmpty: boolean;
333
- isComplete: boolean;
334
- isValid: boolean;
335
- isFocused: boolean;
336
- value: string | Object | Blob | undefined;
337
- required: boolean;
338
- };
339
- getOptions: () => any;
340
- on(eventName: string, handler: any): void;
341
- iframeName(): string;
342
- isMounted(): boolean;
343
- isValidElement(): boolean;
344
- setError(clientErrorText: string): void;
345
- resetError(): void;
346
- setValue(elementValue: string): void;
347
- clearValue(): void;
375
+ declare class CollectElement extends SkyflowElement {
376
+ #private;
377
+ elementType: string;
378
+ type: string;
379
+ containerId: string;
380
+ constructor(elementId: string, elementGroup: any, metaData: any, container: any, isSingleElementAPI: boolean | undefined, destroyCallback: Function, updateCallback: Function, context: Context, groupEventEmitter?: EventEmitter);
381
+ getID: () => string;
382
+ mount: (domElement: any) => void;
383
+ unmount: () => void;
384
+ update: (group: any) => void;
385
+ updateElement: (elementOptions: any) => void;
386
+ getState: () => {
387
+ isEmpty: boolean;
388
+ isComplete: boolean;
389
+ isValid: boolean;
390
+ isFocused: boolean;
391
+ value: string | Object | Blob | undefined;
392
+ required: boolean;
393
+ };
394
+ getOptions: () => any;
395
+ on(eventName: string, handler: any): void;
396
+ iframeName(): string;
397
+ isMounted(): boolean;
398
+ isValidElement(): boolean;
399
+ setError(clientErrorText: string): void;
400
+ resetError(): void;
401
+ setValue(elementValue: string): void;
402
+ clearValue(): void;
348
403
  }
349
404
 
350
- interface CollectElementInput$1 {
351
- table?: string;
352
- column?: string;
353
- inputStyles?: object;
354
- label?: string;
355
- labelStyles?: object;
356
- errorTextStyles?: object;
357
- placeholder?: string;
358
- type: ElementType$1;
359
- altText?: string;
360
- validations?: IValidationRule[];
361
- skyflowID?: string;
362
- }
363
- interface ICollectOptions$1 {
364
- tokens?: boolean;
365
- additionalFields?: IInsertRecordInput;
366
- upsert?: Array<IUpsertOptions>;
367
- }
368
- declare class CollectContainer extends Container {
369
- #private;
370
- type: string;
371
- private bus;
372
- private iframe;
373
- constructor(options: any, metaData: any, skyflowElements: any, context: any);
374
- create: (input: CollectElementInput$1, options?: any) => CollectElement;
375
- collect: (options?: ICollectOptions$1) => Promise<unknown>;
376
- unmount: () => void;
405
+ interface CollectElementInput$1 {
406
+ table?: string;
407
+ column?: string;
408
+ inputStyles?: object;
409
+ label?: string;
410
+ labelStyles?: object;
411
+ errorTextStyles?: object;
412
+ placeholder?: string;
413
+ type: ElementType$1;
414
+ altText?: string;
415
+ validations?: IValidationRule[];
416
+ skyflowID?: string;
417
+ }
418
+ interface ICollectOptions$1 {
419
+ tokens?: boolean;
420
+ additionalFields?: IInsertRecordInput;
421
+ upsert?: Array<IUpsertOptions>;
422
+ }
423
+ declare class CollectContainer extends Container {
424
+ #private;
425
+ type: string;
426
+ private bus;
427
+ private iframe;
428
+ constructor(options: any, metaData: any, skyflowElements: any, context: any);
429
+ create: (input: CollectElementInput$1, options?: any) => CollectElement;
430
+ collect: (options?: ICollectOptions$1) => Promise<unknown>;
431
+ unmount: () => void;
377
432
  }
378
433
 
379
- declare class ComposableElement {
380
- #private;
381
- type: string;
382
- constructor(name: any, eventEmitter: any);
383
- on(eventName: string, handler: any): void;
384
- update: (options: any) => void;
434
+ declare class ComposableElement {
435
+ #private;
436
+ type: string;
437
+ constructor(name: any, eventEmitter: any);
438
+ on(eventName: string, handler: any): void;
439
+ update: (options: any) => void;
385
440
  }
386
441
 
387
- interface CollectElementInput {
388
- table?: string;
389
- column?: string;
390
- inputStyles?: object;
391
- label?: string;
392
- labelStyles?: object;
393
- errorTextStyles?: object;
394
- placeholder?: string;
395
- type: ElementType$1;
396
- altText?: string;
397
- validations?: IValidationRule[];
398
- skyflowID?: string;
399
- }
400
- interface ICollectOptions {
401
- tokens?: boolean;
402
- additionalFields?: IInsertRecordInput;
403
- upsert?: Array<IUpsertOptions>;
404
- }
405
- declare class ComposableContainer extends Container {
406
- #private;
407
- type: string;
408
- private bus;
409
- private iframe;
410
- constructor(options: any, metaData: any, skyflowElements: any, context: any);
411
- create: (input: CollectElementInput, options?: any) => ComposableElement;
412
- on: (eventName: string, handler: any) => void;
413
- mount: (domElement: any) => void;
414
- unmount: () => void;
415
- collect: (options?: ICollectOptions) => Promise<unknown>;
442
+ interface CollectElementInput {
443
+ table?: string;
444
+ column?: string;
445
+ inputStyles?: object;
446
+ label?: string;
447
+ labelStyles?: object;
448
+ errorTextStyles?: object;
449
+ placeholder?: string;
450
+ type: ElementType$1;
451
+ altText?: string;
452
+ validations?: IValidationRule[];
453
+ skyflowID?: string;
454
+ }
455
+ interface ICollectOptions {
456
+ tokens?: boolean;
457
+ additionalFields?: IInsertRecordInput;
458
+ upsert?: Array<IUpsertOptions>;
459
+ }
460
+ declare class ComposableContainer extends Container {
461
+ #private;
462
+ type: string;
463
+ private bus;
464
+ private iframe;
465
+ constructor(options: any, metaData: any, skyflowElements: any, context: any);
466
+ create: (input: CollectElementInput, options?: any) => ComposableElement;
467
+ on: (eventName: string, handler: any) => void;
468
+ mount: (domElement: any) => void;
469
+ unmount: () => void;
470
+ collect: (options?: ICollectOptions) => Promise<unknown>;
416
471
  }
417
472
 
418
- declare enum ContainerType {
419
- COLLECT = "COLLECT",
420
- COMPOSABLE = "COMPOSABLE"
421
- }
422
- interface ISkyflow {
423
- vaultID?: string;
424
- vaultURL?: string;
425
- getBearerToken: () => Promise<string>;
426
- options?: Record<string, any>;
427
- }
428
- declare class Skyflow {
429
- #private;
430
- private bus;
431
- constructor(config: ISkyflow);
432
- static init(config: ISkyflow): Skyflow;
433
- container(type: ContainerType, options?: Record<string, any>): CollectContainer | ComposableContainer;
434
- static get ContainerType(): typeof ContainerType;
435
- static get ElementType(): typeof ElementType$1;
436
- static get RedactionType(): typeof RedactionType;
437
- static get RequestMethod(): typeof RequestMethod;
438
- static get LogLevel(): typeof LogLevel;
439
- static get EventName(): typeof EventName;
440
- static get Env(): typeof Env;
441
- static get ValidationRuleType(): typeof ValidationRuleType;
473
+ declare enum ContainerType {
474
+ COLLECT = "COLLECT",
475
+ COMPOSABLE = "COMPOSABLE"
476
+ }
477
+ interface ISkyflow {
478
+ vaultID?: string;
479
+ vaultURL?: string;
480
+ getBearerToken: () => Promise<string>;
481
+ options?: Record<string, any>;
482
+ }
483
+ declare class Skyflow {
484
+ #private;
485
+ private bus;
486
+ constructor(config: ISkyflow);
487
+ static init(config: ISkyflow): Skyflow;
488
+ container(type: ContainerType, options?: Record<string, any>): CollectContainer | ComposableContainer;
489
+ static get ContainerType(): typeof ContainerType;
490
+ static get ElementType(): typeof ElementType$1;
491
+ static get RedactionType(): typeof RedactionType;
492
+ static get RequestMethod(): typeof RequestMethod;
493
+ static get LogLevel(): typeof LogLevel;
494
+ static get EventName(): typeof EventName;
495
+ static get Env(): typeof Env;
496
+ static get ValidationRuleType(): typeof ValidationRuleType;
442
497
  }
443
498
 
444
- declare enum ElementType {
445
- CARD_NUMBER = "CARD_NUMBER",
446
- CARDHOLDER_NAME = "CARDHOLDER_NAME",
447
- CVV = "CVV",
448
- EXPIRATION_MONTH = "EXPIRATION_MONTH",
449
- EXPIRATION_YEAR = "EXPIRATION_YEAR"
499
+ declare enum ElementType {
500
+ CARD_NUMBER = "CARD_NUMBER",
501
+ CARDHOLDER_NAME = "CARDHOLDER_NAME",
502
+ CVV = "CVV",
503
+ EXPIRATION_MONTH = "EXPIRATION_MONTH",
504
+ EXPIRATION_YEAR = "EXPIRATION_YEAR"
450
505
  }
451
506
 
452
- interface Mountable {
453
- mount(selector: string | PayrailsElement): void;
454
- unmount(): void;
455
- }
456
- interface ElementOptions {
457
- id?: string;
458
- className?: string | string[];
459
- styles?: Partial<CSSStyleDeclaration>;
460
- }
461
- declare class PayrailsElement implements Mountable {
462
- protected element: HTMLElement;
463
- protected subElements: Array<Mountable>;
464
- readonly id: string | undefined;
465
- constructor(elementType: string, { id, className }?: ElementOptions);
466
- get parentElement(): HTMLElement | null;
467
- get selector(): string;
468
- mount(location: string): void;
469
- private clean;
470
- unmount(): void;
507
+ interface Mountable {
508
+ mount(selector: string | PayrailsElement): void;
509
+ unmount(): void;
510
+ }
511
+ interface ElementOptions {
512
+ id?: string;
513
+ className?: string | string[];
514
+ styles?: Partial<CSSStyleDeclaration>;
515
+ }
516
+ declare class PayrailsElement implements Mountable {
517
+ protected element: HTMLElement;
518
+ protected subElements: Array<Mountable>;
519
+ readonly id: string | undefined;
520
+ constructor(elementType: string, { id, className }?: ElementOptions);
521
+ get parentElement(): HTMLElement | null;
522
+ get selector(): string;
523
+ mount(location: string): void;
524
+ private clean;
525
+ unmount(): void;
471
526
  }
472
527
 
473
- interface StoreInstrumentElementOptions extends ElementOptions {
474
- showStoreInstrumentCheckbox?: boolean;
475
- alwaysStoreInstrument?: boolean;
476
- translations?: {
477
- labels?: {
478
- storeInstrument?: string;
479
- saveInstrument?: string;
480
- };
481
- };
482
- styles?: {
483
- storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
484
- };
485
- events?: PayrailsSDKEvents;
486
- }
487
- declare class StoreInstrumentCheckbox extends PayrailsElement {
488
- private options;
489
- constructor(options: StoreInstrumentElementOptions);
490
- get isChecked(): boolean;
491
- private createHTML;
492
- private applyStyles;
493
- private addListeners;
494
- }
495
- declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
496
- protected options?: StoreInstrumentElementOptions | undefined;
497
- protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
498
- protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
499
- protected get shouldStoreInstrument(): boolean;
528
+ interface StoreInstrumentElementOptions extends ElementOptions {
529
+ showStoreInstrumentCheckbox?: boolean;
530
+ alwaysStoreInstrument?: boolean;
531
+ translations?: {
532
+ labels?: {
533
+ storeInstrument?: string;
534
+ saveInstrument?: string;
535
+ };
536
+ };
537
+ styles?: {
538
+ storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
539
+ };
540
+ events?: PayrailsSDKEvents;
541
+ }
542
+ declare class StoreInstrumentCheckbox extends PayrailsElement {
543
+ private options;
544
+ constructor(options: StoreInstrumentElementOptions);
545
+ get isChecked(): boolean;
546
+ private createHTML;
547
+ private applyStyles;
548
+ private addListeners;
549
+ }
550
+ declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
551
+ protected options?: StoreInstrumentElementOptions | undefined;
552
+ protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
553
+ protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
554
+ protected get shouldStoreInstrument(): boolean;
500
555
  }
501
556
 
502
- interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
503
- clientDomain?: string;
504
- events?: PaymentEvents & {
505
- onApplePayAvailable?: () => void;
506
- };
507
- styles?: {
508
- type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
509
- style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
510
- } & StoreInstrumentElementOptions['styles'];
511
- }
512
- declare global {
513
- interface Window {
514
- ApplePaySession?: ApplePaySession;
515
- }
516
- }
517
- declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
518
- private sdkConfig;
519
- private execution;
520
- protected options: ApplePayButtonOptions;
521
- private appleButton;
522
- private paymentExecutor;
523
- static isApplePayAvailable(): Promise<boolean>;
524
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: ApplePayButtonOptions);
525
- mount(location: string): void;
526
- unmount(): void;
527
- private mountApplePayButton;
528
- private createApplePaySession;
529
- private onApplePayAuthorized;
557
+ interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
558
+ clientDomain?: string;
559
+ events?: PaymentEvents & {
560
+ onApplePayAvailable?: () => void;
561
+ };
562
+ styles?: {
563
+ type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
564
+ style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
565
+ } & StoreInstrumentElementOptions['styles'];
566
+ }
567
+ declare global {
568
+ interface Window {
569
+ ApplePaySession?: ApplePaySession;
570
+ }
571
+ }
572
+ declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
573
+ private sdkConfig;
574
+ private execution;
575
+ protected options: ApplePayButtonOptions;
576
+ private appleButton;
577
+ private paymentExecutor;
578
+ static isApplePayAvailable(): Promise<boolean>;
579
+ constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: ApplePayButtonOptions);
580
+ mount(location: string): void;
581
+ unmount(): void;
582
+ private mountApplePayButton;
583
+ private createApplePaySession;
584
+ private onApplePayAuthorized;
530
585
  }
531
586
 
532
- declare const regexes: {
533
- visa: RegExp;
534
- mastercard: RegExp;
535
- amex: RegExp;
536
- diners: RegExp;
537
- discover: RegExp;
538
- jcb: RegExp;
539
- hipercard: RegExp;
540
- unionpay: RegExp;
541
- maestro: RegExp;
542
- };
587
+ declare const regexes: {
588
+ visa: RegExp;
589
+ mastercard: RegExp;
590
+ amex: RegExp;
591
+ diners: RegExp;
592
+ discover: RegExp;
593
+ jcb: RegExp;
594
+ hipercard: RegExp;
595
+ unionpay: RegExp;
596
+ maestro: RegExp;
597
+ };
543
598
  type CardNetwork = keyof typeof regexes;
544
599
 
545
- interface OnChange {
546
- isValid: boolean;
547
- cardNetwork: CardNetwork | '';
548
- bin?: string;
549
- }
550
- interface CardFormOptions extends StoreInstrumentElementOptions {
551
- showCardHolderName?: boolean;
552
- enrollInstrumentToNetworkOffers?: boolean;
553
- translations?: {
554
- placeholders?: {
555
- [key in ElementType]?: string;
556
- };
557
- labels?: {
558
- [key in ElementType | 'saveCreditCard']?: string;
559
- } & {
560
- saveInstrument?: string;
561
- storeInstrument?: string;
562
- };
563
- };
564
- events?: {
565
- onFocus?: () => void;
566
- onChange?: (e: OnChange) => void;
567
- onSaveInstrumentCheckboxChanged?: PayrailsSDKEvents['onSaveInstrumentCheckboxChanged'];
568
- onReady?: () => void;
569
- };
570
- styles?: {
571
- wrapper?: Partial<CSSStyleDeclaration>;
572
- base?: Partial<CSSStyleDeclaration>;
573
- storeCardCheckbox?: Partial<CSSStyleDeclaration>;
574
- errorTextStyles?: {
575
- base: Partial<CSSStyleDeclaration>;
576
- };
577
- inputFields?: {
578
- [key in ElementType | 'all']?: CardFieldStyles;
579
- };
580
- labels?: {
581
- [key in ElementType | 'all']?: Partial<CSSStyleDeclaration>;
582
- };
583
- } & StoreInstrumentElementOptions['styles'];
584
- }
585
- declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
586
- private readonly collectContainer;
587
- protected readonly options?: CardFormOptions | undefined;
588
- get bin(): string;
589
- private readonly formFields;
590
- constructor(collectContainer: PayrailsCollectContainer, options?: CardFormOptions | undefined);
591
- tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
592
- show(): void;
593
- hide(): void;
594
- private triggerOnReady;
595
- private prepareLabelStyles;
596
- private prepareInputStyles;
597
- get isValid(): boolean;
598
- get cardNetwork(): "" | "visa" | "mastercard" | "amex" | "diners" | "discover" | "jcb" | "hipercard" | "unionpay" | "maestro";
599
- onChange(): void;
600
- collectValues(): Promise<{
601
- cardData: TokenizedCollectResult | EncryptedCollectResult;
602
- storeInstrument: boolean;
603
- enrollInstrumentToNetworkOffers: boolean;
604
- }>;
605
- private enforceEnrollInstrumentToNetworkOffersForMasterCard;
606
- }
607
- interface LabelStyles {
608
- base?: Partial<CSSStyleDeclaration>;
609
- }
610
- interface CardFieldStyles extends LabelStyles {
611
- complete?: Partial<CSSStyleDeclaration>;
612
- empty?: Partial<CSSStyleDeclaration>;
613
- focus?: Partial<CSSStyleDeclaration>;
614
- invalid?: Partial<CSSStyleDeclaration>;
615
- cardIcon?: Partial<CSSStyleDeclaration>;
616
- copyIcon?: Partial<CSSStyleDeclaration>;
600
+ interface PaymentInstallmentsElementOptions extends ElementOptions {
601
+ showPaymentInstallmentsDropdown?: boolean;
602
+ installmentOptions?: BaseInstallmentOption[] | null;
603
+ installmentCurrency?: string;
604
+ translations?: {
605
+ labels?: {
606
+ paymentInstallments?: string;
607
+ };
608
+ };
609
+ styles?: {
610
+ paymentInstallmentsDropdown?: Partial<CSSStyleDeclaration>;
611
+ };
612
+ events?: PayrailsSDKEvents;
613
+ }
614
+ declare class PaymentInstallmentsDropdown extends PayrailsElement {
615
+ private options;
616
+ constructor(options: PaymentInstallmentsElementOptions);
617
+ private generateOptionsHTML;
618
+ updateOptions(installmentOptions: BaseInstallmentOption[]): void;
619
+ private createHTML;
620
+ private applyStyles;
621
+ private addListeners;
622
+ get selectedInstallmentValue(): string | undefined;
623
+ setDisabled(state: boolean): void;
624
+ }
625
+ declare class PayrailsElementWithPaymentInstallmentsDropdown extends PayrailsElement {
626
+ protected options?: PaymentInstallmentsElementOptions | undefined;
627
+ protected paymentInstallmentsDropdown: PaymentInstallmentsDropdown | null;
628
+ constructor(elementType: string, options?: PaymentInstallmentsElementOptions | undefined);
629
+ get selectedInstallmentValue(): number;
630
+ updateInstallmentOptions(installmentOptions: BaseInstallmentOption[]): void;
631
+ setDisabled(state: boolean): void;
632
+ }
633
+
634
+ interface OnChange {
635
+ isValid: boolean;
636
+ cardNetwork: CardNetwork | '';
637
+ bin?: string;
638
+ }
639
+ interface CardFormOptions extends StoreInstrumentElementOptions {
640
+ showCardHolderName?: boolean;
641
+ enrollInstrumentToNetworkOffers?: boolean;
642
+ execution?: WorkflowExecution;
643
+ translations?: {
644
+ placeholders?: {
645
+ [key in ElementType]?: string;
646
+ };
647
+ labels?: {
648
+ [key in ElementType | 'saveCreditCard']?: string;
649
+ } & {
650
+ saveInstrument?: string;
651
+ storeInstrument?: string;
652
+ paymentInstallments?: string;
653
+ };
654
+ };
655
+ events?: {
656
+ onFocus?: () => void;
657
+ onChange?: (e: OnChange) => void;
658
+ onSaveInstrumentCheckboxChanged?: PayrailsSDKEvents['onSaveInstrumentCheckboxChanged'];
659
+ onReady?: () => void;
660
+ };
661
+ styles?: {
662
+ wrapper?: Partial<CSSStyleDeclaration>;
663
+ base?: Partial<CSSStyleDeclaration>;
664
+ storeCardCheckbox?: Partial<CSSStyleDeclaration>;
665
+ errorTextStyles?: {
666
+ base: Partial<CSSStyleDeclaration>;
667
+ };
668
+ inputFields?: {
669
+ [key in ElementType | 'all']?: CardFieldStyles;
670
+ };
671
+ labels?: {
672
+ [key in ElementType | 'all']?: Partial<CSSStyleDeclaration>;
673
+ };
674
+ } & StoreInstrumentElementOptions['styles'] & PaymentInstallmentsElementOptions['styles'];
675
+ }
676
+ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
677
+ private readonly collectContainer;
678
+ protected readonly options?: CardFormOptions | undefined;
679
+ get bin(): string;
680
+ get isBinLookupEnabled(): boolean;
681
+ private readonly formFields;
682
+ private readonly paymentInstallmentsDropdown;
683
+ private throttledFetchBinLookup;
684
+ private lastBin;
685
+ private lastBinLookup;
686
+ constructor(collectContainer: PayrailsCollectContainer, options?: CardFormOptions | undefined);
687
+ throttledFetchBinLookupIfChanged(): Promise<BinLookupResponse | null>;
688
+ tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
689
+ show(): void;
690
+ hide(): void;
691
+ private triggerOnReady;
692
+ private prepareLabelStyles;
693
+ private prepareInputStyles;
694
+ get isValid(): boolean;
695
+ get cardNetwork(): "" | "visa" | "mastercard" | "amex" | "diners" | "discover" | "jcb" | "hipercard" | "unionpay" | "maestro";
696
+ onChange(): void;
697
+ private updateInstallments;
698
+ collectValues(): Promise<{
699
+ cardData: EncryptedCollectResult | TokenizedCollectResult;
700
+ storeInstrument: boolean;
701
+ selectedInstallment: number | undefined;
702
+ enrollInstrumentToNetworkOffers: boolean;
703
+ }>;
704
+ protected get selectedInstallment(): number | undefined;
705
+ private enforceEnrollInstrumentToNetworkOffersForMasterCard;
706
+ fetchBinLookup(): Promise<string | BinLookupResponse>;
707
+ get isPaymentInstallmentsEnabled(): boolean | undefined;
708
+ private getinstallmentOptions;
709
+ }
710
+ interface LabelStyles {
711
+ base?: Partial<CSSStyleDeclaration>;
712
+ }
713
+ interface CardFieldStyles extends LabelStyles {
714
+ complete?: Partial<CSSStyleDeclaration>;
715
+ empty?: Partial<CSSStyleDeclaration>;
716
+ focus?: Partial<CSSStyleDeclaration>;
717
+ invalid?: Partial<CSSStyleDeclaration>;
718
+ cardIcon?: Partial<CSSStyleDeclaration>;
719
+ copyIcon?: Partial<CSSStyleDeclaration>;
617
720
  }
618
721
 
619
- interface CardListOptions {
620
- onCardChange: (selectedCard: StoredPaymentInstrument<CardMetadata>) => void;
621
- }
622
- declare class CardList extends PayrailsElement {
623
- private readonly workflowExecution;
624
- private listItems;
625
- constructor(workflowExecution: WorkflowExecution, options?: CardListOptions);
626
- reset(): void;
722
+ interface CardListOptions {
723
+ onCardChange: (selectedCard: StoredPaymentInstrument<CardMetadata>) => void;
724
+ }
725
+ declare class CardList extends PayrailsElement {
726
+ private readonly workflowExecution;
727
+ private listItems;
728
+ constructor(workflowExecution: WorkflowExecution, options?: CardListOptions);
729
+ reset(): void;
627
730
  }
628
731
 
629
- interface ReturnInfo {
630
- success?: string;
631
- cancel?: string;
632
- error?: string;
732
+ interface ReturnInfo {
733
+ success?: string;
734
+ cancel?: string;
735
+ error?: string;
736
+ }
737
+ declare global {
738
+ interface Window {
739
+ Payrails: {
740
+ riskIds: {
741
+ [key in FraudProvider]?: string;
742
+ };
743
+ };
744
+ }
633
745
  }
634
746
 
635
- interface CardPaymentButtonOptions {
636
- events?: PayrailsSDKEvents & {
637
- onStateChanged?: (state: 'enabled' | 'disabled') => void;
638
- };
639
- translations?: {
640
- label: string;
641
- };
642
- redirectFor3DS?: boolean;
643
- styles?: {
644
- base?: Partial<CSSStyleDeclaration>;
645
- disabled?: Partial<CSSStyleDeclaration>;
646
- loading?: Partial<CSSStyleDeclaration>;
647
- hover?: Partial<CSSStyleDeclaration>;
648
- };
649
- }
650
- declare class CardPaymentButton extends PayrailsElement {
651
- private readonly sdkConfig;
652
- private readonly execution;
653
- private readonly options;
654
- private readonly returnInfo?;
655
- selectedInstrument: StoredPaymentInstrument | null;
656
- get bin(): string | undefined;
657
- private paymentExecutor;
658
- private cardForm;
659
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: CardPaymentButtonOptions, returnInfo?: ReturnInfo | undefined);
660
- setDisabled(isDisabled: boolean): void;
661
- setSavedCreditCard(savedCard: StoredPaymentInstrument<CardMetadata>): void;
662
- setSavedInstrument(savedInstrument: StoredPaymentInstrument): void;
663
- private setStyles;
664
- private removeStyles;
665
- setLabel(label: string): void;
666
- setCardForm(cardForm: CardForm): void;
667
- triggerLoading(isLoading: boolean): void;
668
- private onAuthorizationFailed;
669
- private onPay;
670
- private constructTokenizedPayment;
671
- private constructEncryptedPayment;
672
- private handleAuthorizationResult;
673
- }
674
- declare enum AuthorizationFailureReasons {
675
- VALIDATION_FAILED = "VALIDATION_FAILED",
676
- AUTHORIZATION_ERROR = "AUTHORIZATION_ERROR",
677
- AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR",
678
- UNKNOWN_ERROR = "UNKNOWN_ERROR"
747
+ interface CardPaymentButtonOptions {
748
+ events?: PayrailsSDKEvents & {
749
+ onStateChanged?: (state: 'enabled' | 'disabled') => void;
750
+ };
751
+ translations?: {
752
+ label: string;
753
+ };
754
+ redirectFor3DS?: boolean;
755
+ styles?: {
756
+ base?: Partial<CSSStyleDeclaration>;
757
+ disabled?: Partial<CSSStyleDeclaration>;
758
+ loading?: Partial<CSSStyleDeclaration>;
759
+ hover?: Partial<CSSStyleDeclaration>;
760
+ };
761
+ }
762
+ declare class CardPaymentButton extends PayrailsElement {
763
+ private readonly sdkConfig;
764
+ private readonly execution;
765
+ private readonly options;
766
+ private readonly returnInfo?;
767
+ selectedInstrument: StoredPaymentInstrument | null;
768
+ paymentInstallmentElement: PayrailsElementWithPaymentInstallmentsDropdown | null;
769
+ get bin(): string | undefined;
770
+ private paymentExecutor;
771
+ private cardForm;
772
+ constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: CardPaymentButtonOptions, returnInfo?: ReturnInfo | undefined);
773
+ setDisabled(isDisabled: boolean): void;
774
+ setSavedCreditCard(savedCard: StoredPaymentInstrument<CardMetadata>): void;
775
+ setSavedInstrument(savedInstrument: StoredPaymentInstrument): void;
776
+ private setStyles;
777
+ private removeStyles;
778
+ setLabel(label: string): void;
779
+ setCardForm(cardForm: CardForm): void;
780
+ setPaymentInstallmentsDropdown(paymentInsallmentsDropdown: PayrailsElementWithPaymentInstallmentsDropdown): void;
781
+ triggerLoading(isLoading: boolean): void;
782
+ private onAuthorizationFailed;
783
+ private onPay;
784
+ private constructTokenizedPayment;
785
+ private constructEncryptedPayment;
786
+ private handleAuthorizationResult;
787
+ }
788
+ declare enum AuthorizationFailureReasons {
789
+ VALIDATION_FAILED = "VALIDATION_FAILED",
790
+ AUTHORIZATION_ERROR = "AUTHORIZATION_ERROR",
791
+ AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR",
792
+ UNKNOWN_ERROR = "UNKNOWN_ERROR"
679
793
  }
680
794
 
681
- interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
682
- environment?: PayrailsEnvironment;
683
- merchantInfo?: google.payments.api.MerchantInfo;
684
- redirectFor3DS?: boolean;
685
- events?: PaymentEvents & UIEvents & {
686
- onGooglePayAvailable?: () => void;
687
- };
688
- styles?: {
689
- buttonColor?: google.payments.api.ButtonColor;
690
- buttonType?: google.payments.api.ButtonType;
691
- buttonSizeMode?: google.payments.api.ButtonSizeMode;
692
- buttonLocale?: string;
693
- } & StoreInstrumentElementOptions['styles'];
694
- }
695
- declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
696
- private sdkConfig;
697
- private execution;
698
- protected options: GooglePayButtonOptions;
699
- private googleButton;
700
- private readonly paymentExecutor;
701
- private static googleSDKClient;
702
- private static getSDKClient;
703
- static isGooglePayAvailable(allowedPaymentMethods: google.payments.api.IsReadyToPayPaymentMethodSpecification[], environment?: PayrailsEnvironment, merchantInfo?: google.payments.api.MerchantInfo): Promise<boolean>;
704
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GooglePayButtonOptions);
705
- private sdkLoaded;
706
- private onLoadPaymentData;
707
- private authorize;
708
- mount(location: string): void;
709
- unmount(): void;
795
+ interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
796
+ environment?: PayrailsEnvironment;
797
+ merchantInfo?: google.payments.api.MerchantInfo;
798
+ redirectFor3DS?: boolean;
799
+ events?: PaymentEvents & UIEvents & {
800
+ onGooglePayAvailable?: () => void;
801
+ };
802
+ styles?: {
803
+ buttonColor?: google.payments.api.ButtonColor;
804
+ buttonType?: google.payments.api.ButtonType;
805
+ buttonSizeMode?: google.payments.api.ButtonSizeMode;
806
+ buttonLocale?: string;
807
+ } & StoreInstrumentElementOptions['styles'];
808
+ }
809
+ declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
810
+ private sdkConfig;
811
+ private execution;
812
+ protected options: GooglePayButtonOptions;
813
+ private googleButton;
814
+ private readonly paymentExecutor;
815
+ private static googleSDKClient;
816
+ private static getSDKClient;
817
+ static isGooglePayAvailable(allowedPaymentMethods: google.payments.api.IsReadyToPayPaymentMethodSpecification[], environment?: PayrailsEnvironment, merchantInfo?: google.payments.api.MerchantInfo): Promise<boolean>;
818
+ constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GooglePayButtonOptions);
819
+ private sdkLoaded;
820
+ private onLoadPaymentData;
821
+ private authorize;
822
+ mount(location: string): void;
823
+ unmount(): void;
710
824
  }
711
825
 
712
- interface DropinElementEvents extends PaymentEvents {
713
- onActivate?: () => void;
714
- onDeactivate?: () => void;
715
- onAvailable?: () => void;
716
- }
717
- interface DropinElementStyles {
718
- base?: Partial<CSSStyleDeclaration>;
719
- active?: Partial<CSSStyleDeclaration>;
826
+ interface DropinElementEvents extends PaymentEvents {
827
+ onActivate?: () => void;
828
+ onDeactivate?: () => void;
829
+ onAvailable?: () => void;
830
+ onPaymentOptionVisibilityChange?: () => void;
831
+ }
832
+ interface DropinElementStyles {
833
+ base?: Partial<CSSStyleDeclaration>;
834
+ active?: Partial<CSSStyleDeclaration>;
720
835
  }
721
836
 
722
- interface ButtonOptions {
723
- id: string;
724
- events?: PayrailsSDKEvents & {
725
- onClick?: () => Promise<void>;
726
- };
727
- translations: {
728
- label: string;
729
- };
730
- styles?: {
731
- base?: Partial<CSSStyleDeclaration>;
732
- loading?: Partial<CSSStyleDeclaration>;
733
- hover?: Partial<CSSStyleDeclaration>;
734
- };
837
+ interface ButtonOptions {
838
+ id: string;
839
+ events?: PayrailsSDKEvents & {
840
+ onClick?: () => Promise<void>;
841
+ };
842
+ translations: {
843
+ label: string;
844
+ };
845
+ styles?: {
846
+ base?: Partial<CSSStyleDeclaration>;
847
+ loading?: Partial<CSSStyleDeclaration>;
848
+ hover?: Partial<CSSStyleDeclaration>;
849
+ };
735
850
  }
736
851
 
737
- interface GenericRedirectButtonOptions {
738
- styles?: ButtonOptions['styles'];
739
- translations?: {
740
- label?: string;
741
- };
742
- events?: PaymentEvents;
743
- paymentMethod: BasePaymentMethodConfig;
744
- }
745
- declare class GenericRedirectButton extends PayrailsElement {
746
- private sdkConfig;
747
- private execution;
748
- protected options: GenericRedirectButtonOptions;
749
- private readonly returnInfo?;
750
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GenericRedirectButtonOptions, returnInfo?: ReturnInfo | undefined);
751
- private buildRedirectButton;
752
- private paymentExecutor;
753
- private onClick;
852
+ interface GenericRedirectButtonOptions {
853
+ styles?: ButtonOptions['styles'];
854
+ translations?: {
855
+ label?: string;
856
+ };
857
+ events?: PaymentEvents;
858
+ paymentMethod: BasePaymentMethodConfig;
859
+ }
860
+ declare class GenericRedirectButton extends PayrailsElement {
861
+ private sdkConfig;
862
+ private execution;
863
+ protected options: GenericRedirectButtonOptions;
864
+ private readonly returnInfo?;
865
+ constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options: GenericRedirectButtonOptions, returnInfo?: ReturnInfo | undefined);
866
+ private buildRedirectButton;
867
+ private paymentExecutor;
868
+ private onClick;
754
869
  }
755
870
 
756
- interface GenericRedirectDropinOptions {
757
- paymentMethod: StorablePaymentCompositionOption;
758
- styles?: {
759
- element?: DropinElementStyles;
760
- button: ButtonOptions['styles'];
761
- };
762
- translations?: {
763
- label?: string;
764
- button?: GenericRedirectButtonOptions['translations'];
765
- };
766
- events?: DropinElementEvents & PaymentEvents;
871
+ interface GenericRedirectDropinOptions {
872
+ paymentMethod: StorablePaymentCompositionOption;
873
+ styles?: {
874
+ element?: DropinElementStyles;
875
+ button: ButtonOptions['styles'];
876
+ };
877
+ translations?: {
878
+ label?: string;
879
+ button?: GenericRedirectButtonOptions['translations'];
880
+ };
881
+ events?: DropinElementEvents & PaymentEvents;
767
882
  }
768
883
 
769
- interface GooglePayDropinOptions extends GooglePayButtonOptions {
770
- translations?: {
771
- labels?: {
772
- label?: string;
773
- storeInstrument?: string;
774
- };
775
- };
776
- styles?: GooglePayButtonOptions['styles'] & DropinElementStyles;
884
+ interface GooglePayDropinOptions extends GooglePayButtonOptions {
885
+ translations?: {
886
+ labels?: {
887
+ label?: string;
888
+ storeInstrument?: string;
889
+ };
890
+ };
891
+ styles?: GooglePayButtonOptions['styles'] & DropinElementStyles;
892
+ events?: GooglePayButtonOptions['events'] & DropinElementEvents;
777
893
  }
778
894
 
779
- interface PaypalButtonOptions extends StoreInstrumentElementOptions {
780
- fraudNetGuid?: string;
781
- events?: PaymentEvents & UIEvents & {
782
- onPaypalAvailable?: () => void;
783
- };
784
- styles?: {
785
- color?: 'gold' | 'blue' | 'silver' | 'white' | 'black';
786
- height?: number;
787
- label?: 'paypal' | 'checkout' | 'buynow' | 'pay' | 'installment' | 'subscribe' | 'donate';
788
- shape?: 'rect' | 'pill';
789
- tagline?: boolean;
790
- } & StoreInstrumentElementOptions['styles'];
791
- }
792
- declare class PaypalButton extends PayrailsElementWithStoreInstrumentCheckbox {
793
- private sdkConfig;
794
- private execution;
795
- protected options?: PaypalButtonOptions | undefined;
796
- constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options?: PaypalButtonOptions | undefined);
797
- fraudNetGuid: string | undefined;
798
- private paymentExecutor;
799
- private button;
800
- private confirmLink;
801
- private buttonWrapperId;
802
- private checkboxWrapperId;
803
- private loadPaypal;
804
- private get paypalScriptConfig();
805
- private createPaypalButton;
806
- private createPayPalButtonConfig;
807
- private createBillingAgreementConfig;
808
- private createOneTimeOrderConfig;
809
- private createBaseConfig;
810
- private createOneTimeOrder;
811
- private approvePayment;
812
- mount(location: string): void;
813
- unmount(): void;
895
+ interface PaypalButtonOptions extends StoreInstrumentElementOptions {
896
+ fraudNetGuid?: string;
897
+ events?: PaymentEvents & UIEvents & {
898
+ onPaypalAvailable?: () => void;
899
+ };
900
+ styles?: {
901
+ color?: 'gold' | 'blue' | 'silver' | 'white' | 'black';
902
+ height?: number;
903
+ label?: 'paypal' | 'checkout' | 'buynow' | 'pay' | 'installment' | 'subscribe' | 'donate';
904
+ shape?: 'rect' | 'pill';
905
+ tagline?: boolean;
906
+ } & StoreInstrumentElementOptions['styles'];
907
+ }
908
+ declare class PaypalButton extends PayrailsElementWithStoreInstrumentCheckbox {
909
+ private sdkConfig;
910
+ private execution;
911
+ protected options?: PaypalButtonOptions | undefined;
912
+ constructor(sdkConfig: SdkConfiguration, execution: WorkflowExecution, options?: PaypalButtonOptions | undefined);
913
+ fraudNetGuid: string | undefined;
914
+ private paymentExecutor;
915
+ private button;
916
+ private confirmLink;
917
+ private buttonWrapperId;
918
+ private checkboxWrapperId;
919
+ private loadPaypal;
920
+ private get paypalScriptConfig();
921
+ private createPaypalButton;
922
+ private createPayPalButtonConfig;
923
+ private createBillingAgreementConfig;
924
+ private createOneTimeOrderConfig;
925
+ private createBaseConfig;
926
+ private createOneTimeOrder;
927
+ private approvePayment;
928
+ mount(location: string): void;
929
+ unmount(): void;
814
930
  }
815
931
 
816
- interface PaypalDropinOptions extends PaypalButtonOptions {
817
- translations?: {
818
- labels?: {
819
- saveInstrument?: string;
820
- label?: string;
821
- };
822
- };
823
- styles?: PaypalButtonOptions['styles'] & DropinElementStyles;
824
- events?: PaypalButtonOptions['events'] & DropinElementEvents;
932
+ interface PaypalDropinOptions extends PaypalButtonOptions {
933
+ translations?: {
934
+ labels?: {
935
+ saveInstrument?: string;
936
+ label?: string;
937
+ };
938
+ };
939
+ styles?: PaypalButtonOptions['styles'] & DropinElementStyles;
940
+ events?: PaypalButtonOptions['events'] & DropinElementEvents;
825
941
  }
826
942
 
827
- declare class Dropin extends PayrailsElement {
828
- private collectContainer;
829
- private readonly clientConfig;
830
- private readonly dropinConfig;
831
- private readonly execution;
832
- private readonly sdkConfig;
833
- private cardPaymentButton;
834
- private creditCard;
835
- private googlePay;
836
- private applePay;
837
- private cardForm;
838
- private paypal;
839
- constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions, execution: WorkflowExecution, sdkConfig: SdkConfiguration);
840
- private isHppIntegration;
841
- private createStoredInstrumentElement;
842
- private createHppIntegrationElement;
843
- private get totalPaymentOptions();
844
- private createCreditCardButton;
845
- private createGooglePayButton;
846
- private createPayPalButton;
847
- private createCardForm;
848
- private createApplePayButton;
849
- private createCardPaymentButton;
850
- private onAuthorizeSuccess;
851
- private getElementEvents;
852
- private onAuthorizeFailed;
853
- private isStoredInstrumentEnabled;
854
- private applyStyles;
855
- }
856
- interface StorablePaymentMethodConfiguration extends StoreInstrumentElementOptions {
857
- showStoredInstruments?: boolean;
858
- }
859
- interface DropinOptions {
860
- paymentMethodsConfiguration?: {
861
- preselectFirstPaymentOption?: boolean;
862
- cards?: {
863
- showCardHolderName?: boolean;
864
- showExistingCards?: boolean;
865
- } & StorablePaymentMethodConfiguration;
866
- payPal?: StorablePaymentMethodConfiguration;
867
- googlePay?: StorablePaymentMethodConfiguration & {
868
- merchantInfo?: GooglePayButtonOptions['merchantInfo'];
869
- };
870
- applePay?: {
871
- clientDomain?: string;
872
- } & StorablePaymentMethodConfiguration;
873
- };
874
- returnInfo?: ReturnInfo;
875
- events?: PayrailsSDKEvents;
876
- translations?: {
877
- [key: string]: any;
878
- googlePayButton?: GooglePayDropinOptions['translations'];
879
- cardPaymentButton?: CardPaymentButtonOptions['translations'];
880
- cardForm?: CardFormOptions['translations'];
881
- paymentResult?: {
882
- success?: string;
883
- fail?: string;
884
- };
885
- paypalButton?: PaypalDropinOptions['translations'];
886
- mercadoPago?: GenericRedirectDropinOptions['translations'];
887
- };
888
- styles?: {
889
- [key: string]: any;
890
- container?: ContainerStyles;
891
- element?: DropinElementStyles;
892
- googlePayButton?: GooglePayButtonOptions['styles'];
893
- paypalButton?: PaypalDropinOptions['styles'];
894
- applePayButton?: ApplePayButtonOptions['styles'];
895
- cardForm?: CardFormOptions['styles'];
896
- cardPaymentButton?: CardPaymentButtonOptions['styles'];
897
- authSuccess?: Partial<CSSStyleDeclaration>;
898
- authFailed?: Partial<CSSStyleDeclaration>;
899
- mercadoPago?: GenericRedirectDropinOptions['styles'];
900
- };
901
- }
902
- interface ContainerStyles {
903
- styles?: Partial<CSSStyleDeclaration>;
943
+ declare class Dropin extends PayrailsElement {
944
+ private collectContainer;
945
+ private readonly clientConfig;
946
+ private readonly dropinConfig;
947
+ private readonly execution;
948
+ private readonly sdkConfig;
949
+ private cardPaymentButton;
950
+ private creditCard;
951
+ private googlePay;
952
+ private applePay;
953
+ private cardForm;
954
+ private paypal;
955
+ private paymentInstallmentsDropdown;
956
+ constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions, execution: WorkflowExecution, sdkConfig: SdkConfiguration);
957
+ private isHppIntegration;
958
+ private createStoredInstrumentElement;
959
+ private createInstallmentsDropdown;
960
+ private getInstallmentOptionsForInstrument;
961
+ private createHppIntegrationElement;
962
+ private get totalPaymentOptions();
963
+ private createCreditCardButton;
964
+ private createGooglePayButton;
965
+ private createPayPalButton;
966
+ private createCardForm;
967
+ private createApplePayButton;
968
+ private createCardPaymentButton;
969
+ private onAuthorizeSuccess;
970
+ private getElementEvents;
971
+ private onAuthorizeFailed;
972
+ private isStoredInstrumentEnabled;
973
+ private applyStyles;
974
+ fetchBinLookup(): Promise<string | BinLookupResponse | undefined>;
975
+ }
976
+ interface StorablePaymentMethodConfiguration extends StoreInstrumentElementOptions {
977
+ showStoredInstruments?: boolean;
978
+ }
979
+ interface DropinOptions {
980
+ paymentMethodsConfiguration?: {
981
+ preselectFirstPaymentOption?: boolean;
982
+ cards?: {
983
+ showCardHolderName?: boolean;
984
+ showExistingCards?: boolean;
985
+ } & StorablePaymentMethodConfiguration;
986
+ payPal?: StorablePaymentMethodConfiguration;
987
+ googlePay?: StorablePaymentMethodConfiguration & {
988
+ merchantInfo?: GooglePayButtonOptions['merchantInfo'];
989
+ };
990
+ applePay?: {
991
+ clientDomain?: string;
992
+ } & StorablePaymentMethodConfiguration;
993
+ };
994
+ returnInfo?: ReturnInfo;
995
+ events?: PayrailsSDKEvents;
996
+ translations?: {
997
+ [key: string]: any;
998
+ googlePayButton?: GooglePayDropinOptions['translations'];
999
+ cardPaymentButton?: CardPaymentButtonOptions['translations'];
1000
+ cardForm?: CardFormOptions['translations'];
1001
+ paymentResult?: {
1002
+ success?: string;
1003
+ fail?: string;
1004
+ };
1005
+ paypalButton?: PaypalDropinOptions['translations'];
1006
+ mercadoPago?: GenericRedirectDropinOptions['translations'];
1007
+ };
1008
+ styles?: {
1009
+ [key: string]: any;
1010
+ container?: ContainerStyles;
1011
+ element?: DropinElementStyles;
1012
+ googlePayButton?: GooglePayButtonOptions['styles'];
1013
+ paypalButton?: PaypalDropinOptions['styles'];
1014
+ applePayButton?: ApplePayButtonOptions['styles'];
1015
+ cardForm?: CardFormOptions['styles'];
1016
+ cardPaymentButton?: CardPaymentButtonOptions['styles'];
1017
+ authSuccess?: Partial<CSSStyleDeclaration>;
1018
+ authFailed?: Partial<CSSStyleDeclaration>;
1019
+ mercadoPago?: GenericRedirectDropinOptions['styles'];
1020
+ };
1021
+ }
1022
+ interface ContainerStyles {
1023
+ styles?: Partial<CSSStyleDeclaration>;
904
1024
  }
905
1025
 
906
- declare class SdkLoader {
907
- static load<T = void>(sdk: ThirdPartySDK, params?: PayPalScriptConfig): Promise<T>;
908
- static reset(): void;
909
- static preloadCardForm(): void;
910
- private static loadScript;
911
- private static loadPayPalScript;
912
- private static readonly scriptMap;
913
- private constructor();
914
- private static logLoadError;
915
- }
916
- interface PayPalScriptConfig {
917
- clientId: string;
918
- currency: string;
919
- vault: boolean;
920
- intent: 'tokenize' | 'capture' | 'authorize';
921
- }
922
- declare enum ThirdPartySDK {
923
- ApplePay = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js",
924
- GooglePay = "https://pay.google.com/gp/p/js/pay.js",
925
- PayPal = "paypal-sdk"
1026
+ declare class SdkLoader {
1027
+ static load<T = void>(sdk: ThirdPartySDK, params?: PayPalScriptConfig): Promise<T>;
1028
+ static reset(): void;
1029
+ static preloadCardForm(): void;
1030
+ private static loadScript;
1031
+ private static loadPayPalScript;
1032
+ private static readonly scriptMap;
1033
+ private constructor();
1034
+ private static logLoadError;
1035
+ }
1036
+ interface PayPalScriptConfig {
1037
+ clientId: string;
1038
+ currency: string;
1039
+ vault: boolean;
1040
+ intent: 'tokenize' | 'capture' | 'authorize';
1041
+ }
1042
+ declare enum ThirdPartySDK {
1043
+ ApplePay = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js",
1044
+ GooglePay = "https://pay.google.com/gp/p/js/pay.js",
1045
+ PayPal = "paypal-sdk"
926
1046
  }
927
1047
 
928
- type FraudNetPageId = 'home-page' | 'search-result-page' | 'category-page' | 'product-detail-page' | 'cart-page' | 'inline-cart-page' | 'checkout-page';
929
- declare class FraudNet implements Mountable {
930
- private pageId;
931
- private execution;
932
- private environment;
933
- constructor(pageId: FraudNetPageId, execution: WorkflowExecution, environment: PayrailsClientOptions['environment']);
934
- readonly guid: any;
935
- mount(): void;
936
- unmount(): void;
937
- private loadFraudnet;
938
- private readonly fnclsVal;
939
- private readonly configId;
940
- private readonly scriptId;
941
- private get payPalConfig();
942
- private createFraudnetConfig;
1048
+ type FraudNetPageId = 'home-page' | 'search-result-page' | 'category-page' | 'product-detail-page' | 'cart-page' | 'inline-cart-page' | 'checkout-page';
1049
+ declare class FraudNet implements Mountable {
1050
+ private pageId;
1051
+ private execution;
1052
+ private environment;
1053
+ constructor(pageId: FraudNetPageId, execution: WorkflowExecution, environment: PayrailsClientOptions['environment']);
1054
+ readonly guid: any;
1055
+ mount(): void;
1056
+ unmount(): void;
1057
+ private loadFraudnet;
1058
+ private readonly fnclsVal;
1059
+ private readonly configId;
1060
+ private readonly scriptId;
1061
+ private get payPalConfig();
1062
+ private createFraudnetConfig;
943
1063
  }
944
1064
 
945
- interface PayrailsClientOptions {
946
- environment?: PayrailsEnvironment;
947
- events?: {
948
- onClientInitialized: (execution?: WorkflowExecution) => void;
949
- };
950
- redirectFor3DS?: boolean;
951
- returnInfo?: ReturnInfo;
952
- telemetry?: {
953
- enabled?: boolean;
954
- logLevel?: LogLevel$1;
955
- };
956
- }
957
- declare class Payrails {
958
- private sdkConfiguration;
959
- private vaultClient;
960
- private execution;
961
- private options?;
962
- private __container;
963
- private __cardForm;
964
- private __cardList;
965
- private __cardPaymentButton;
966
- private __fraudNet;
967
- private __paypalButton;
968
- private __genericRedirectButton;
969
- private __dropin;
970
- static preloadCardForm: typeof SdkLoader.preloadCardForm;
971
- static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
972
- update(amount: PayrailsAmount): void;
973
- collectContainer(containerOptions: CollectContainerOptions): PayrailsCollectContainer;
974
- googlePayButton(options: GooglePayButtonOptions): GooglePayButton;
975
- isGooglePayAvailable(merchantInfo: google.payments.api.MerchantInfo): Promise<boolean>;
976
- applePayButton(options: ApplePayButtonOptions): ApplePayButton;
977
- isApplePayAvailable(): Promise<boolean>;
978
- cardList(options?: CardListOptions): CardList;
979
- cardForm(options?: CardFormOptions): CardForm;
980
- dropin(options: DropinOptions): Dropin;
981
- getSavedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
982
- getSavedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
983
- getSavedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
984
- getStoredInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
985
- getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
986
- paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
987
- paypalButton(options?: PaypalButtonOptions): PaypalButton;
988
- genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
989
- getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
990
- fraudNet(pageId: FraudNetPageId): FraudNet;
991
- private get safeExecution();
992
- private logIntegrationMode;
993
- private constructor();
994
- private getContainerLayout;
995
- }
996
- interface InitOptions {
997
- version: string;
998
- data: string;
999
- }
1000
- interface PaymentEvents {
1001
- onAuthorizeSuccess?: (e?: any) => void;
1002
- onAuthorizeFailed?: (e?: any) => void;
1003
- onPaymentButtonClicked?: (e?: {
1004
- bin?: string;
1005
- }) => Promise<boolean>;
1006
- onPaymentSessionExpired?: () => void;
1007
- onThreeDSecureChallenge?: () => void;
1008
- }
1009
- interface UIEvents {
1010
- onSaveInstrumentCheckboxChanged?: ({ checked }: {
1011
- checked: boolean;
1012
- }) => void;
1013
- }
1014
- type PayrailsSDKEvents = PaymentEvents & UIEvents;
1015
- interface SdkConfiguration {
1016
- token: string;
1017
- amount: PayrailsAmount;
1018
- holderReference: string;
1019
- usePayrailsFrames: boolean;
1020
- vaultConfiguration: {
1021
- cardTableName: string;
1022
- token: string;
1023
- vaultId: string;
1024
- vaultUrl: string;
1025
- providerId: string;
1026
- providerConfigId: string;
1027
- vaultType: 'Skyflow' | 'Payrails' | 'Test';
1028
- encryptionPublicKey?: string;
1029
- links: {
1030
- saveInstrument: {
1031
- href: string;
1032
- };
1033
- };
1034
- };
1035
- execution?: WorkflowExecutionResponse;
1036
- }
1037
- interface PayrailsAmount {
1038
- value: string;
1039
- currency: string;
1040
- }
1041
- declare enum PayrailsEnvironment {
1042
- TEST = "TEST",
1043
- PRODUCTION = "PRODUCTION"
1065
+ interface PayrailsClientOptions {
1066
+ environment?: PayrailsEnvironment;
1067
+ events?: {
1068
+ onClientInitialized: (execution?: WorkflowExecution) => void;
1069
+ };
1070
+ redirectFor3DS?: boolean;
1071
+ returnInfo?: ReturnInfo;
1072
+ telemetry?: {
1073
+ enabled?: boolean;
1074
+ logLevel?: LogLevel$1;
1075
+ };
1076
+ }
1077
+ declare class Payrails {
1078
+ private sdkConfiguration;
1079
+ private vaultClient;
1080
+ private execution;
1081
+ private options?;
1082
+ private __container;
1083
+ private __cardForm;
1084
+ private __cardList;
1085
+ private __cardPaymentButton;
1086
+ private __fraudNet;
1087
+ private __paypalButton;
1088
+ private __genericRedirectButton;
1089
+ private __dropin;
1090
+ static preloadCardForm: typeof SdkLoader.preloadCardForm;
1091
+ static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
1092
+ update(amount: PayrailsAmount): void;
1093
+ collectContainer(containerOptions: CollectContainerOptions): PayrailsCollectContainer;
1094
+ googlePayButton(options: GooglePayButtonOptions): GooglePayButton;
1095
+ isGooglePayAvailable(merchantInfo: google.payments.api.MerchantInfo): Promise<boolean>;
1096
+ applePayButton(options: ApplePayButtonOptions): ApplePayButton;
1097
+ isApplePayAvailable(): Promise<boolean>;
1098
+ cardList(options?: CardListOptions): CardList;
1099
+ cardForm(options?: CardFormOptions): CardForm;
1100
+ dropin(options: DropinOptions): Dropin;
1101
+ getSavedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
1102
+ getSavedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
1103
+ getSavedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
1104
+ getStoredInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
1105
+ getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
1106
+ paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
1107
+ paypalButton(options?: PaypalButtonOptions): PaypalButton;
1108
+ genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
1109
+ getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
1110
+ fraudNet(pageId: FraudNetPageId): FraudNet;
1111
+ private get safeExecution();
1112
+ private logIntegrationMode;
1113
+ private constructor();
1114
+ private getContainerLayout;
1115
+ binLookup(): Promise<any>;
1116
+ }
1117
+ interface InitOptions {
1118
+ version: string;
1119
+ data: string;
1120
+ }
1121
+ interface PaymentEvents {
1122
+ onAuthorizeSuccess?: (e?: any) => void;
1123
+ onAuthorizeFailed?: (e?: any) => void;
1124
+ onPaymentButtonClicked?: (e?: {
1125
+ bin?: string;
1126
+ }) => Promise<boolean>;
1127
+ onPaymentSessionExpired?: () => void;
1128
+ onThreeDSecureChallenge?: () => void;
1129
+ }
1130
+ interface UIEvents {
1131
+ onSaveInstrumentCheckboxChanged?: ({ checked }: {
1132
+ checked: boolean;
1133
+ }) => void;
1134
+ }
1135
+ type onPaymentMethodSelectedParams = {
1136
+ paymentMethod?: StorablePaymentCompositionOption;
1137
+ instrument?: StoredPaymentInstrument<CardMetadata & PayPalMetadata>;
1138
+ };
1139
+ interface DropinEvents {
1140
+ onPaymentOptionSelected?: (e: onPaymentMethodSelectedParams) => void;
1141
+ }
1142
+ type PayrailsSDKEvents = PaymentEvents & UIEvents & DropinEvents;
1143
+ interface SdkConfiguration {
1144
+ token: string;
1145
+ amount: PayrailsAmount;
1146
+ holderReference: string;
1147
+ usePayrailsFrames: boolean;
1148
+ links?: {
1149
+ binLookup: {
1150
+ method: 'GET' | 'POST';
1151
+ href: string;
1152
+ };
1153
+ };
1154
+ vaultConfiguration: {
1155
+ cardTableName: string;
1156
+ token: string;
1157
+ vaultId: string;
1158
+ vaultUrl: string;
1159
+ providerId: string;
1160
+ providerConfigId: string;
1161
+ vaultType: 'Skyflow' | 'Payrails' | 'Test';
1162
+ encryptionPublicKey?: string;
1163
+ links: {
1164
+ saveInstrument: {
1165
+ href: string;
1166
+ };
1167
+ };
1168
+ };
1169
+ execution?: WorkflowExecutionResponse;
1170
+ }
1171
+ interface PayrailsAmount {
1172
+ value: string;
1173
+ currency: string;
1174
+ }
1175
+ declare enum PayrailsEnvironment {
1176
+ TEST = "TEST",
1177
+ PRODUCTION = "PRODUCTION"
1044
1178
  }
1045
1179
 
1046
- type TokenizedCollectResult = {
1047
- skyflow_id?: string;
1048
- card_number?: string;
1049
- cardholder_name?: string;
1050
- expiry_month?: string;
1051
- expiry_year?: string;
1052
- security_code: string;
1053
- instrumentId?: string;
1054
- };
1055
- interface EncryptedCollectResult {
1056
- vaultProviderConfigId: string;
1057
- encryptedData: string;
1058
- }
1059
- interface CollectElementOptions {
1060
- type: ElementType;
1061
- label?: string;
1062
- placeholder?: string;
1063
- altText?: string;
1064
- format?: string;
1065
- inputStyles?: object;
1066
- labelStyles?: object;
1067
- errorTextStyles?: object;
1068
- required?: boolean;
1069
- enableCardIcon?: boolean;
1070
- }
1071
- type PayrailsContainerType = 'COLLECT' | 'COMPOSABLE';
1072
- interface CollectContainerOptions {
1073
- layout?: number[];
1074
- cardTableName?: string;
1075
- containerType?: PayrailsContainerType;
1076
- styles?: {
1077
- base?: Partial<CSSStyleDeclaration>;
1078
- };
1079
- errorTextStyles?: {
1080
- base?: Partial<CSSStyleDeclaration>;
1081
- };
1082
- }
1083
- type PayrailsSecureFieldEvent = 'CHANGE' | 'FOCUS' | 'BLUR' | 'READY' | 'SUBMIT';
1084
- interface PayrailsSecureField {
1085
- on(eventName: PayrailsSecureFieldEvent, handler: any): void;
1086
- mount?: (domElement: any) => void;
1087
- unmount?: () => void;
1088
- getState?: () => {
1089
- isEmpty: boolean;
1090
- isComplete: boolean;
1091
- isValid: boolean;
1092
- isFocused: boolean;
1093
- value: unknown;
1094
- required: boolean;
1095
- };
1096
- isValidElement?: () => boolean;
1097
- setError?: (clientErrorText: string) => void;
1098
- resetError?: () => void;
1099
- setValue?: (elementValue: string) => void;
1100
- clearValue?: () => void;
1101
- }
1102
- declare class PayrailsCollectContainer implements Mountable {
1103
- private sdkConfig;
1104
- bin: string;
1105
- readonly id = "payrails-container-wrapper";
1106
- private static instance;
1107
- private readonly __container;
1108
- private element;
1109
- private readonly cardTableName;
1110
- private readonly containerType;
1111
- constructor(__client: Skyflow, options: CollectContainerOptions, sdkConfig: SdkConfiguration);
1112
- static init(vaultClient: Skyflow, options: CollectContainerOptions, sdkConfig: SdkConfiguration): PayrailsCollectContainer;
1113
- createCollectElement(options: CollectElementOptions): PayrailsSecureField;
1114
- mount(selector: string): void;
1115
- unmount(): void;
1116
- collect(): Promise<TokenizedCollectResult | EncryptedCollectResult>;
1117
- private collectSkyflowData;
1118
- private collectPayrailsData;
1119
- tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
1120
- private constructSaveInstrumentBody;
1121
- private attachCustomEventHandler;
1122
- private formatBin;
1123
- private get elementToFieldMap();
1124
- }
1125
- interface TokenizeOptions {
1126
- futureUsage?: 'CardOnFile' | 'Subscription' | 'UnscheduledCardOnFile';
1127
- storeInstrument?: boolean;
1180
+ type TokenizedCollectResult = {
1181
+ skyflow_id?: string;
1182
+ card_number?: string;
1183
+ cardholder_name?: string;
1184
+ expiry_month?: string;
1185
+ expiry_year?: string;
1186
+ security_code: string;
1187
+ instrumentId?: string;
1188
+ };
1189
+ interface EncryptedCollectResult {
1190
+ vaultProviderConfigId: string;
1191
+ encryptedData: string;
1192
+ }
1193
+ interface CollectElementOptions {
1194
+ type: ElementType;
1195
+ label?: string;
1196
+ placeholder?: string;
1197
+ altText?: string;
1198
+ format?: string;
1199
+ inputStyles?: object;
1200
+ labelStyles?: object;
1201
+ errorTextStyles?: object;
1202
+ required?: boolean;
1203
+ enableCardIcon?: boolean;
1204
+ }
1205
+ type PayrailsContainerType = 'COLLECT' | 'COMPOSABLE';
1206
+ interface CollectContainerOptions {
1207
+ layout?: number[];
1208
+ cardTableName?: string;
1209
+ containerType?: PayrailsContainerType;
1210
+ styles?: {
1211
+ base?: Partial<CSSStyleDeclaration>;
1212
+ };
1213
+ errorTextStyles?: {
1214
+ base?: Partial<CSSStyleDeclaration>;
1215
+ };
1216
+ }
1217
+ type PayrailsSecureFieldEvent = 'CHANGE' | 'FOCUS' | 'BLUR' | 'READY' | 'SUBMIT';
1218
+ interface PayrailsSecureField {
1219
+ on(eventName: PayrailsSecureFieldEvent, handler: any): void;
1220
+ mount?: (domElement: any) => void;
1221
+ unmount?: () => void;
1222
+ getState?: () => {
1223
+ isEmpty: boolean;
1224
+ isComplete: boolean;
1225
+ isValid: boolean;
1226
+ isFocused: boolean;
1227
+ value: unknown;
1228
+ required: boolean;
1229
+ };
1230
+ isValidElement?: () => boolean;
1231
+ setError?: (clientErrorText: string) => void;
1232
+ resetError?: () => void;
1233
+ setValue?: (elementValue: string) => void;
1234
+ clearValue?: () => void;
1235
+ }
1236
+ declare class PayrailsCollectContainer implements Mountable {
1237
+ private sdkConfig;
1238
+ bin: string;
1239
+ isBinLookupEnabled: boolean;
1240
+ readonly id = "payrails-container-wrapper";
1241
+ private static instance;
1242
+ private readonly __container;
1243
+ private element;
1244
+ private readonly cardTableName;
1245
+ private readonly containerType;
1246
+ constructor(__client: Skyflow, options: CollectContainerOptions, sdkConfig: SdkConfiguration);
1247
+ static init(vaultClient: Skyflow, options: CollectContainerOptions, sdkConfig: SdkConfiguration): PayrailsCollectContainer;
1248
+ createCollectElement(options: CollectElementOptions): PayrailsSecureField;
1249
+ mount(selector: string): void;
1250
+ unmount(): void;
1251
+ collect(): Promise<TokenizedCollectResult | EncryptedCollectResult>;
1252
+ private collectSkyflowData;
1253
+ private collectPayrailsData;
1254
+ tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
1255
+ private constructSaveInstrumentBody;
1256
+ private attachCustomEventHandler;
1257
+ private formatBin;
1258
+ private get elementToFieldMap();
1259
+ fetchBinLookup: (bin: string) => Promise<string | BinLookupResponse>;
1260
+ }
1261
+ interface TokenizeOptions {
1262
+ futureUsage?: 'CardOnFile' | 'Subscription' | 'UnscheduledCardOnFile';
1263
+ storeInstrument?: boolean;
1128
1264
  }
1129
1265
 
1130
1266
  export { ApplePayButtonOptions, AuthorizationFailureReasons, CardFormOptions, CardListOptions, CardPaymentButtonOptions, DropinOptions, ElementType, GooglePayButtonOptions, INTEGRATION_TYPE, InitOptions, PAYMENT_METHOD_CODES, PaymentEvents, PaypalButtonOptions, Payrails, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsEnvironment, PayrailsSecureField, PayrailsSecureFieldEvent, SaveInstrumentResponse, WorkflowExecutionResponse };