@payrails/web-sdk 5.37.9 → 5.38.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payrails/web-sdk",
3
- "version": "5.37.9",
3
+ "version": "5.38.2",
4
4
  "description": "SDK providing tokenization options on the client for merchants",
5
5
  "main": "index.js",
6
6
  "types": "payrails.d.ts",
package/payrails.d.ts CHANGED
@@ -97,8 +97,40 @@ declare enum PAYMENT_METHOD_CODES {
97
97
  'IDEAL' = "iDeal",
98
98
  'YAPE' = "yape",
99
99
  'UPI' = "upi",
100
- 'KLARNA' = "klarna"
101
- }
100
+ 'KLARNA' = "klarna",
101
+ 'ONE_VOUCHER' = "1voucher",
102
+ 'ALFA' = "alfa",
103
+ 'APLAZO' = "aplazo",
104
+ 'BANK_TRANSFER' = "bankTransfer",
105
+ 'CAPITEC_PAY' = "capitecPay",
106
+ 'EASYPAISA' = "easypaisa",
107
+ 'EFT_PRO' = "eftPro",
108
+ 'FAWRY_PAY' = "fawryPay",
109
+ 'JAZZ_CASH' = "jazzCash",
110
+ 'KONNECT' = "konnect",
111
+ 'KUESKI' = "kueski",
112
+ 'MONO_DIRECT_DEBIT' = "monoDirectDebit",
113
+ 'O_PAY_WALLET' = "oPayWallet",
114
+ 'PAGA_WALLET' = "pagaWallet",
115
+ 'PAYFLEX' = "payflex",
116
+ 'PAY_JUST_NOW' = "payjustnow",
117
+ 'WAFA_CASH_WALLET' = "wafaCashWallet",
118
+ 'MERCADO_PAGO_WALLET' = "mercadoPagoWallet",
119
+ 'MERCADO_PAGO_CONSUMER_CREDIT' = "mercadoPagoConsumerCredit",
120
+ 'NET_BANKING' = "netBanking",
121
+ 'CASH_FREE_WALLET' = "cashFreeWallet",
122
+ 'PAYTM_WALLET' = "paytmWallet",
123
+ 'NIBSS_PAY' = "nibssPay",
124
+ 'NIBSS_INSTANT_PAY' = "nibssInstantPay",
125
+ 'MEEZA_WALLET' = "meezaWallet",
126
+ 'VODAFONE_CASH' = "vodafoneCash",
127
+ 'SEPA_DIRECT_DEBIT' = "sepaDirectDebit",
128
+ 'MODO' = "modo",
129
+ 'PAYZONE_CASH' = "payzoneCash",
130
+ 'REVOLUT_PAY' = "revolutPay"
131
+ }
132
+ declare const PAYMENT_METHOD_CODE_BY_METHOD: { readonly [K in keyof typeof PAYMENT_METHOD_CODES]: (typeof PAYMENT_METHOD_CODES)[K]; };
133
+ type PaymentMethodCode = PAYMENT_METHOD_CODES | (typeof PAYMENT_METHOD_CODE_BY_METHOD)[keyof typeof PAYMENT_METHOD_CODE_BY_METHOD] | (string & {});
102
134
  declare enum PAYMENT_INSTRUMENT_STATUS {
103
135
  'ENABLED' = "enabled",
104
136
  'CREATED' = "created",
@@ -107,7 +139,50 @@ declare enum PAYMENT_INSTRUMENT_STATUS {
107
139
  'INVALID' = "invalid",
108
140
  'TRANSIENT' = "transient"
109
141
  }
142
+ type ExecutionMetaKey = keyof ExecutionMetaByKey;
143
+ interface ExecutionMetaCustomer {
144
+ phone?: {
145
+ countryCode?: string;
146
+ number?: string;
147
+ };
148
+ country?: {
149
+ name?: string;
150
+ code?: string;
151
+ iso3?: string;
152
+ };
153
+ reference?: string;
154
+ name?: string;
155
+ lastName?: string;
156
+ email?: string;
157
+ type?: string;
158
+ birthDate?: string;
159
+ language?: string;
160
+ identityCardNumber?: string;
161
+ }
162
+ interface ExecutionMetaOrder {
163
+ billingAddress?: {
164
+ country?: {
165
+ name?: string;
166
+ code?: string;
167
+ iso3?: string;
168
+ };
169
+ };
170
+ }
171
+ type ExecutionMetaByKey = {
172
+ customer: ExecutionMetaCustomer;
173
+ };
174
+ type ExecutionMetaUpdate = {
175
+ [Key in ExecutionMetaKey]: {
176
+ key: Key;
177
+ value: ExecutionMetaByKey[Key];
178
+ };
179
+ }[ExecutionMetaKey];
180
+ interface ExecutionMeta {
181
+ customer?: ExecutionMetaCustomer;
182
+ order?: ExecutionMetaOrder;
183
+ }
110
184
  declare class WorkflowExecution {
185
+ private static _updatedMetaKeys;
111
186
  private static _response;
112
187
  static get response(): WorkflowExecutionResponse;
113
188
  static setResponse(response: WorkflowExecutionResponse): typeof WorkflowExecution;
@@ -148,7 +223,7 @@ declare class WorkflowExecution {
148
223
  static get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
149
224
  static get paypalConfig(): PayPalConfig;
150
225
  static get googlePayConfig(): any;
151
- static isPaymentMethodAvailable(paymentMethod: PAYMENT_METHOD_CODES): boolean;
226
+ static isPaymentMethodAvailable(paymentMethod: PaymentMethodCode): boolean;
152
227
  static get applePayConfig(): {
153
228
  merchantIdentifier: string;
154
229
  supportedNetworks: string[];
@@ -158,20 +233,7 @@ declare class WorkflowExecution {
158
233
  requiredShippingContactFields?: ApplePayJS.ApplePayContactField[];
159
234
  };
160
235
  static get url(): string;
161
- static get meta(): {
162
- customer?: {
163
- country?: {
164
- code?: string;
165
- };
166
- };
167
- order?: {
168
- billingAddress?: {
169
- country?: {
170
- code?: string;
171
- };
172
- };
173
- };
174
- };
236
+ static get meta(): ExecutionMeta;
175
237
  static get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
176
238
  static get authorizeLink(): string | undefined;
177
239
  static get payoutLink(): string | undefined;
@@ -179,11 +241,11 @@ declare class WorkflowExecution {
179
241
  static get createInstrumentLink(): string | undefined;
180
242
  static get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
181
243
  static get storedDropinInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
182
- static getFullPaymentMethodConfig(paymentMethod: PAYMENT_METHOD_CODES): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
183
- static isAddressSelectorEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
184
- static isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
185
- static getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
186
- static getStoredInstrumentForPaymentMethod<T = CardMetadata | PayPalMetadata>(paymentMethod: PAYMENT_METHOD_CODES): Array<StoredPaymentInstrument<T>>;
244
+ static getFullPaymentMethodConfig(paymentMethod: PaymentMethodCode): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
245
+ static isAddressSelectorEnabled(paymentMethod: PaymentMethodCode): boolean | undefined;
246
+ static isPaymentInstallmentsEnabled(paymentMethod: PaymentMethodCode): boolean | undefined;
247
+ static getPaymentInstallmentOptions(paymentMethod: PaymentMethodCode): PaymentInstallmentsConfig;
248
+ static getStoredInstrumentForPaymentMethod<T = CardMetadata | PayPalMetadata>(paymentMethod: PaymentMethodCode): Array<StoredPaymentInstrument<T>>;
187
249
  static getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
188
250
  id: string;
189
251
  description?: string;
@@ -200,8 +262,8 @@ declare class WorkflowExecution {
200
262
  instrumentDataSchema?: JSONSchemaType;
201
263
  };
202
264
  payoutInstruments?: StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined;
203
- paymentMethodCode: PAYMENT_METHOD_CODES;
204
- payoutMethodCode?: PAYMENT_METHOD_CODES;
265
+ paymentMethodCode: PaymentMethodCode;
266
+ payoutMethodCode?: PaymentMethodCode;
205
267
  } | undefined;
206
268
  static getPaymentMethodConfig(paymentMethod: StorablePaymentCompositionOption): {
207
269
  id: string;
@@ -219,10 +281,14 @@ declare class WorkflowExecution {
219
281
  instrumentDataSchema?: JSONSchemaType;
220
282
  };
221
283
  payoutInstruments?: StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined;
222
- paymentMethodCode: PAYMENT_METHOD_CODES;
223
- payoutMethodCode?: PAYMENT_METHOD_CODES;
284
+ paymentMethodCode: PaymentMethodCode;
285
+ payoutMethodCode?: PaymentMethodCode;
224
286
  };
225
287
  static updateInstallmentOptions(installmentOptions?: PaymentInstallmentsConfig): void;
288
+ static updateMeta<K extends ExecutionMetaKey>(key: K, value: ExecutionMetaByKey[K]): void;
289
+ static getAllowedMeta(): ExecutionMeta;
290
+ static getUpdatedMeta(): ExecutionMeta;
291
+ private static pickMetaByKeys;
226
292
  }
227
293
  interface WorkflowExecutionResponse {
228
294
  id: string;
@@ -230,20 +296,7 @@ interface WorkflowExecutionResponse {
230
296
  holderReference: string;
231
297
  holderId?: string;
232
298
  actionRequired?: string;
233
- meta: {
234
- customer?: {
235
- country?: {
236
- code?: string;
237
- };
238
- };
239
- order?: {
240
- billingAddress?: {
241
- country?: {
242
- code?: string;
243
- };
244
- };
245
- };
246
- };
299
+ meta: ExecutionMeta;
247
300
  status: Array<{
248
301
  code: string;
249
302
  time: string;
@@ -305,8 +358,8 @@ interface WorkflowExecutionResponse {
305
358
  };
306
359
  }
307
360
  interface BasePaymentMethodConfig {
308
- paymentMethodCode: PAYMENT_METHOD_CODES;
309
- payoutMethodCode?: PAYMENT_METHOD_CODES;
361
+ paymentMethodCode: PaymentMethodCode;
362
+ payoutMethodCode?: PaymentMethodCode;
310
363
  }
311
364
  interface BaseInstallmentOption {
312
365
  count: number;
@@ -378,7 +431,7 @@ interface ApplePayConfig {
378
431
  interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata | BankAccountMetadata> {
379
432
  id: string;
380
433
  status: PAYMENT_INSTRUMENT_STATUS;
381
- paymentMethod: PAYMENT_METHOD_CODES;
434
+ paymentMethod: PaymentMethodCode;
382
435
  displayName?: string;
383
436
  data?: T;
384
437
  default?: boolean;
@@ -518,9 +571,10 @@ interface PayrailsAmount {
518
571
  currency: string;
519
572
  }
520
573
  interface LookupUpdateOptions {
521
- value: string;
522
- currency: string;
574
+ value?: string;
575
+ currency?: string;
523
576
  installmentConfig?: InstallmentUpdateConfig | null;
577
+ meta?: ExecutionMetaUpdate;
524
578
  }
525
579
  interface Links {
526
580
  method: 'GET' | 'POST';
@@ -554,7 +608,7 @@ interface PayoutResponse {
554
608
  type PayoutComposition = Array<{
555
609
  integrationType: string;
556
610
  amount: PayrailsAmount;
557
- paymentMethodCode: PAYMENT_METHOD_CODES;
611
+ paymentMethodCode: PaymentMethodCode;
558
612
  paymentInstrumentId?: string;
559
613
  }>;
560
614
  interface PayoutReqBody {
@@ -1472,13 +1526,16 @@ declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox
1472
1526
  private sdkLoadedCalled;
1473
1527
  private isProcessing;
1474
1528
  private buttonElement;
1529
+ private action;
1475
1530
  private static getGooglePayConfigAsArray;
1476
1531
  private static getSDKClient;
1477
1532
  static isGooglePayAvailable(allowedPaymentMethods: GooglePayConfigInput, environment?: PayrailsEnvironment, merchantInfo?: google.payments.api.MerchantInfo): Promise<boolean>;
1478
1533
  constructor(options: GooglePayButtonOptions);
1479
1534
  private sdkLoaded;
1480
- private onLoadPaymentData;
1481
1535
  private authorize;
1536
+ private onLoadPaymentData;
1537
+ private doTokenize;
1538
+ private doAuthorizePayment;
1482
1539
  mount(location: string): void;
1483
1540
  unmount(): void;
1484
1541
  }
@@ -1827,7 +1884,7 @@ interface UpdateInstrumentResponse {
1827
1884
  id: string;
1828
1885
  createdAt: string;
1829
1886
  holderId: string;
1830
- paymentMethod: PAYMENT_METHOD_CODES;
1887
+ paymentMethod: PaymentMethodCode;
1831
1888
  status: PAYMENT_INSTRUMENT_STATUS;
1832
1889
  data: {
1833
1890
  bin?: string;
@@ -1954,8 +2011,8 @@ declare class Payrails {
1954
2011
  operation: TOperation;
1955
2012
  }): Promise<Operations[TOperation]['responseType']>;
1956
2013
  getStoredInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
1957
- getStoredInstrumentsByPaymentMethod(paymentMethod: PAYMENT_METHOD_CODES): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
1958
- getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
2014
+ getStoredInstrumentsByPaymentMethod(paymentMethod: PaymentMethodCode): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
2015
+ getAvailablePaymentMethods(): PaymentMethodCode[];
1959
2016
  paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
1960
2017
  paypalButton(options?: PaypalButtonOptions): PaypalButton;
1961
2018
  genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
@@ -2072,4 +2129,4 @@ interface PayrailsClientOptions {
2072
2129
  }
2073
2130
 
2074
2131
  export { AuthorizationFailureReasons, ElementType, INTEGRATION_TYPE, PAYMENT_METHOD_CODES, Payrails, PayrailsEnvironment };
2075
- export type { ApplePayButtonOptions, CardFormOptions, CardListOptions, CardPaymentButtonOptions, DropinOptions, GenericRedirectButtonOptions, GooglePayButtonOptions, InitOptions, PaymentEvents, PaypalButtonOptions, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsSecureField, PayrailsSecureFieldEvent, ReturnInfo, SaveInstrumentResponse, WorkflowExecutionResponse };
2132
+ export type { ApplePayButtonOptions, CardFormOptions, CardListOptions, CardPaymentButtonOptions, DropinOptions, ExecutionMeta, ExecutionMetaCustomer, ExecutionMetaKey, GenericRedirectButtonOptions, GooglePayButtonOptions, InitOptions, PaymentEvents, PaypalButtonOptions, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsSecureField, PayrailsSecureFieldEvent, ReturnInfo, SaveInstrumentResponse, WorkflowExecutionResponse };