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