@payrails/web-sdk 5.29.1-rc.1 → 5.29.1
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/README.md +9 -3
- package/index.js +4 -4
- package/package.json +1 -1
- package/payrails-styles.css +77 -77
- package/payrails.d.ts +137 -51
- package/payrails.js +4 -4
package/package.json
CHANGED
package/payrails-styles.css
CHANGED
|
@@ -683,6 +683,83 @@
|
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
685
|
|
|
686
|
+
button.payrails-generic-button {
|
|
687
|
+
border: none;
|
|
688
|
+
outline: none;
|
|
689
|
+
box-shadow: none;
|
|
690
|
+
margin: 0;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
.payrails-generic-button * {
|
|
694
|
+
box-sizing: border-box;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
.payrails-generic-button .dot-flashing-container {
|
|
698
|
+
width: 100%;
|
|
699
|
+
display: flex;
|
|
700
|
+
justify-content: center;
|
|
701
|
+
align-items: center;
|
|
702
|
+
position: relative;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.payrails-generic-button .dot-flashing-text {
|
|
706
|
+
visibility: hidden;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
.payrails-generic-button .dot-flashing {
|
|
710
|
+
position: absolute;
|
|
711
|
+
left: auto;
|
|
712
|
+
right: auto;
|
|
713
|
+
width: 10px;
|
|
714
|
+
height: 10px;
|
|
715
|
+
border-radius: 5px;
|
|
716
|
+
background-color: currentColor;
|
|
717
|
+
color: currentColor;
|
|
718
|
+
animation: dot-flashing 1s infinite linear alternate;
|
|
719
|
+
animation-delay: 0.5s;
|
|
720
|
+
}
|
|
721
|
+
.payrails-generic-button .dot-flashing::before,
|
|
722
|
+
.payrails-generic-button .dot-flashing::after {
|
|
723
|
+
content: '';
|
|
724
|
+
display: inline-block;
|
|
725
|
+
position: absolute;
|
|
726
|
+
top: 0;
|
|
727
|
+
}
|
|
728
|
+
.payrails-generic-button .dot-flashing::before {
|
|
729
|
+
left: -15px;
|
|
730
|
+
width: 10px;
|
|
731
|
+
height: 10px;
|
|
732
|
+
border-radius: 5px;
|
|
733
|
+
background-color: currentColor;
|
|
734
|
+
color: currentColor;
|
|
735
|
+
animation: dot-flashing 1s infinite alternate;
|
|
736
|
+
animation-delay: 0s;
|
|
737
|
+
}
|
|
738
|
+
.payrails-generic-button .dot-flashing::after {
|
|
739
|
+
left: 15px;
|
|
740
|
+
width: 10px;
|
|
741
|
+
height: 10px;
|
|
742
|
+
border-radius: 5px;
|
|
743
|
+
background-color: currentColor;
|
|
744
|
+
color: currentColor;
|
|
745
|
+
animation: dot-flashing 1s infinite alternate;
|
|
746
|
+
animation-delay: 1s;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
@keyframes dot-flashing {
|
|
750
|
+
0% {
|
|
751
|
+
opacity: 1;
|
|
752
|
+
}
|
|
753
|
+
50%,
|
|
754
|
+
100% {
|
|
755
|
+
opacity: 0.2;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
#payrails-paypal-button-wrapper {
|
|
760
|
+
min-height: 44px;
|
|
761
|
+
}
|
|
762
|
+
|
|
686
763
|
.payrails-dynamic-element-form {
|
|
687
764
|
display: flex;
|
|
688
765
|
flex-direction: column;
|
|
@@ -803,83 +880,6 @@
|
|
|
803
880
|
color: unset;
|
|
804
881
|
}
|
|
805
882
|
|
|
806
|
-
button.payrails-generic-button {
|
|
807
|
-
border: none;
|
|
808
|
-
outline: none;
|
|
809
|
-
box-shadow: none;
|
|
810
|
-
margin: 0;
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
.payrails-generic-button * {
|
|
814
|
-
box-sizing: border-box;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
.payrails-generic-button .dot-flashing-container {
|
|
818
|
-
width: 100%;
|
|
819
|
-
display: flex;
|
|
820
|
-
justify-content: center;
|
|
821
|
-
align-items: center;
|
|
822
|
-
position: relative;
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
.payrails-generic-button .dot-flashing-text {
|
|
826
|
-
visibility: hidden;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
.payrails-generic-button .dot-flashing {
|
|
830
|
-
position: absolute;
|
|
831
|
-
left: auto;
|
|
832
|
-
right: auto;
|
|
833
|
-
width: 10px;
|
|
834
|
-
height: 10px;
|
|
835
|
-
border-radius: 5px;
|
|
836
|
-
background-color: currentColor;
|
|
837
|
-
color: currentColor;
|
|
838
|
-
animation: dot-flashing 1s infinite linear alternate;
|
|
839
|
-
animation-delay: 0.5s;
|
|
840
|
-
}
|
|
841
|
-
.payrails-generic-button .dot-flashing::before,
|
|
842
|
-
.payrails-generic-button .dot-flashing::after {
|
|
843
|
-
content: '';
|
|
844
|
-
display: inline-block;
|
|
845
|
-
position: absolute;
|
|
846
|
-
top: 0;
|
|
847
|
-
}
|
|
848
|
-
.payrails-generic-button .dot-flashing::before {
|
|
849
|
-
left: -15px;
|
|
850
|
-
width: 10px;
|
|
851
|
-
height: 10px;
|
|
852
|
-
border-radius: 5px;
|
|
853
|
-
background-color: currentColor;
|
|
854
|
-
color: currentColor;
|
|
855
|
-
animation: dot-flashing 1s infinite alternate;
|
|
856
|
-
animation-delay: 0s;
|
|
857
|
-
}
|
|
858
|
-
.payrails-generic-button .dot-flashing::after {
|
|
859
|
-
left: 15px;
|
|
860
|
-
width: 10px;
|
|
861
|
-
height: 10px;
|
|
862
|
-
border-radius: 5px;
|
|
863
|
-
background-color: currentColor;
|
|
864
|
-
color: currentColor;
|
|
865
|
-
animation: dot-flashing 1s infinite alternate;
|
|
866
|
-
animation-delay: 1s;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
@keyframes dot-flashing {
|
|
870
|
-
0% {
|
|
871
|
-
opacity: 1;
|
|
872
|
-
}
|
|
873
|
-
50%,
|
|
874
|
-
100% {
|
|
875
|
-
opacity: 0.2;
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
#payrails-paypal-button-wrapper {
|
|
880
|
-
min-height: 44px;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
883
|
.payrails-container-wrapper {
|
|
884
884
|
width: 100%;
|
|
885
885
|
min-height: 90px;
|
package/payrails.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import * as _payrails_iframe_event_bus from '@payrails/iframe-event-bus';
|
|
|
2
2
|
import { LogLevel as LogLevel$1 } from '@payrails/logger';
|
|
3
3
|
import { FraudProvider } from '@payrails/fraud-sdk';
|
|
4
4
|
|
|
5
|
+
declare const UI_POSITION_FIELD = "ui:position";
|
|
6
|
+
|
|
5
7
|
type JSONSchemaType = JSONSchemaProperty & {
|
|
6
8
|
required?: string[];
|
|
7
9
|
dependentSchemas?: Record<string, JSONSchemaDependentSchema>;
|
|
@@ -23,6 +25,7 @@ interface JSONSchemaProperty {
|
|
|
23
25
|
maxLength?: number;
|
|
24
26
|
errorMessage?: Record<string, string>;
|
|
25
27
|
$ref?: string;
|
|
28
|
+
[UI_POSITION_FIELD]?: number;
|
|
26
29
|
properties?: Record<string, JSONSchemaType>;
|
|
27
30
|
}
|
|
28
31
|
interface JSONSchemaOneOfOption {
|
|
@@ -33,6 +36,10 @@ interface JSONSchemaOneOfOption {
|
|
|
33
36
|
const: string | number;
|
|
34
37
|
title: string;
|
|
35
38
|
}
|
|
39
|
+
interface DynamicElementEvents {
|
|
40
|
+
onReady: () => void;
|
|
41
|
+
onValidationChange: (isValid: boolean) => void;
|
|
42
|
+
}
|
|
36
43
|
interface DynamicElementFieldTranslation {
|
|
37
44
|
label?: string;
|
|
38
45
|
placeholder?: string;
|
|
@@ -46,9 +53,6 @@ interface DynamicElementErrorTranslation {
|
|
|
46
53
|
oneOf: string;
|
|
47
54
|
}
|
|
48
55
|
type DynamicElementTranslations = {
|
|
49
|
-
labels?: {
|
|
50
|
-
submitButton?: string;
|
|
51
|
-
};
|
|
52
56
|
fields?: Record<string, DynamicElementFieldTranslation>;
|
|
53
57
|
errors?: Partial<DynamicElementErrorTranslation>;
|
|
54
58
|
};
|
|
@@ -103,14 +107,20 @@ declare class WorkflowExecution {
|
|
|
103
107
|
private static _response;
|
|
104
108
|
static get response(): WorkflowExecutionResponse;
|
|
105
109
|
static setResponse(response: WorkflowExecutionResponse): typeof WorkflowExecution;
|
|
110
|
+
static get workflowCode(): string;
|
|
106
111
|
static get lookup(): {
|
|
107
112
|
httpCode: number;
|
|
108
113
|
body: {
|
|
109
114
|
data: {
|
|
110
|
-
paymentCompositionOptions
|
|
115
|
+
paymentCompositionOptions?: Array<StorablePaymentCompositionOption>;
|
|
116
|
+
payoutCompositionOptions?: Array<StorablePaymentCompositionOption>;
|
|
111
117
|
};
|
|
112
118
|
links: {
|
|
113
|
-
authorize
|
|
119
|
+
authorize?: {
|
|
120
|
+
href: string;
|
|
121
|
+
method: "POST";
|
|
122
|
+
};
|
|
123
|
+
payout?: {
|
|
114
124
|
href: string;
|
|
115
125
|
method: "POST";
|
|
116
126
|
};
|
|
@@ -125,7 +135,7 @@ declare class WorkflowExecution {
|
|
|
125
135
|
static get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
126
136
|
static get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
127
137
|
static get paypalConfig(): PayPalConfig;
|
|
128
|
-
static get googlePayConfig():
|
|
138
|
+
static get googlePayConfig(): GooglePayConfig[];
|
|
129
139
|
static isPaymentMethodAvailable(paymentMethod: PAYMENT_METHOD_CODES): boolean;
|
|
130
140
|
static get applePayConfig(): {
|
|
131
141
|
merchantIdentifier: string;
|
|
@@ -133,6 +143,7 @@ declare class WorkflowExecution {
|
|
|
133
143
|
countryCode: string;
|
|
134
144
|
merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
|
|
135
145
|
requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
|
|
146
|
+
requiredShippingContactFields?: ApplePayJS.ApplePayContactField[];
|
|
136
147
|
};
|
|
137
148
|
static get url(): string;
|
|
138
149
|
static get meta(): {
|
|
@@ -151,6 +162,7 @@ declare class WorkflowExecution {
|
|
|
151
162
|
};
|
|
152
163
|
static get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
|
|
153
164
|
static get authorizeLink(): string | undefined;
|
|
165
|
+
static get payoutLink(): string | undefined;
|
|
154
166
|
static get createSessionLink(): string | undefined;
|
|
155
167
|
static get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
156
168
|
static get storedDropinInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
@@ -170,10 +182,11 @@ declare class WorkflowExecution {
|
|
|
170
182
|
supportsInstallments?: boolean;
|
|
171
183
|
installments?: PaymentInstallmentsConfig;
|
|
172
184
|
supportsBillingInfo?: boolean;
|
|
173
|
-
|
|
174
|
-
additionalConfig?: any;
|
|
185
|
+
instrumentDataSchema?: JSONSchemaType;
|
|
175
186
|
};
|
|
187
|
+
payoutInstruments?: StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined;
|
|
176
188
|
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
189
|
+
payoutMethodCode?: PAYMENT_METHOD_CODES;
|
|
177
190
|
} | undefined;
|
|
178
191
|
static getPaymentMethodConfig(paymentMethod: StorablePaymentCompositionOption): {
|
|
179
192
|
id: string;
|
|
@@ -186,16 +199,18 @@ declare class WorkflowExecution {
|
|
|
186
199
|
supportsInstallments?: boolean;
|
|
187
200
|
installments?: PaymentInstallmentsConfig;
|
|
188
201
|
supportsBillingInfo?: boolean;
|
|
189
|
-
|
|
190
|
-
additionalConfig?: any;
|
|
202
|
+
instrumentDataSchema?: JSONSchemaType;
|
|
191
203
|
};
|
|
204
|
+
payoutInstruments?: StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined;
|
|
192
205
|
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
206
|
+
payoutMethodCode?: PAYMENT_METHOD_CODES;
|
|
193
207
|
};
|
|
194
208
|
}
|
|
195
209
|
interface WorkflowExecutionResponse {
|
|
196
210
|
id: string;
|
|
197
211
|
merchantReference: string;
|
|
198
212
|
holderReference: string;
|
|
213
|
+
holderId?: string;
|
|
199
214
|
actionRequired?: string;
|
|
200
215
|
meta: {
|
|
201
216
|
customer?: {
|
|
@@ -219,10 +234,15 @@ interface WorkflowExecutionResponse {
|
|
|
219
234
|
httpCode: number;
|
|
220
235
|
body: {
|
|
221
236
|
data: {
|
|
222
|
-
paymentCompositionOptions
|
|
237
|
+
paymentCompositionOptions?: Array<StorablePaymentCompositionOption>;
|
|
238
|
+
payoutCompositionOptions?: Array<StorablePaymentCompositionOption>;
|
|
223
239
|
};
|
|
224
240
|
links: {
|
|
225
|
-
authorize
|
|
241
|
+
authorize?: {
|
|
242
|
+
href: string;
|
|
243
|
+
method: 'POST';
|
|
244
|
+
};
|
|
245
|
+
payout?: {
|
|
226
246
|
href: string;
|
|
227
247
|
method: 'POST';
|
|
228
248
|
};
|
|
@@ -256,6 +276,7 @@ interface WorkflowExecutionResponse {
|
|
|
256
276
|
}
|
|
257
277
|
interface BasePaymentMethodConfig {
|
|
258
278
|
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
279
|
+
payoutMethodCode?: PAYMENT_METHOD_CODES;
|
|
259
280
|
}
|
|
260
281
|
interface BaseInstallmentOption {
|
|
261
282
|
count: number;
|
|
@@ -275,30 +296,18 @@ interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C
|
|
|
275
296
|
supportsInstallments?: boolean;
|
|
276
297
|
installments?: PaymentInstallmentsConfig;
|
|
277
298
|
supportsBillingInfo?: boolean;
|
|
278
|
-
|
|
279
|
-
additionalConfig?: any;
|
|
299
|
+
instrumentDataSchema?: JSONSchemaType;
|
|
280
300
|
};
|
|
281
301
|
paymentInstruments?: Array<StoredPaymentInstrument<I>>;
|
|
302
|
+
payoutInstruments?: Array<StoredPaymentInstrument<I>>;
|
|
282
303
|
}
|
|
283
304
|
interface GooglePayConfig {
|
|
284
305
|
parameters: {
|
|
285
306
|
allowedAuthMethods: google.payments.api.CardAuthMethod[];
|
|
286
307
|
allowedCardNetworks: google.payments.api.CardNetwork[];
|
|
287
|
-
billingAddressParameters?: {
|
|
288
|
-
format?: string;
|
|
289
|
-
};
|
|
290
|
-
billingAddressRequired?: boolean;
|
|
291
308
|
};
|
|
292
309
|
tokenizationSpecification: google.payments.api.PaymentMethodTokenizationSpecification;
|
|
293
310
|
type: google.payments.api.PaymentMethodType;
|
|
294
|
-
apiVersion?: number;
|
|
295
|
-
apiVersionMinor?: number;
|
|
296
|
-
allowedPaymentMethods?: google.payments.api.PaymentMethodSpecification[];
|
|
297
|
-
emailRequired?: boolean;
|
|
298
|
-
shippingAddressRequired?: boolean;
|
|
299
|
-
shippingAddressParameters?: google.payments.api.ShippingAddressParameters;
|
|
300
|
-
merchantInfo?: google.payments.api.MerchantInfo;
|
|
301
|
-
existingPaymentMethodRequired?: boolean;
|
|
302
311
|
}
|
|
303
312
|
interface PayPalConfig {
|
|
304
313
|
clientId: string;
|
|
@@ -313,10 +322,11 @@ interface ApplePayConfig {
|
|
|
313
322
|
countryCode: string;
|
|
314
323
|
merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
|
|
315
324
|
requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
|
|
325
|
+
requiredShippingContactFields?: ApplePayJS.ApplePayContactField[];
|
|
316
326
|
};
|
|
317
327
|
type: string;
|
|
318
328
|
}
|
|
319
|
-
interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata> {
|
|
329
|
+
interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata | BankAccountMetadata> {
|
|
320
330
|
id: string;
|
|
321
331
|
status: PAYMENT_INSTRUMENT_STATUS;
|
|
322
332
|
paymentMethod: PAYMENT_METHOD_CODES;
|
|
@@ -326,17 +336,60 @@ interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata> {
|
|
|
326
336
|
interface PayPalMetadata {
|
|
327
337
|
email?: string;
|
|
328
338
|
}
|
|
339
|
+
interface Country {
|
|
340
|
+
code: string;
|
|
341
|
+
name: string;
|
|
342
|
+
iso3: string;
|
|
343
|
+
}
|
|
329
344
|
interface CardMetadata {
|
|
330
345
|
bin?: string;
|
|
331
346
|
suffix?: string;
|
|
332
347
|
network?: string;
|
|
333
348
|
binLookup?: {
|
|
334
|
-
issuerCountry:
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
349
|
+
issuerCountry: Country;
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
interface BankAccountMetadata {
|
|
353
|
+
bankAccount: {
|
|
354
|
+
holder: HolderData;
|
|
355
|
+
bank: BankData;
|
|
356
|
+
account: AccountData;
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
interface HolderData {
|
|
360
|
+
firstName?: string;
|
|
361
|
+
lastName?: string;
|
|
362
|
+
companyName?: string;
|
|
363
|
+
address?: Address;
|
|
364
|
+
email?: string;
|
|
365
|
+
dob?: string;
|
|
366
|
+
country?: Country;
|
|
367
|
+
city?: string;
|
|
368
|
+
type: HolderType;
|
|
369
|
+
}
|
|
370
|
+
type HolderType = 'individual' | 'corporate';
|
|
371
|
+
interface BankData {
|
|
372
|
+
name?: string;
|
|
373
|
+
branchCode?: string;
|
|
374
|
+
code?: string;
|
|
375
|
+
address?: Address;
|
|
376
|
+
swiftCode?: string;
|
|
377
|
+
}
|
|
378
|
+
interface AccountData {
|
|
379
|
+
number?: string;
|
|
380
|
+
iban?: string;
|
|
381
|
+
currency?: string;
|
|
382
|
+
type?: AccountType;
|
|
383
|
+
country?: Country;
|
|
384
|
+
}
|
|
385
|
+
type AccountType = 'savings' | 'current';
|
|
386
|
+
interface Address {
|
|
387
|
+
country?: {
|
|
388
|
+
code?: string;
|
|
389
|
+
fullName?: string;
|
|
390
|
+
iso3?: string;
|
|
339
391
|
};
|
|
392
|
+
postalCode?: string;
|
|
340
393
|
}
|
|
341
394
|
declare enum PAYMENT_CLIENT_FLOW {
|
|
342
395
|
'REDIRECT' = "redirect",
|
|
@@ -737,7 +790,7 @@ interface TokenizeOptions {
|
|
|
737
790
|
storeInstrument?: boolean;
|
|
738
791
|
}
|
|
739
792
|
declare abstract class Tokenizable extends PayrailsElement {
|
|
740
|
-
abstract collect(): Promise<any>;
|
|
793
|
+
protected abstract collect(): Promise<any>;
|
|
741
794
|
protected abstract constructSaveInstrumentBody(tokens: any, opts?: TokenizeOptions): Promise<any>;
|
|
742
795
|
tokenize(_opts?: TokenizeOptions): Promise<any>;
|
|
743
796
|
}
|
|
@@ -1026,12 +1079,14 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
|
|
|
1026
1079
|
private lastBinLookup;
|
|
1027
1080
|
private defaultStyles;
|
|
1028
1081
|
private defaultTranslations;
|
|
1082
|
+
private eventsRef?;
|
|
1029
1083
|
constructor(collectContainer: PayrailsCollectContainer, options?: CardFormOptions | undefined);
|
|
1030
1084
|
private initializeFormFields;
|
|
1031
1085
|
getErrorTextStyles(errorTextStyles: any): any;
|
|
1032
1086
|
private updateStyles;
|
|
1033
1087
|
private updateTranslations;
|
|
1034
|
-
|
|
1088
|
+
private updateEvents;
|
|
1089
|
+
update(options: Partial<Pick<CardFormOptions, 'styles' | 'translations' | 'events'>>): void;
|
|
1035
1090
|
private createFormField;
|
|
1036
1091
|
private initializeCustomLayout;
|
|
1037
1092
|
private hasFieldBeenUsed;
|
|
@@ -1094,13 +1149,6 @@ declare class CardList extends PayrailsElement {
|
|
|
1094
1149
|
reset(): void;
|
|
1095
1150
|
}
|
|
1096
1151
|
|
|
1097
|
-
declare enum RequestMethod {
|
|
1098
|
-
GET = "GET",
|
|
1099
|
-
POST = "POST",
|
|
1100
|
-
DELETE = "DELETE",
|
|
1101
|
-
PATCH = "PATCH"
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
1152
|
interface SdkConfiguration {
|
|
1105
1153
|
token: string;
|
|
1106
1154
|
amount: PayrailsAmount;
|
|
@@ -1122,7 +1170,6 @@ interface SdkConfiguration {
|
|
|
1122
1170
|
links: {
|
|
1123
1171
|
saveInstrument: {
|
|
1124
1172
|
href: string;
|
|
1125
|
-
method: RequestMethod;
|
|
1126
1173
|
};
|
|
1127
1174
|
};
|
|
1128
1175
|
};
|
|
@@ -1152,6 +1199,25 @@ declare global {
|
|
|
1152
1199
|
};
|
|
1153
1200
|
}
|
|
1154
1201
|
}
|
|
1202
|
+
interface PayoutResponse {
|
|
1203
|
+
name: 'payout';
|
|
1204
|
+
executedAt: string;
|
|
1205
|
+
workspaceId: string;
|
|
1206
|
+
actionId: string;
|
|
1207
|
+
links: {
|
|
1208
|
+
execution: string;
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
type PayoutComposition = Array<{
|
|
1212
|
+
integrationType: string;
|
|
1213
|
+
amount: PayrailsAmount;
|
|
1214
|
+
paymentMethodCode: PAYMENT_METHOD_CODES;
|
|
1215
|
+
paymentInstrumentId?: string;
|
|
1216
|
+
}>;
|
|
1217
|
+
interface PayoutReqBody {
|
|
1218
|
+
amount: PayrailsAmount;
|
|
1219
|
+
payoutComposition: PayoutComposition;
|
|
1220
|
+
}
|
|
1155
1221
|
type ERROR_RESULT = 'Unknown' | 'UnexpectedProviderResponse' | 'ProviderUnknownError' | 'ProviderConnectionError' | 'Timeout' | 'ProviderTimeout' | 'GenericRejection' | 'DuplicateOperation' | 'OperationNotAllowed' | 'NetworkTransactionReferenceRejected' | 'PayerCanceled' | 'LimitExceeded' | 'InstrumentNotAllowed' | 'InvalidInstrument' | 'InsufficientBalance' | 'BlockedInstrument' | 'ExpiredInstrument' | 'ValidationError' | 'ParamsError' | 'ProviderConfigError' | 'InvalidSignature' | 'InternalServerError' | 'AuthenticationError' | 'PaymentMethodNotSupported' | 'PayerAuthenticationRequired' | 'PayerAuthenticationFailed' | 'FraudRisk';
|
|
1156
1222
|
|
|
1157
1223
|
interface CardPaymentButtonOptions {
|
|
@@ -1195,7 +1261,8 @@ declare class CardPaymentButton extends PayrailsElement {
|
|
|
1195
1261
|
private constructEncryptedPayment;
|
|
1196
1262
|
private updateStyles;
|
|
1197
1263
|
private updateTranslations;
|
|
1198
|
-
|
|
1264
|
+
private updateEvents;
|
|
1265
|
+
update(options: Partial<Pick<CardPaymentButtonOptions, 'styles' | 'translations' | 'events'>>): void;
|
|
1199
1266
|
private handleAuthorizationResult;
|
|
1200
1267
|
}
|
|
1201
1268
|
declare enum AuthorizationFailureReasons {
|
|
@@ -1225,7 +1292,6 @@ interface LoadingScreenStyles {
|
|
|
1225
1292
|
[StyleKeys.loader]?: Partial<CSSStyleDeclaration>;
|
|
1226
1293
|
}
|
|
1227
1294
|
|
|
1228
|
-
type GooglePayConfigInput = google.payments.api.IsReadyToPayPaymentMethodSpecification[] | GooglePayConfig;
|
|
1229
1295
|
interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
|
|
1230
1296
|
environment?: PayrailsEnvironment;
|
|
1231
1297
|
merchantInfo?: google.payments.api.MerchantInfo;
|
|
@@ -1248,9 +1314,8 @@ declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox
|
|
|
1248
1314
|
private static googleSDKClient;
|
|
1249
1315
|
private sdkLoadedCalled;
|
|
1250
1316
|
private buttonElement;
|
|
1251
|
-
private static getGooglePayConfigAsArray;
|
|
1252
1317
|
private static getSDKClient;
|
|
1253
|
-
static isGooglePayAvailable(allowedPaymentMethods:
|
|
1318
|
+
static isGooglePayAvailable(allowedPaymentMethods: google.payments.api.IsReadyToPayPaymentMethodSpecification[], environment?: PayrailsEnvironment, merchantInfo?: google.payments.api.MerchantInfo): Promise<boolean>;
|
|
1254
1319
|
constructor(options: GooglePayButtonOptions);
|
|
1255
1320
|
private sdkLoaded;
|
|
1256
1321
|
private onLoadPaymentData;
|
|
@@ -1332,9 +1397,11 @@ declare class GenericRedirectButton extends PayrailsElement {
|
|
|
1332
1397
|
private redirectToPaymentLink;
|
|
1333
1398
|
private updateStyles;
|
|
1334
1399
|
private updateTranslations;
|
|
1400
|
+
private updateEvents;
|
|
1335
1401
|
update(options: {
|
|
1336
1402
|
styles?: ButtonOptions['styles'];
|
|
1337
1403
|
translations?: ButtonOptions['translations'];
|
|
1404
|
+
events?: ButtonOptions['events'];
|
|
1338
1405
|
}): void;
|
|
1339
1406
|
}
|
|
1340
1407
|
|
|
@@ -1443,7 +1510,6 @@ declare class Dropin extends PayrailsElement {
|
|
|
1443
1510
|
private loadingScreen;
|
|
1444
1511
|
constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions);
|
|
1445
1512
|
private isHppIntegration;
|
|
1446
|
-
private isEmbeddedElement;
|
|
1447
1513
|
private createStoredInstrumentElement;
|
|
1448
1514
|
private createInstallmentsDropdown;
|
|
1449
1515
|
private getInstallmentOptionsForInstrument;
|
|
@@ -1455,7 +1521,6 @@ declare class Dropin extends PayrailsElement {
|
|
|
1455
1521
|
private createCardForm;
|
|
1456
1522
|
private createApplePayButton;
|
|
1457
1523
|
private createCardPaymentButton;
|
|
1458
|
-
private createEmbeddedElement;
|
|
1459
1524
|
private onAuthorizeSuccess;
|
|
1460
1525
|
private getElementEvents;
|
|
1461
1526
|
private onAuthorizePending;
|
|
@@ -1538,8 +1603,8 @@ interface ContainerStyles {
|
|
|
1538
1603
|
interface DynamicElementOptions {
|
|
1539
1604
|
styles?: DynamicElementStyles;
|
|
1540
1605
|
translations?: DynamicElementTranslations;
|
|
1541
|
-
events?: PaymentEvents;
|
|
1542
1606
|
paymentMethod: BasePaymentMethodConfig;
|
|
1607
|
+
events?: DynamicElementEvents;
|
|
1543
1608
|
}
|
|
1544
1609
|
interface FormConfig {
|
|
1545
1610
|
schema: JSONSchemaType;
|
|
@@ -1551,10 +1616,13 @@ declare class DynamicElementForm extends Tokenizable {
|
|
|
1551
1616
|
private formFields;
|
|
1552
1617
|
private formData;
|
|
1553
1618
|
private __schema;
|
|
1619
|
+
private _previousFormValidState;
|
|
1554
1620
|
constructor(options: DynamicElementOptions, formConfig: FormConfig, returnInfo?: ReturnInfo | undefined);
|
|
1555
|
-
collect(): Promise<Record<string, any>>;
|
|
1621
|
+
protected collect(): Promise<Record<string, any>>;
|
|
1556
1622
|
protected constructSaveInstrumentBody(tokens: any, opts?: TokenizeOptions): Promise<any>;
|
|
1557
1623
|
private isFormValid;
|
|
1624
|
+
private isFormValidSilent;
|
|
1625
|
+
private checkAndTriggerValidationChange;
|
|
1558
1626
|
mount(location: string): Promise<void>;
|
|
1559
1627
|
private makeForm;
|
|
1560
1628
|
private createField;
|
|
@@ -1567,9 +1635,17 @@ declare class DynamicElementForm extends Tokenizable {
|
|
|
1567
1635
|
private evaluateDependencies;
|
|
1568
1636
|
}
|
|
1569
1637
|
|
|
1638
|
+
declare enum RequestMethod {
|
|
1639
|
+
GET = "GET",
|
|
1640
|
+
POST = "POST",
|
|
1641
|
+
DELETE = "DELETE",
|
|
1642
|
+
PATCH = "PATCH"
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1570
1645
|
type Operations = {
|
|
1571
1646
|
deleteInstrument: OperationConfig<void, DeleteInstrumentResponse>;
|
|
1572
1647
|
updateInstrument: OperationConfig<UpdateInstrumentBody, UpdateInstrumentResponse>;
|
|
1648
|
+
payout: OperationConfig<PayoutReqBody, PayoutResponse>;
|
|
1573
1649
|
};
|
|
1574
1650
|
interface UpdateInstrumentBody {
|
|
1575
1651
|
status?: 'enabled' | 'disabled';
|
|
@@ -1615,10 +1691,13 @@ type RequestCreator<TReq, TOperation extends keyof Operations> = (config: ApiCon
|
|
|
1615
1691
|
url: string;
|
|
1616
1692
|
body?: TReq;
|
|
1617
1693
|
};
|
|
1694
|
+
type LinkKey = keyof NonNullable<SdkConfiguration['links']> | 'payout';
|
|
1618
1695
|
interface OperationConfig<TReq, TRes> {
|
|
1619
|
-
linkKey:
|
|
1696
|
+
linkKey: LinkKey;
|
|
1620
1697
|
method: RequestMethod;
|
|
1621
1698
|
createRequest: RequestCreator<TReq, keyof Operations>;
|
|
1699
|
+
onSuccess?: (response: TRes) => Promise<any>;
|
|
1700
|
+
onError?: (error: Error) => Promise<any>;
|
|
1622
1701
|
requestType: TReq;
|
|
1623
1702
|
responseType: TRes;
|
|
1624
1703
|
}
|
|
@@ -1671,6 +1750,10 @@ interface InitOptions {
|
|
|
1671
1750
|
data: string;
|
|
1672
1751
|
}
|
|
1673
1752
|
|
|
1753
|
+
interface PublicSharedState {
|
|
1754
|
+
instrument: StoredPaymentInstrument | null;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1674
1757
|
interface PayrailsClientOptions {
|
|
1675
1758
|
environment?: PayrailsEnvironment;
|
|
1676
1759
|
events?: ClientEvents;
|
|
@@ -1692,6 +1775,7 @@ declare class Payrails {
|
|
|
1692
1775
|
private __genericRedirectButton;
|
|
1693
1776
|
private __dynamicElementForm;
|
|
1694
1777
|
private __dropin;
|
|
1778
|
+
private __sharedState;
|
|
1695
1779
|
static preloadCardForm: typeof SdkLoader.preloadCardForm;
|
|
1696
1780
|
static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
|
|
1697
1781
|
update(amount: PayrailsAmount): void;
|
|
@@ -1700,6 +1784,7 @@ declare class Payrails {
|
|
|
1700
1784
|
isGooglePayAvailable(merchantInfo: google.payments.api.MerchantInfo): Promise<boolean>;
|
|
1701
1785
|
applePayButton(options: ApplePayButtonOptions): ApplePayButton;
|
|
1702
1786
|
isApplePayAvailable(): Promise<boolean>;
|
|
1787
|
+
setState({ instrument }: PublicSharedState): void;
|
|
1703
1788
|
cardList(options?: CardListOptions): CardList;
|
|
1704
1789
|
cardForm(options?: CardFormOptions): CardForm;
|
|
1705
1790
|
dropin(options: DropinOptions): Dropin;
|
|
@@ -1711,6 +1796,7 @@ declare class Payrails {
|
|
|
1711
1796
|
operation: TOperation;
|
|
1712
1797
|
}): Promise<Operations[TOperation]['responseType']>;
|
|
1713
1798
|
getStoredInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
1799
|
+
getStoredInstrumentsByPaymentMethod(paymentMethod: PAYMENT_METHOD_CODES): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
1714
1800
|
getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
|
|
1715
1801
|
paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
|
|
1716
1802
|
paypalButton(options?: PaypalButtonOptions): PaypalButton;
|