@payrails/web-sdk 5.26.0-RC.0 → 5.27.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/index.js +4 -4
- package/package.json +1 -1
- package/payrails.d.ts +128 -7
- package/payrails.js +4 -4
package/package.json
CHANGED
package/payrails.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ declare enum PAYMENT_METHOD_CODES {
|
|
|
7
7
|
'GOOGLE_PAY' = "googlePay",
|
|
8
8
|
'PAYPAL' = "payPal",
|
|
9
9
|
'APPLE_PAY' = "applePay",
|
|
10
|
-
'GENERIC_REDIRECT' = "genericRedirect"
|
|
10
|
+
'GENERIC_REDIRECT' = "genericRedirect",
|
|
11
|
+
'MERCADO_PAGO' = "mercadoPago",
|
|
12
|
+
'PIX' = "pix"
|
|
11
13
|
}
|
|
12
14
|
declare enum PAYMENT_INSTRUMENT_STATUS {
|
|
13
15
|
'ENABLED' = "enabled",
|
|
@@ -76,7 +78,7 @@ declare class WorkflowExecution {
|
|
|
76
78
|
static isAddressSelectorEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
|
|
77
79
|
static isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
|
|
78
80
|
static getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
|
|
79
|
-
|
|
81
|
+
static getStoredInstrumentForPaymentMethod<T = CardMetadata | PayPalMetadata>(paymentMethod: PAYMENT_METHOD_CODES): Array<StoredPaymentInstrument<T>>;
|
|
80
82
|
static getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
|
|
81
83
|
id: string;
|
|
82
84
|
description?: string;
|
|
@@ -305,7 +307,7 @@ declare enum RedactionType {
|
|
|
305
307
|
MASKED = "MASKED",
|
|
306
308
|
REDACTED = "REDACTED"
|
|
307
309
|
}
|
|
308
|
-
declare enum RequestMethod {
|
|
310
|
+
declare enum RequestMethod$1 {
|
|
309
311
|
GET = "GET",
|
|
310
312
|
POST = "POST",
|
|
311
313
|
PUT = "PUT",
|
|
@@ -503,7 +505,7 @@ declare class Skyflow {
|
|
|
503
505
|
static get ContainerType(): typeof ContainerType;
|
|
504
506
|
static get ElementType(): typeof ElementType$1;
|
|
505
507
|
static get RedactionType(): typeof RedactionType;
|
|
506
|
-
static get RequestMethod(): typeof RequestMethod;
|
|
508
|
+
static get RequestMethod(): typeof RequestMethod$1;
|
|
507
509
|
static get LogLevel(): typeof LogLevel;
|
|
508
510
|
static get EventName(): typeof EventName;
|
|
509
511
|
static get Env(): typeof Env;
|
|
@@ -871,14 +873,40 @@ declare class CardList extends PayrailsElement {
|
|
|
871
873
|
reset(): void;
|
|
872
874
|
}
|
|
873
875
|
|
|
874
|
-
interface
|
|
875
|
-
|
|
876
|
-
|
|
876
|
+
interface SdkConfiguration {
|
|
877
|
+
token: string;
|
|
878
|
+
amount: PayrailsAmount;
|
|
879
|
+
holderReference: string;
|
|
880
|
+
links?: {
|
|
881
|
+
binLookup?: Links;
|
|
882
|
+
instrumentDelete?: Links;
|
|
883
|
+
instrumentUpdate?: Links;
|
|
884
|
+
};
|
|
885
|
+
vaultConfiguration: {
|
|
886
|
+
cardTableName: string;
|
|
887
|
+
token: string;
|
|
888
|
+
vaultId: string;
|
|
889
|
+
vaultUrl: string;
|
|
890
|
+
providerId: string;
|
|
891
|
+
providerConfigId: string;
|
|
892
|
+
vaultType: 'Payrails' | 'Test';
|
|
893
|
+
encryptionPublicKey?: string;
|
|
894
|
+
links: {
|
|
895
|
+
saveInstrument: {
|
|
896
|
+
href: string;
|
|
897
|
+
};
|
|
898
|
+
};
|
|
899
|
+
};
|
|
900
|
+
execution?: WorkflowExecutionResponse;
|
|
877
901
|
}
|
|
878
902
|
interface PayrailsAmount {
|
|
879
903
|
value: string;
|
|
880
904
|
currency: string;
|
|
881
905
|
}
|
|
906
|
+
interface Links {
|
|
907
|
+
method: 'GET' | 'POST';
|
|
908
|
+
href: string;
|
|
909
|
+
}
|
|
882
910
|
|
|
883
911
|
interface ReturnInfo {
|
|
884
912
|
success?: string;
|
|
@@ -1257,6 +1285,74 @@ interface ContainerStyles {
|
|
|
1257
1285
|
styles?: Partial<CSSStyleDeclaration>;
|
|
1258
1286
|
}
|
|
1259
1287
|
|
|
1288
|
+
declare enum RequestMethod {
|
|
1289
|
+
GET = "GET",
|
|
1290
|
+
POST = "POST",
|
|
1291
|
+
DELETE = "DELETE",
|
|
1292
|
+
PATCH = "PATCH"
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
type Operations = {
|
|
1296
|
+
deleteInstrument: OperationConfig<void, DeleteInstrumentResponse>;
|
|
1297
|
+
updateInstrument: OperationConfig<UpdateInstrumentBody, UpdateInstrumentResponse>;
|
|
1298
|
+
};
|
|
1299
|
+
interface UpdateInstrumentBody {
|
|
1300
|
+
status?: 'enabled' | 'disabled';
|
|
1301
|
+
networkTransactionReference?: string;
|
|
1302
|
+
merchantReference?: string;
|
|
1303
|
+
paymentMethod?: 'applepay' | 'card' | 'googlepay' | 'paypal';
|
|
1304
|
+
default?: boolean;
|
|
1305
|
+
}
|
|
1306
|
+
interface UpdateInstrumentResponse {
|
|
1307
|
+
id: string;
|
|
1308
|
+
createdAt: string;
|
|
1309
|
+
holderId: string;
|
|
1310
|
+
paymentMethod: PAYMENT_METHOD_CODES;
|
|
1311
|
+
status: PAYMENT_INSTRUMENT_STATUS;
|
|
1312
|
+
data: {
|
|
1313
|
+
bin?: string;
|
|
1314
|
+
binLookup?: {
|
|
1315
|
+
bin?: string;
|
|
1316
|
+
network?: string;
|
|
1317
|
+
issuer?: string;
|
|
1318
|
+
issuerCountry?: {
|
|
1319
|
+
code?: string;
|
|
1320
|
+
name?: string;
|
|
1321
|
+
iso3?: string;
|
|
1322
|
+
};
|
|
1323
|
+
type?: string;
|
|
1324
|
+
};
|
|
1325
|
+
holderName?: string;
|
|
1326
|
+
network?: string;
|
|
1327
|
+
suffix?: string;
|
|
1328
|
+
expiryMonth?: string;
|
|
1329
|
+
expiryYear?: string;
|
|
1330
|
+
};
|
|
1331
|
+
fingerprint?: string;
|
|
1332
|
+
futureUsage?: string;
|
|
1333
|
+
}
|
|
1334
|
+
interface DeleteInstrumentResponse {
|
|
1335
|
+
success: boolean;
|
|
1336
|
+
}
|
|
1337
|
+
type RequestCreator<TReq, TOperation extends keyof Operations> = (config: ApiConfig<TReq> & {
|
|
1338
|
+
operation: TOperation;
|
|
1339
|
+
}) => {
|
|
1340
|
+
url: string;
|
|
1341
|
+
body?: TReq;
|
|
1342
|
+
};
|
|
1343
|
+
interface OperationConfig<TReq, TRes> {
|
|
1344
|
+
linkKey: keyof NonNullable<SdkConfiguration['links']>;
|
|
1345
|
+
method: RequestMethod;
|
|
1346
|
+
createRequest: RequestCreator<TReq, keyof Operations>;
|
|
1347
|
+
requestType: TReq;
|
|
1348
|
+
responseType: TRes;
|
|
1349
|
+
}
|
|
1350
|
+
interface ApiConfig<TReq> {
|
|
1351
|
+
operation: keyof Operations;
|
|
1352
|
+
resourceId?: string;
|
|
1353
|
+
body?: TReq;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1260
1356
|
declare class SdkLoader {
|
|
1261
1357
|
private static readonly scriptMap;
|
|
1262
1358
|
static load<T = void>(sdk: ThirdPartySDK, params?: PayPalScriptConfig): Promise<T>;
|
|
@@ -1279,6 +1375,27 @@ declare enum ThirdPartySDK {
|
|
|
1279
1375
|
PayPal = "paypal-sdk"
|
|
1280
1376
|
}
|
|
1281
1377
|
|
|
1378
|
+
interface QueryDefinition<T> {
|
|
1379
|
+
path: string[];
|
|
1380
|
+
returnType: T;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
interface ConfigurationQueryTypes {
|
|
1384
|
+
holderReference: QueryDefinition<string>;
|
|
1385
|
+
amount: QueryDefinition<PayrailsAmount>;
|
|
1386
|
+
binLookup: QueryDefinition<Links | undefined>;
|
|
1387
|
+
instrumentDelete: QueryDefinition<Links | undefined>;
|
|
1388
|
+
instrumentUpdate: QueryDefinition<Links | undefined>;
|
|
1389
|
+
executionId: QueryDefinition<string | undefined>;
|
|
1390
|
+
paymentMethodConfig: QueryDefinition<StorablePaymentCompositionOption | undefined>;
|
|
1391
|
+
paymentMethodInstruments: QueryDefinition<StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined>;
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
interface InitOptions {
|
|
1395
|
+
version: string;
|
|
1396
|
+
data: string;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1282
1399
|
interface PayrailsClientOptions {
|
|
1283
1400
|
environment?: PayrailsEnvironment;
|
|
1284
1401
|
events?: ClientEvents;
|
|
@@ -1313,6 +1430,10 @@ declare class Payrails {
|
|
|
1313
1430
|
getSavedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
|
|
1314
1431
|
getSavedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1315
1432
|
getSavedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1433
|
+
query<K extends keyof ConfigurationQueryTypes>(key: K, params?: Record<string, any>): ConfigurationQueryTypes[K]['returnType'] | null;
|
|
1434
|
+
api<TOperation extends keyof Operations>(config: ApiConfig<Operations[TOperation]['requestType']> & {
|
|
1435
|
+
operation: TOperation;
|
|
1436
|
+
}): Promise<Operations[TOperation]['responseType']>;
|
|
1316
1437
|
getStoredInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
1317
1438
|
getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
|
|
1318
1439
|
paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
|