@payrails/web-sdk 5.29.0-RC.0 → 5.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/payrails.d.ts CHANGED
@@ -1,282 +1,144 @@
1
- import * as _payrails_iframe_event_bus from '@payrails/iframe-event-bus';
2
1
  import { LogLevel as LogLevel$1 } from '@payrails/logger';
2
+ import * as _payrails_iframe_event_bus from '@payrails/iframe-event-bus';
3
3
  import { FraudProvider } from '@payrails/fraud-sdk';
4
4
 
5
- declare enum PAYMENT_METHOD_CODES {
6
- 'CARD' = "card",
7
- 'GOOGLE_PAY' = "googlePay",
8
- 'PAYPAL' = "payPal",
9
- 'APPLE_PAY' = "applePay",
10
- 'GENERIC_REDIRECT' = "genericRedirect",
11
- 'MERCADO_PAGO' = "mercadoPago",
12
- 'PIX' = "pix"
5
+ interface Mountable {
6
+ mount(selector: string | PayrailsElement): void;
7
+ unmount(): void;
13
8
  }
14
- declare enum PAYMENT_INSTRUMENT_STATUS {
15
- 'ENABLED' = "enabled",
16
- 'CREATED' = "created",
17
- 'DELETED' = "deleted",
18
- 'DISABLED' = "disabled",
19
- 'INVALID' = "invalid",
20
- 'TRANSIENT' = "transient"
9
+ interface ElementOptions {
10
+ id?: string;
11
+ dataTestId?: string;
12
+ className?: string | string[];
13
+ styles?: Partial<CSSStyleDeclaration>;
21
14
  }
22
- declare class WorkflowExecution {
23
- private static _response;
24
- static get response(): WorkflowExecutionResponse;
25
- static setResponse(response: WorkflowExecutionResponse): typeof WorkflowExecution;
26
- static get lookup(): {
27
- httpCode: number;
28
- body: {
29
- data: {
30
- paymentCompositionOptions: Array<StorablePaymentCompositionOption>;
31
- };
32
- links: {
33
- authorize: {
34
- href: string;
35
- method: "POST";
36
- };
37
- execution: string;
38
- };
39
- name: "lookup";
40
- };
41
- } | undefined;
42
- static get holderReference(): string;
43
- static get savedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
44
- static get savedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
45
- static get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
46
- static get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
47
- static get paypalConfig(): PayPalConfig;
48
- static get googlePayConfig(): GooglePayConfig[];
49
- static isPaymentMethodAvailable(paymentMethod: PAYMENT_METHOD_CODES): boolean;
50
- static get applePayConfig(): {
51
- merchantIdentifier: string;
52
- supportedNetworks: string[];
53
- countryCode: string;
54
- merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
55
- requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
15
+ declare class PayrailsElement implements Mountable {
16
+ protected element: HTMLElement;
17
+ protected subElements: Array<Mountable>;
18
+ readonly id: string | undefined;
19
+ readonly dataTestId: string | undefined;
20
+ protected eventBus: _payrails_iframe_event_bus.IframeEventBus;
21
+ constructor(elementType: string, { id, className, dataTestId }?: ElementOptions);
22
+ get parentElement(): HTMLElement | null;
23
+ get selector(): string;
24
+ mount(location: string): void;
25
+ protected clean(): void;
26
+ unmount(): void;
27
+ }
28
+
29
+ interface IAddress {
30
+ country?: {
31
+ code?: string;
32
+ fullName?: string;
33
+ iso3?: string;
56
34
  };
57
- static get url(): string;
58
- static get meta(): {
59
- customer?: {
60
- country?: {
61
- code?: string;
62
- };
35
+ postalCode?: string;
36
+ }
37
+ interface IOnChange {
38
+ isValid: boolean;
39
+ billingAddress?: IAddress;
40
+ }
41
+ interface AddressSelectorElementOptions extends ElementOptions {
42
+ translations?: {
43
+ labels?: {
44
+ countrySelector?: string;
45
+ postalCodeInput?: string;
63
46
  };
64
- order?: {
65
- billingAddress?: {
66
- country?: {
67
- code?: string;
68
- };
69
- };
47
+ placeholders?: {
48
+ postalCodeInput?: string;
49
+ countrySelector?: string;
70
50
  };
71
51
  };
72
- static get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
73
- static get authorizeLink(): string | undefined;
74
- static get createSessionLink(): string | undefined;
75
- static get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
76
- static get storedDropinInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
77
- static getFullPaymentMethodConfig(paymentMethod: PAYMENT_METHOD_CODES): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
78
- static isAddressSelectorEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
79
- static isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
80
- static getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
81
- static getStoredInstrumentForPaymentMethod<T = CardMetadata | PayPalMetadata>(paymentMethod: PAYMENT_METHOD_CODES): Array<StoredPaymentInstrument<T>>;
82
- static getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
83
- id: string;
84
- description?: string;
85
- status: PAYMENT_INSTRUMENT_STATUS;
86
- integrationType: INTEGRATION_TYPE;
87
- config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
88
- clientConfig?: {
89
- flow?: PAYMENT_CLIENT_FLOW;
90
- supportsInstallments?: boolean;
91
- installments?: PaymentInstallmentsConfig;
92
- supportsBillingInfo?: boolean;
52
+ styles?: {
53
+ wrapper?: Partial<CSSStyleDeclaration>;
54
+ countrySelector?: {
55
+ wrapper?: Partial<CSSStyleDeclaration>;
56
+ element?: Partial<CSSStyleDeclaration>;
57
+ label?: Partial<CSSStyleDeclaration>;
93
58
  };
94
- paymentMethodCode: PAYMENT_METHOD_CODES;
95
- } | undefined;
96
- static getPaymentMethodConfig(paymentMethod: StorablePaymentCompositionOption): {
97
- id: string;
98
- description?: string;
99
- status: PAYMENT_INSTRUMENT_STATUS;
100
- integrationType: INTEGRATION_TYPE;
101
- config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
102
- clientConfig?: {
103
- flow?: PAYMENT_CLIENT_FLOW;
104
- supportsInstallments?: boolean;
105
- installments?: PaymentInstallmentsConfig;
106
- supportsBillingInfo?: boolean;
59
+ postalCodeInput?: {
60
+ wrapper?: Partial<CSSStyleDeclaration>;
61
+ element?: Partial<CSSStyleDeclaration>;
62
+ label?: Partial<CSSStyleDeclaration>;
107
63
  };
108
- paymentMethodCode: PAYMENT_METHOD_CODES;
109
64
  };
110
- }
111
- interface WorkflowExecutionResponse {
112
- id: string;
113
- merchantReference: string;
114
- holderReference: string;
115
- actionRequired?: string;
116
- meta: {
117
- customer?: {
118
- country?: {
119
- code?: string;
120
- };
121
- };
122
- order?: {
123
- billingAddress?: {
124
- country?: {
125
- code?: string;
126
- };
127
- };
128
- };
65
+ events?: {
66
+ onBillingAddressChanged?: (e: IOnChange) => void;
129
67
  };
130
- status: Array<{
131
- code: string;
132
- time: string;
133
- }>;
134
- initialResults: Array<{
135
- httpCode: number;
136
- body: {
137
- data: {
138
- paymentCompositionOptions: Array<StorablePaymentCompositionOption>;
139
- };
140
- links: {
141
- authorize: {
142
- href: string;
143
- method: 'POST';
144
- };
145
- execution: string;
146
- };
147
- name: 'lookup';
148
- };
149
- }>;
150
- links: {
151
- startPaymentSession?: {
152
- href: string;
153
- method: 'POST';
154
- };
155
- confirm?: {
156
- href: string;
157
- action?: {
158
- parameters?: {
159
- orderId?: string;
160
- tokenId?: string;
161
- };
162
- };
68
+ }
69
+
70
+ interface StoreInstrumentElementOptions extends ElementOptions {
71
+ showStoreInstrumentCheckbox?: boolean;
72
+ alwaysStoreInstrument?: boolean;
73
+ defaultStoreInstrumentState?: 'checked' | 'unchecked';
74
+ translations?: {
75
+ labels?: {
76
+ storeInstrument?: string;
77
+ saveInstrument?: string;
163
78
  };
164
- redirect?: string;
165
- '3ds'?: string;
166
- self: string;
167
79
  };
168
- workflow: {
169
- code: string;
170
- version: number;
80
+ styles?: {
81
+ storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
171
82
  };
83
+ events?: PayrailsSDKEvents;
172
84
  }
173
- interface BasePaymentMethodConfig {
174
- paymentMethodCode: PAYMENT_METHOD_CODES;
85
+ declare class StoreInstrumentCheckbox extends PayrailsElement {
86
+ private options;
87
+ constructor(options: StoreInstrumentElementOptions);
88
+ get isChecked(): boolean;
89
+ private createHTML;
90
+ private applyStyles;
91
+ private addListeners;
175
92
  }
176
- interface BaseInstallmentOption {
177
- count: number;
178
- amount: number;
93
+ declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
94
+ protected options?: StoreInstrumentElementOptions | undefined;
95
+ protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
96
+ protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
97
+ protected get shouldStoreInstrument(): boolean;
179
98
  }
180
- interface PaymentInstallmentsConfig {
181
- [key: string]: BaseInstallmentOption[];
99
+
100
+ interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
101
+ clientDomain?: string;
102
+ showPaymentMethodLogo?: boolean;
103
+ events?: PaymentEvents & {
104
+ onApplePayAvailable?: () => void;
105
+ };
106
+ styles?: {
107
+ type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
108
+ style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
109
+ } & StoreInstrumentElementOptions['styles'];
182
110
  }
183
- interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C = undefined | ApplePayConfig | PayPalConfig | GooglePayConfig> extends BasePaymentMethodConfig {
184
- id: string;
185
- description?: string;
186
- status: PAYMENT_INSTRUMENT_STATUS;
187
- integrationType: INTEGRATION_TYPE;
188
- config: C;
189
- clientConfig?: {
190
- flow?: PAYMENT_CLIENT_FLOW;
191
- supportsInstallments?: boolean;
192
- installments?: PaymentInstallmentsConfig;
193
- supportsBillingInfo?: boolean;
194
- };
195
- paymentInstruments?: Array<StoredPaymentInstrument<I>>;
196
- }
197
- interface GooglePayConfig {
198
- parameters: {
199
- allowedAuthMethods: google.payments.api.CardAuthMethod[];
200
- allowedCardNetworks: google.payments.api.CardNetwork[];
201
- };
202
- tokenizationSpecification: google.payments.api.PaymentMethodTokenizationSpecification;
203
- type: google.payments.api.PaymentMethodType;
204
- }
205
- interface PayPalConfig {
206
- clientId: string;
207
- merchantId: string;
208
- captureMode: 'Delayed' | 'Instant' | 'Manual';
209
- integrationMode: 'express' | 'normal';
210
- }
211
- interface ApplePayConfig {
212
- parameters: {
213
- merchantIdentifier: string;
214
- supportedNetworks: string[];
215
- countryCode: string;
216
- merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
217
- requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
218
- };
219
- type: string;
220
- }
221
- interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata> {
222
- id: string;
223
- status: PAYMENT_INSTRUMENT_STATUS;
224
- paymentMethod: PAYMENT_METHOD_CODES;
225
- displayName?: string;
226
- data?: T;
227
- }
228
- interface PayPalMetadata {
229
- email?: string;
230
- }
231
- interface CardMetadata {
232
- bin?: string;
233
- suffix?: string;
234
- network?: string;
235
- binLookup?: {
236
- issuerCountry: {
237
- code: string;
238
- name: string;
239
- iso3: string;
240
- };
241
- };
242
- }
243
- declare enum PAYMENT_CLIENT_FLOW {
244
- 'REDIRECT' = "redirect",
245
- 'DIRECT' = "direct"
111
+ declare global {
112
+ interface Window {
113
+ ApplePaySession?: ApplePaySession;
114
+ }
246
115
  }
247
- declare enum INTEGRATION_TYPE {
248
- API = "api",
249
- HPP = "hpp"
116
+ declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
117
+ protected options: ApplePayButtonOptions;
118
+ private appleButton;
119
+ private paymentExecutor;
120
+ static isApplePayAvailable(): Promise<boolean>;
121
+ constructor(options: ApplePayButtonOptions);
122
+ mount(location: string): void;
123
+ unmount(): void;
124
+ private mountApplePayButton;
125
+ private createApplePaySession;
126
+ private onApplePayAuthorized;
250
127
  }
251
128
 
252
- interface SaveInstrumentResponse {
253
- id: string;
254
- createdAt: string;
255
- holderId: string;
256
- paymentMethod: PAYMENT_METHOD_CODES.CARD;
257
- status: PAYMENT_INSTRUMENT_STATUS;
258
- data: {
259
- bin: string;
260
- binLookup?: {
261
- bin: string;
262
- network: string;
263
- issuer?: string;
264
- issuerCountry?: {
265
- code?: string;
266
- name?: string;
267
- iso3?: string;
268
- };
269
- type?: string;
270
- };
271
- holderName?: string;
272
- network: string;
273
- suffix: string;
274
- expiryMonth?: string;
275
- expiryYear?: string;
276
- };
277
- fingerprint?: string;
278
- futureUsage?: string;
279
- }
129
+ declare const regexes: {
130
+ visa: RegExp;
131
+ mastercard: RegExp;
132
+ amex: RegExp;
133
+ diners: RegExp;
134
+ discover: RegExp;
135
+ jcb: RegExp;
136
+ hipercard: RegExp;
137
+ unionpay: RegExp;
138
+ maestro: RegExp;
139
+ elo: RegExp;
140
+ };
141
+ type CardNetwork = keyof typeof regexes;
280
142
 
281
143
  interface BinLookupResponse {
282
144
  bin: string;
@@ -609,30 +471,6 @@ declare class Skyflow {
609
471
  static get ValidationRuleType(): typeof ValidationRuleType;
610
472
  }
611
473
 
612
- interface Mountable {
613
- mount(selector: string | PayrailsElement): void;
614
- unmount(): void;
615
- }
616
- interface ElementOptions {
617
- id?: string;
618
- dataTestId?: string;
619
- className?: string | string[];
620
- styles?: Partial<CSSStyleDeclaration>;
621
- }
622
- declare class PayrailsElement implements Mountable {
623
- protected element: HTMLElement;
624
- protected subElements: Array<Mountable>;
625
- readonly id: string | undefined;
626
- readonly dataTestId: string | undefined;
627
- protected eventBus: _payrails_iframe_event_bus.IframeEventBus;
628
- constructor(elementType: string, { id, className, dataTestId }?: ElementOptions);
629
- get parentElement(): HTMLElement | null;
630
- get selector(): string;
631
- mount(location: string): void;
632
- protected clean(): void;
633
- unmount(): void;
634
- }
635
-
636
474
  declare enum ElementType {
637
475
  CARD_NUMBER = "CARD_NUMBER",
638
476
  CARDHOLDER_NAME = "CARDHOLDER_NAME",
@@ -697,7 +535,7 @@ interface PayrailsSecureField {
697
535
  resetError?: () => void;
698
536
  setValue?: (elementValue: string) => void;
699
537
  clearValue?: () => void;
700
- update: (data: CollectElementOptions) => void;
538
+ update?: (data: Partial<CollectElementOptions>) => void;
701
539
  }
702
540
  declare class PayrailsCollectContainer implements Mountable {
703
541
  bin: string;
@@ -733,61 +571,6 @@ interface TokenizeOptions {
733
571
  storeInstrument?: boolean;
734
572
  }
735
573
 
736
- interface IAddress {
737
- country?: {
738
- code?: string;
739
- fullName?: string;
740
- iso3?: string;
741
- };
742
- postalCode?: string;
743
- }
744
- interface IOnChange {
745
- isValid: boolean;
746
- billingAddress?: IAddress;
747
- }
748
- interface AddressSelectorElementOptions extends ElementOptions {
749
- translations?: {
750
- labels?: {
751
- countrySelector?: string;
752
- postalCodeInput?: string;
753
- };
754
- placeholders?: {
755
- postalCodeInput?: string;
756
- countrySelector?: string;
757
- };
758
- };
759
- styles?: {
760
- wrapper?: Partial<CSSStyleDeclaration>;
761
- countrySelector?: {
762
- wrapper?: Partial<CSSStyleDeclaration>;
763
- element?: Partial<CSSStyleDeclaration>;
764
- label?: Partial<CSSStyleDeclaration>;
765
- };
766
- postalCodeInput?: {
767
- wrapper?: Partial<CSSStyleDeclaration>;
768
- element?: Partial<CSSStyleDeclaration>;
769
- label?: Partial<CSSStyleDeclaration>;
770
- };
771
- };
772
- events?: {
773
- onBillingAddressChanged?: (e: IOnChange) => void;
774
- };
775
- }
776
-
777
- declare const regexes: {
778
- visa: RegExp;
779
- mastercard: RegExp;
780
- amex: RegExp;
781
- diners: RegExp;
782
- discover: RegExp;
783
- jcb: RegExp;
784
- hipercard: RegExp;
785
- unionpay: RegExp;
786
- maestro: RegExp;
787
- elo: RegExp;
788
- };
789
- type CardNetwork = keyof typeof regexes;
790
-
791
574
  interface PaymentInstallmentsElementOptions extends ElementOptions {
792
575
  showPaymentInstallmentsDropdown?: boolean;
793
576
  installmentOptions?: BaseInstallmentOption[] | null;
@@ -825,36 +608,6 @@ declare class PayrailsElementWithPaymentInstallmentsDropdown extends PayrailsEle
825
608
  setDisabled(state: boolean): void;
826
609
  }
827
610
 
828
- interface StoreInstrumentElementOptions extends ElementOptions {
829
- showStoreInstrumentCheckbox?: boolean;
830
- alwaysStoreInstrument?: boolean;
831
- defaultStoreInstrumentState?: 'checked' | 'unchecked';
832
- translations?: {
833
- labels?: {
834
- storeInstrument?: string;
835
- saveInstrument?: string;
836
- };
837
- };
838
- styles?: {
839
- storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
840
- };
841
- events?: PayrailsSDKEvents;
842
- }
843
- declare class StoreInstrumentCheckbox extends PayrailsElement {
844
- private options;
845
- constructor(options: StoreInstrumentElementOptions);
846
- get isChecked(): boolean;
847
- private createHTML;
848
- private applyStyles;
849
- private addListeners;
850
- }
851
- declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
852
- protected options?: StoreInstrumentElementOptions | undefined;
853
- protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
854
- protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
855
- protected get shouldStoreInstrument(): boolean;
856
- }
857
-
858
611
  interface OnChange {
859
612
  isValid: boolean;
860
613
  cardNetwork: CardNetwork | '';
@@ -1327,6 +1080,7 @@ declare class Dropin extends PayrailsElement {
1327
1080
  private loadingScreen;
1328
1081
  constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions);
1329
1082
  private isHppIntegration;
1083
+ private isGenericDirect;
1330
1084
  private createStoredInstrumentElement;
1331
1085
  private createInstallmentsDropdown;
1332
1086
  private getInstallmentOptionsForInstrument;
@@ -1338,6 +1092,7 @@ declare class Dropin extends PayrailsElement {
1338
1092
  private createCardForm;
1339
1093
  private createApplePayButton;
1340
1094
  private createCardPaymentButton;
1095
+ private createGenericDirectElement;
1341
1096
  private onAuthorizeSuccess;
1342
1097
  private getElementEvents;
1343
1098
  private onAuthorizePending;
@@ -1413,39 +1168,509 @@ interface DropinOptions {
1413
1168
  authFailMsg?: AuthFailedMsgOptions['configuration'];
1414
1169
  };
1415
1170
  }
1416
- interface ContainerStyles {
1417
- styles?: Partial<CSSStyleDeclaration>;
1171
+ interface ContainerStyles {
1172
+ styles?: Partial<CSSStyleDeclaration>;
1173
+ }
1174
+
1175
+ declare enum RequestMethod {
1176
+ GET = "GET",
1177
+ POST = "POST",
1178
+ DELETE = "DELETE",
1179
+ PATCH = "PATCH"
1180
+ }
1181
+
1182
+ type Operations = {
1183
+ deleteInstrument: OperationConfig<void, DeleteInstrumentResponse>;
1184
+ updateInstrument: OperationConfig<UpdateInstrumentBody, UpdateInstrumentResponse>;
1185
+ };
1186
+ interface UpdateInstrumentBody {
1187
+ status?: 'enabled' | 'disabled';
1188
+ networkTransactionReference?: string;
1189
+ merchantReference?: string;
1190
+ paymentMethod?: 'applepay' | 'card' | 'googlepay' | 'paypal';
1191
+ default?: boolean;
1192
+ }
1193
+ interface UpdateInstrumentResponse {
1194
+ id: string;
1195
+ createdAt: string;
1196
+ holderId: string;
1197
+ paymentMethod: PAYMENT_METHOD_CODES;
1198
+ status: PAYMENT_INSTRUMENT_STATUS;
1199
+ data: {
1200
+ bin?: string;
1201
+ binLookup?: {
1202
+ bin?: string;
1203
+ network?: string;
1204
+ issuer?: string;
1205
+ issuerCountry?: {
1206
+ code?: string;
1207
+ name?: string;
1208
+ iso3?: string;
1209
+ };
1210
+ type?: string;
1211
+ };
1212
+ holderName?: string;
1213
+ network?: string;
1214
+ suffix?: string;
1215
+ expiryMonth?: string;
1216
+ expiryYear?: string;
1217
+ };
1218
+ fingerprint?: string;
1219
+ futureUsage?: string;
1220
+ }
1221
+ interface DeleteInstrumentResponse {
1222
+ success: boolean;
1223
+ }
1224
+ type RequestCreator<TReq, TOperation extends keyof Operations> = (config: ApiConfig<TReq> & {
1225
+ operation: TOperation;
1226
+ }) => {
1227
+ url: string;
1228
+ body?: TReq;
1229
+ };
1230
+ interface OperationConfig<TReq, TRes> {
1231
+ linkKey: keyof NonNullable<SdkConfiguration['links']>;
1232
+ method: RequestMethod;
1233
+ createRequest: RequestCreator<TReq, keyof Operations>;
1234
+ requestType: TReq;
1235
+ responseType: TRes;
1236
+ }
1237
+ interface ApiConfig<TReq> {
1238
+ operation: keyof Operations;
1239
+ resourceId?: string;
1240
+ body?: TReq;
1241
+ }
1242
+
1243
+ declare class SdkLoader {
1244
+ private static readonly scriptMap;
1245
+ static load<T = void>(sdk: ThirdPartySDK, params?: PayPalScriptConfig): Promise<T>;
1246
+ static reset(): void;
1247
+ static preloadCardForm(): void;
1248
+ private static loadScript;
1249
+ private static loadPayPalScript;
1250
+ private constructor();
1251
+ private static logLoadError;
1252
+ }
1253
+ interface PayPalScriptConfig {
1254
+ clientId: string;
1255
+ currency: string;
1256
+ vault: boolean;
1257
+ intent: 'tokenize' | 'capture' | 'authorize';
1258
+ }
1259
+ declare enum ThirdPartySDK {
1260
+ ApplePay = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",
1261
+ GooglePay = "https://pay.google.com/gp/p/js/pay.js",
1262
+ PayPal = "paypal-sdk"
1263
+ }
1264
+
1265
+ interface QueryDefinition<T> {
1266
+ path: string[];
1267
+ returnType: T;
1268
+ }
1269
+
1270
+ interface ConfigurationQueryTypes {
1271
+ holderReference: QueryDefinition<string>;
1272
+ amount: QueryDefinition<PayrailsAmount>;
1273
+ binLookup: QueryDefinition<Links | undefined>;
1274
+ instrumentDelete: QueryDefinition<Links | undefined>;
1275
+ instrumentUpdate: QueryDefinition<Links | undefined>;
1276
+ executionId: QueryDefinition<string | undefined>;
1277
+ paymentMethodConfig: QueryDefinition<StorablePaymentCompositionOption | undefined>;
1278
+ paymentMethodInstruments: QueryDefinition<StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined>;
1279
+ }
1280
+
1281
+ interface InitOptions {
1282
+ version: string;
1283
+ data: string;
1284
+ }
1285
+
1286
+ interface PayrailsClientOptions {
1287
+ environment?: PayrailsEnvironment;
1288
+ events?: ClientEvents;
1289
+ redirectFor3DS?: boolean;
1290
+ returnInfo?: ReturnInfo;
1291
+ telemetry?: {
1292
+ enabled?: boolean;
1293
+ logLevel?: LogLevel$1;
1294
+ };
1295
+ }
1296
+ declare class Payrails {
1297
+ private vaultClient;
1298
+ private options?;
1299
+ private __container;
1300
+ private __cardForm;
1301
+ private __cardList;
1302
+ private __cardPaymentButton;
1303
+ private __paypalButton;
1304
+ private __genericRedirectButton;
1305
+ private __dropin;
1306
+ static preloadCardForm: typeof SdkLoader.preloadCardForm;
1307
+ static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
1308
+ update(amount: PayrailsAmount): void;
1309
+ collectContainer(containerOptions: CollectContainerOptions): PayrailsCollectContainer;
1310
+ googlePayButton(options: GooglePayButtonOptions): GooglePayButton;
1311
+ isGooglePayAvailable(merchantInfo: google.payments.api.MerchantInfo): Promise<boolean>;
1312
+ applePayButton(options: ApplePayButtonOptions): ApplePayButton;
1313
+ isApplePayAvailable(): Promise<boolean>;
1314
+ cardList(options?: CardListOptions): CardList;
1315
+ cardForm(options?: CardFormOptions): CardForm;
1316
+ dropin(options: DropinOptions): Dropin;
1317
+ getSavedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
1318
+ getSavedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
1319
+ getSavedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
1320
+ query<K extends keyof ConfigurationQueryTypes>(key: K, params?: Record<string, any>): ConfigurationQueryTypes[K]['returnType'] | null;
1321
+ api<TOperation extends keyof Operations>(config: ApiConfig<Operations[TOperation]['requestType']> & {
1322
+ operation: TOperation;
1323
+ }): Promise<Operations[TOperation]['responseType']>;
1324
+ getStoredInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
1325
+ getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
1326
+ paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
1327
+ paypalButton(options?: PaypalButtonOptions): PaypalButton;
1328
+ genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
1329
+ getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
1330
+ private logIntegrationMode;
1331
+ private constructor();
1332
+ private getContainerLayout;
1333
+ binLookup(): Promise<any>;
1334
+ }
1335
+ interface ClientEvents {
1336
+ onClientInitialized?: (execution?: typeof WorkflowExecution) => void;
1337
+ onSessionExpired?: () => Promise<InitOptions>;
1338
+ }
1339
+ interface PaymentEvents {
1340
+ onAuthorizeSuccess?: (e?: any) => void;
1341
+ onAuthorizeFailed?: (e?: any) => void;
1342
+ onAuthorizePending?: (e?: any) => void;
1343
+ onPaymentButtonClicked?: (e?: {
1344
+ bin?: string;
1345
+ }) => Promise<boolean>;
1346
+ onAuthorizeRequestStart?: () => void;
1347
+ onPaymentSessionExpired?: () => void;
1348
+ onThreeDSecureChallenge?: () => void;
1349
+ }
1350
+ interface UIEvents {
1351
+ onSaveInstrumentCheckboxChanged?: ({ checked }: {
1352
+ checked: boolean;
1353
+ }) => void;
1354
+ onBillingAddressChanged?: (e: {
1355
+ isValid: boolean;
1356
+ billingAddress?: IAddress;
1357
+ }) => void;
1358
+ onDeliveryAddressChanged?: (data?: onDeliveryAddressChangedResponse) => Promise<boolean>;
1359
+ }
1360
+ type onPaymentMethodSelectedParams = {
1361
+ paymentMethod?: StorablePaymentCompositionOption;
1362
+ instrument?: StoredPaymentInstrument<CardMetadata & PayPalMetadata>;
1363
+ };
1364
+ interface DropinEvents {
1365
+ onPaymentOptionSelected?: (e: onPaymentMethodSelectedParams) => void;
1366
+ }
1367
+ type PayrailsSDKEvents = PaymentEvents & UIEvents & DropinEvents;
1368
+ type onDeliveryAddressChangedResponse = {
1369
+ deliveryAddress?: {
1370
+ street?: string;
1371
+ doorNumber?: string;
1372
+ complement?: string;
1373
+ area?: string;
1374
+ city?: string;
1375
+ postalCode?: string;
1376
+ state?: string;
1377
+ country?: {
1378
+ code?: string;
1379
+ iso3?: string;
1380
+ name?: string;
1381
+ };
1382
+ latitude?: number;
1383
+ longitude?: number;
1384
+ phone?: {
1385
+ countryCode?: string;
1386
+ number?: string;
1387
+ };
1388
+ name?: string;
1389
+ lastName?: string;
1390
+ email?: string;
1391
+ };
1392
+ };
1393
+ declare enum PayrailsEnvironment {
1394
+ TEST = "TEST",
1395
+ PRODUCTION = "PRODUCTION"
1396
+ }
1397
+
1398
+ type JSONSchemaType = JSONSchemaProperty & {
1399
+ required?: string[];
1400
+ };
1401
+ interface JSONSchemaProperty {
1402
+ type?: 'string' | 'number' | 'boolean' | 'array' | 'object';
1403
+ title?: string;
1404
+ enum?: any[];
1405
+ pattern?: string;
1406
+ minLength?: number;
1407
+ maxLength?: number;
1408
+ errorMessage?: Record<string, string>;
1409
+ properties?: Record<string, JSONSchemaType>;
1410
+ }
1411
+
1412
+ declare enum PAYMENT_METHOD_CODES {
1413
+ 'CARD' = "card",
1414
+ 'GOOGLE_PAY' = "googlePay",
1415
+ 'PAYPAL' = "payPal",
1416
+ 'APPLE_PAY' = "applePay",
1417
+ 'GENERIC_REDIRECT' = "genericRedirect",
1418
+ 'MERCADO_PAGO' = "mercadoPago",
1419
+ 'PIX' = "pix",
1420
+ 'BANK_ACCOUNT' = "bankAccount"
1421
+ }
1422
+ declare enum PAYMENT_INSTRUMENT_STATUS {
1423
+ 'ENABLED' = "enabled",
1424
+ 'CREATED' = "created",
1425
+ 'DELETED' = "deleted",
1426
+ 'DISABLED' = "disabled",
1427
+ 'INVALID' = "invalid",
1428
+ 'TRANSIENT' = "transient"
1429
+ }
1430
+ declare class WorkflowExecution {
1431
+ private static _response;
1432
+ static get response(): WorkflowExecutionResponse;
1433
+ static setResponse(response: WorkflowExecutionResponse): typeof WorkflowExecution;
1434
+ static get lookup(): {
1435
+ httpCode: number;
1436
+ body: {
1437
+ data: {
1438
+ paymentCompositionOptions: Array<StorablePaymentCompositionOption>;
1439
+ };
1440
+ links: {
1441
+ authorize: {
1442
+ href: string;
1443
+ method: "POST";
1444
+ };
1445
+ execution: string;
1446
+ };
1447
+ name: "lookup";
1448
+ };
1449
+ } | undefined;
1450
+ static get holderReference(): string;
1451
+ static get savedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
1452
+ static get savedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
1453
+ static get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
1454
+ static get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
1455
+ static get paypalConfig(): PayPalConfig;
1456
+ static get googlePayConfig(): GooglePayConfig[];
1457
+ static isPaymentMethodAvailable(paymentMethod: PAYMENT_METHOD_CODES): boolean;
1458
+ static get applePayConfig(): {
1459
+ merchantIdentifier: string;
1460
+ supportedNetworks: string[];
1461
+ countryCode: string;
1462
+ merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
1463
+ requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
1464
+ };
1465
+ static get url(): string;
1466
+ static get meta(): {
1467
+ customer?: {
1468
+ country?: {
1469
+ code?: string;
1470
+ };
1471
+ };
1472
+ order?: {
1473
+ billingAddress?: {
1474
+ country?: {
1475
+ code?: string;
1476
+ };
1477
+ };
1478
+ };
1479
+ };
1480
+ static get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
1481
+ static get authorizeLink(): string | undefined;
1482
+ static get createSessionLink(): string | undefined;
1483
+ static get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
1484
+ static get storedDropinInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
1485
+ static getFullPaymentMethodConfig(paymentMethod: PAYMENT_METHOD_CODES): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
1486
+ static isAddressSelectorEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
1487
+ static isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
1488
+ static getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
1489
+ static getStoredInstrumentForPaymentMethod<T = CardMetadata | PayPalMetadata>(paymentMethod: PAYMENT_METHOD_CODES): Array<StoredPaymentInstrument<T>>;
1490
+ static getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
1491
+ id: string;
1492
+ description?: string;
1493
+ status: PAYMENT_INSTRUMENT_STATUS;
1494
+ integrationType: INTEGRATION_TYPE;
1495
+ config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
1496
+ clientConfig?: {
1497
+ flow?: PAYMENT_CLIENT_FLOW;
1498
+ supportsInstallments?: boolean;
1499
+ installments?: PaymentInstallmentsConfig;
1500
+ supportsBillingInfo?: boolean;
1501
+ schema?: JSONSchemaType;
1502
+ };
1503
+ paymentMethodCode: PAYMENT_METHOD_CODES;
1504
+ } | undefined;
1505
+ static getPaymentMethodConfig(paymentMethod: StorablePaymentCompositionOption): {
1506
+ id: string;
1507
+ description?: string;
1508
+ status: PAYMENT_INSTRUMENT_STATUS;
1509
+ integrationType: INTEGRATION_TYPE;
1510
+ config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
1511
+ clientConfig?: {
1512
+ flow?: PAYMENT_CLIENT_FLOW;
1513
+ supportsInstallments?: boolean;
1514
+ installments?: PaymentInstallmentsConfig;
1515
+ supportsBillingInfo?: boolean;
1516
+ schema?: JSONSchemaType;
1517
+ };
1518
+ paymentMethodCode: PAYMENT_METHOD_CODES;
1519
+ };
1520
+ }
1521
+ interface WorkflowExecutionResponse {
1522
+ id: string;
1523
+ merchantReference: string;
1524
+ holderReference: string;
1525
+ actionRequired?: string;
1526
+ meta: {
1527
+ customer?: {
1528
+ country?: {
1529
+ code?: string;
1530
+ };
1531
+ };
1532
+ order?: {
1533
+ billingAddress?: {
1534
+ country?: {
1535
+ code?: string;
1536
+ };
1537
+ };
1538
+ };
1539
+ };
1540
+ status: Array<{
1541
+ code: string;
1542
+ time: string;
1543
+ }>;
1544
+ initialResults: Array<{
1545
+ httpCode: number;
1546
+ body: {
1547
+ data: {
1548
+ paymentCompositionOptions: Array<StorablePaymentCompositionOption>;
1549
+ };
1550
+ links: {
1551
+ authorize: {
1552
+ href: string;
1553
+ method: 'POST';
1554
+ };
1555
+ execution: string;
1556
+ };
1557
+ name: 'lookup';
1558
+ };
1559
+ }>;
1560
+ links: {
1561
+ startPaymentSession?: {
1562
+ href: string;
1563
+ method: 'POST';
1564
+ };
1565
+ confirm?: {
1566
+ href: string;
1567
+ action?: {
1568
+ parameters?: {
1569
+ orderId?: string;
1570
+ tokenId?: string;
1571
+ };
1572
+ };
1573
+ };
1574
+ redirect?: string;
1575
+ '3ds'?: string;
1576
+ self: string;
1577
+ };
1578
+ workflow: {
1579
+ code: string;
1580
+ version: number;
1581
+ };
1582
+ }
1583
+ interface BasePaymentMethodConfig {
1584
+ paymentMethodCode: PAYMENT_METHOD_CODES;
1585
+ }
1586
+ interface BaseInstallmentOption {
1587
+ count: number;
1588
+ amount: number;
1589
+ }
1590
+ interface PaymentInstallmentsConfig {
1591
+ [key: string]: BaseInstallmentOption[];
1592
+ }
1593
+ interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C = undefined | ApplePayConfig | PayPalConfig | GooglePayConfig> extends BasePaymentMethodConfig {
1594
+ id: string;
1595
+ description?: string;
1596
+ status: PAYMENT_INSTRUMENT_STATUS;
1597
+ integrationType: INTEGRATION_TYPE;
1598
+ config: C;
1599
+ clientConfig?: {
1600
+ flow?: PAYMENT_CLIENT_FLOW;
1601
+ supportsInstallments?: boolean;
1602
+ installments?: PaymentInstallmentsConfig;
1603
+ supportsBillingInfo?: boolean;
1604
+ schema?: JSONSchemaType;
1605
+ };
1606
+ paymentInstruments?: Array<StoredPaymentInstrument<I>>;
1607
+ }
1608
+ interface GooglePayConfig {
1609
+ parameters: {
1610
+ allowedAuthMethods: google.payments.api.CardAuthMethod[];
1611
+ allowedCardNetworks: google.payments.api.CardNetwork[];
1612
+ };
1613
+ tokenizationSpecification: google.payments.api.PaymentMethodTokenizationSpecification;
1614
+ type: google.payments.api.PaymentMethodType;
1615
+ }
1616
+ interface PayPalConfig {
1617
+ clientId: string;
1618
+ merchantId: string;
1619
+ captureMode: 'Delayed' | 'Instant' | 'Manual';
1620
+ integrationMode: 'express' | 'normal';
1621
+ }
1622
+ interface ApplePayConfig {
1623
+ parameters: {
1624
+ merchantIdentifier: string;
1625
+ supportedNetworks: string[];
1626
+ countryCode: string;
1627
+ merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
1628
+ requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
1629
+ };
1630
+ type: string;
1631
+ }
1632
+ interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata> {
1633
+ id: string;
1634
+ status: PAYMENT_INSTRUMENT_STATUS;
1635
+ paymentMethod: PAYMENT_METHOD_CODES;
1636
+ displayName?: string;
1637
+ data?: T;
1638
+ }
1639
+ interface PayPalMetadata {
1640
+ email?: string;
1641
+ }
1642
+ interface CardMetadata {
1643
+ bin?: string;
1644
+ suffix?: string;
1645
+ network?: string;
1646
+ binLookup?: {
1647
+ issuerCountry: {
1648
+ code: string;
1649
+ name: string;
1650
+ iso3: string;
1651
+ };
1652
+ };
1653
+ }
1654
+ declare enum PAYMENT_CLIENT_FLOW {
1655
+ 'REDIRECT' = "redirect",
1656
+ 'DIRECT' = "direct"
1418
1657
  }
1419
-
1420
- declare enum RequestMethod {
1421
- GET = "GET",
1422
- POST = "POST",
1423
- DELETE = "DELETE",
1424
- PATCH = "PATCH"
1658
+ declare enum INTEGRATION_TYPE {
1659
+ API = "api",
1660
+ HPP = "hpp"
1425
1661
  }
1426
1662
 
1427
- type Operations = {
1428
- deleteInstrument: OperationConfig<void, DeleteInstrumentResponse>;
1429
- updateInstrument: OperationConfig<UpdateInstrumentBody, UpdateInstrumentResponse>;
1430
- };
1431
- interface UpdateInstrumentBody {
1432
- status?: 'enabled' | 'disabled';
1433
- networkTransactionReference?: string;
1434
- merchantReference?: string;
1435
- paymentMethod?: 'applepay' | 'card' | 'googlepay' | 'paypal';
1436
- default?: boolean;
1437
- }
1438
- interface UpdateInstrumentResponse {
1663
+ interface SaveInstrumentResponse {
1439
1664
  id: string;
1440
1665
  createdAt: string;
1441
1666
  holderId: string;
1442
- paymentMethod: PAYMENT_METHOD_CODES;
1667
+ paymentMethod: PAYMENT_METHOD_CODES.CARD;
1443
1668
  status: PAYMENT_INSTRUMENT_STATUS;
1444
1669
  data: {
1445
- bin?: string;
1670
+ bin: string;
1446
1671
  binLookup?: {
1447
- bin?: string;
1448
- network?: string;
1672
+ bin: string;
1673
+ network: string;
1449
1674
  issuer?: string;
1450
1675
  issuerCountry?: {
1451
1676
  code?: string;
@@ -1455,219 +1680,14 @@ interface UpdateInstrumentResponse {
1455
1680
  type?: string;
1456
1681
  };
1457
1682
  holderName?: string;
1458
- network?: string;
1459
- suffix?: string;
1683
+ network: string;
1684
+ suffix: string;
1460
1685
  expiryMonth?: string;
1461
1686
  expiryYear?: string;
1462
1687
  };
1463
1688
  fingerprint?: string;
1464
1689
  futureUsage?: string;
1465
1690
  }
1466
- interface DeleteInstrumentResponse {
1467
- success: boolean;
1468
- }
1469
- type RequestCreator<TReq, TOperation extends keyof Operations> = (config: ApiConfig<TReq> & {
1470
- operation: TOperation;
1471
- }) => {
1472
- url: string;
1473
- body?: TReq;
1474
- };
1475
- interface OperationConfig<TReq, TRes> {
1476
- linkKey: keyof NonNullable<SdkConfiguration['links']>;
1477
- method: RequestMethod;
1478
- createRequest: RequestCreator<TReq, keyof Operations>;
1479
- requestType: TReq;
1480
- responseType: TRes;
1481
- }
1482
- interface ApiConfig<TReq> {
1483
- operation: keyof Operations;
1484
- resourceId?: string;
1485
- body?: TReq;
1486
- }
1487
-
1488
- declare class SdkLoader {
1489
- private static readonly scriptMap;
1490
- static load<T = void>(sdk: ThirdPartySDK, params?: PayPalScriptConfig): Promise<T>;
1491
- static reset(): void;
1492
- static preloadCardForm(): void;
1493
- private static loadScript;
1494
- private static loadPayPalScript;
1495
- private constructor();
1496
- private static logLoadError;
1497
- }
1498
- interface PayPalScriptConfig {
1499
- clientId: string;
1500
- currency: string;
1501
- vault: boolean;
1502
- intent: 'tokenize' | 'capture' | 'authorize';
1503
- }
1504
- declare enum ThirdPartySDK {
1505
- ApplePay = "https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",
1506
- GooglePay = "https://pay.google.com/gp/p/js/pay.js",
1507
- PayPal = "paypal-sdk"
1508
- }
1509
-
1510
- interface QueryDefinition<T> {
1511
- path: string[];
1512
- returnType: T;
1513
- }
1514
-
1515
- interface ConfigurationQueryTypes {
1516
- holderReference: QueryDefinition<string>;
1517
- amount: QueryDefinition<PayrailsAmount>;
1518
- binLookup: QueryDefinition<Links | undefined>;
1519
- instrumentDelete: QueryDefinition<Links | undefined>;
1520
- instrumentUpdate: QueryDefinition<Links | undefined>;
1521
- executionId: QueryDefinition<string | undefined>;
1522
- paymentMethodConfig: QueryDefinition<StorablePaymentCompositionOption | undefined>;
1523
- paymentMethodInstruments: QueryDefinition<StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined>;
1524
- }
1525
-
1526
- interface InitOptions {
1527
- version: string;
1528
- data: string;
1529
- }
1530
-
1531
- interface PayrailsClientOptions {
1532
- environment?: PayrailsEnvironment;
1533
- events?: ClientEvents;
1534
- redirectFor3DS?: boolean;
1535
- returnInfo?: ReturnInfo;
1536
- telemetry?: {
1537
- enabled?: boolean;
1538
- logLevel?: LogLevel$1;
1539
- };
1540
- }
1541
- declare class Payrails {
1542
- private vaultClient;
1543
- private options?;
1544
- private __container;
1545
- private __cardForm;
1546
- private __cardList;
1547
- private __cardPaymentButton;
1548
- private __paypalButton;
1549
- private __genericRedirectButton;
1550
- private __dropin;
1551
- static preloadCardForm: typeof SdkLoader.preloadCardForm;
1552
- static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
1553
- update(amount: PayrailsAmount): void;
1554
- collectContainer(containerOptions: CollectContainerOptions): PayrailsCollectContainer;
1555
- googlePayButton(options: GooglePayButtonOptions): GooglePayButton;
1556
- isGooglePayAvailable(merchantInfo: google.payments.api.MerchantInfo): Promise<boolean>;
1557
- applePayButton(options: ApplePayButtonOptions): ApplePayButton;
1558
- isApplePayAvailable(): Promise<boolean>;
1559
- cardList(options?: CardListOptions): CardList;
1560
- cardForm(options?: CardFormOptions): CardForm;
1561
- dropin(options: DropinOptions): Dropin;
1562
- getSavedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
1563
- getSavedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
1564
- getSavedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
1565
- query<K extends keyof ConfigurationQueryTypes>(key: K, params?: Record<string, any>): ConfigurationQueryTypes[K]['returnType'] | null;
1566
- api<TOperation extends keyof Operations>(config: ApiConfig<Operations[TOperation]['requestType']> & {
1567
- operation: TOperation;
1568
- }): Promise<Operations[TOperation]['responseType']>;
1569
- getStoredInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
1570
- getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
1571
- paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
1572
- paypalButton(options?: PaypalButtonOptions): PaypalButton;
1573
- genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
1574
- getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
1575
- private logIntegrationMode;
1576
- private constructor();
1577
- private getContainerLayout;
1578
- binLookup(): Promise<any>;
1579
- }
1580
- interface ClientEvents {
1581
- onClientInitialized?: (execution?: typeof WorkflowExecution) => void;
1582
- onSessionExpired?: () => Promise<InitOptions>;
1583
- }
1584
- interface PaymentEvents {
1585
- onAuthorizeSuccess?: (e?: any) => void;
1586
- onAuthorizeFailed?: (e?: any) => void;
1587
- onAuthorizePending?: (e?: any) => void;
1588
- onPaymentButtonClicked?: (e?: {
1589
- bin?: string;
1590
- }) => Promise<boolean>;
1591
- onAuthorizeRequestStart?: () => void;
1592
- onPaymentSessionExpired?: () => void;
1593
- onThreeDSecureChallenge?: () => void;
1594
- }
1595
- interface UIEvents {
1596
- onSaveInstrumentCheckboxChanged?: ({ checked }: {
1597
- checked: boolean;
1598
- }) => void;
1599
- onBillingAddressChanged?: (e: {
1600
- isValid: boolean;
1601
- billingAddress?: IAddress;
1602
- }) => void;
1603
- onDeliveryAddressChanged?: (data?: onDeliveryAddressChangedResponse) => Promise<boolean>;
1604
- }
1605
- type onPaymentMethodSelectedParams = {
1606
- paymentMethod?: StorablePaymentCompositionOption;
1607
- instrument?: StoredPaymentInstrument<CardMetadata & PayPalMetadata>;
1608
- };
1609
- interface DropinEvents {
1610
- onPaymentOptionSelected?: (e: onPaymentMethodSelectedParams) => void;
1611
- }
1612
- type PayrailsSDKEvents = PaymentEvents & UIEvents & DropinEvents;
1613
- type onDeliveryAddressChangedResponse = {
1614
- deliveryAddress?: {
1615
- street?: string;
1616
- doorNumber?: string;
1617
- complement?: string;
1618
- area?: string;
1619
- city?: string;
1620
- postalCode?: string;
1621
- state?: string;
1622
- country?: {
1623
- code?: string;
1624
- iso3?: string;
1625
- name?: string;
1626
- };
1627
- latitude?: number;
1628
- longitude?: number;
1629
- phone?: {
1630
- countryCode?: string;
1631
- number?: string;
1632
- };
1633
- name?: string;
1634
- lastName?: string;
1635
- email?: string;
1636
- };
1637
- };
1638
- declare enum PayrailsEnvironment {
1639
- TEST = "TEST",
1640
- PRODUCTION = "PRODUCTION"
1641
- }
1642
-
1643
- interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
1644
- clientDomain?: string;
1645
- showPaymentMethodLogo?: boolean;
1646
- events?: PaymentEvents & {
1647
- onApplePayAvailable?: () => void;
1648
- };
1649
- styles?: {
1650
- type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
1651
- style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
1652
- } & StoreInstrumentElementOptions['styles'];
1653
- }
1654
- declare global {
1655
- interface Window {
1656
- ApplePaySession?: ApplePaySession;
1657
- }
1658
- }
1659
- declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
1660
- protected options: ApplePayButtonOptions;
1661
- private appleButton;
1662
- private paymentExecutor;
1663
- static isApplePayAvailable(): Promise<boolean>;
1664
- constructor(options: ApplePayButtonOptions);
1665
- mount(location: string): void;
1666
- unmount(): void;
1667
- private mountApplePayButton;
1668
- private createApplePaySession;
1669
- private onApplePayAuthorized;
1670
- }
1671
1691
 
1672
1692
  export { AuthorizationFailureReasons, ElementType, INTEGRATION_TYPE, PAYMENT_METHOD_CODES, Payrails, PayrailsEnvironment };
1673
1693
  export type { ApplePayButtonOptions, CardFormOptions, CardListOptions, CardPaymentButtonOptions, DropinOptions, GooglePayButtonOptions, InitOptions, PaymentEvents, PaypalButtonOptions, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsSecureField, PayrailsSecureFieldEvent, SaveInstrumentResponse, WorkflowExecutionResponse };