@pay-com/js 1.2.0 → 1.2.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/lib/dts/types/index.d.ts +95 -1
- package/lib/index.d.ts +95 -1
- package/package.json +1 -1
package/lib/dts/types/index.d.ts
CHANGED
|
@@ -227,6 +227,28 @@ export interface ApmStyle {
|
|
|
227
227
|
input?: PayCssConfig
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
+
type JssObject = {
|
|
231
|
+
[K in keyof PayCssConfig]?: PayCssConfig[K]
|
|
232
|
+
} & {
|
|
233
|
+
[selector: `& ${string}`]: JssObject | string | number | undefined
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
type CheckboxStyleOverrides = {
|
|
237
|
+
':selected'?: CSS.Properties
|
|
238
|
+
} & CSS.Properties
|
|
239
|
+
|
|
240
|
+
export type DynamicFieldStyles = {
|
|
241
|
+
label?: CSS.Properties
|
|
242
|
+
input?: CSS.Properties
|
|
243
|
+
date?: CSS.Properties
|
|
244
|
+
select?: JssObject
|
|
245
|
+
radio?: {
|
|
246
|
+
color?: CSS.Properties['color']
|
|
247
|
+
label?: CSS.Properties
|
|
248
|
+
}
|
|
249
|
+
checkbox?: CheckboxStyleOverrides
|
|
250
|
+
}
|
|
251
|
+
|
|
230
252
|
export interface UniversalOpts {
|
|
231
253
|
container: string
|
|
232
254
|
cardForm?: Omit<RenderOpts, 'container' | 'style'>
|
|
@@ -270,6 +292,7 @@ export interface UniversalOpts {
|
|
|
270
292
|
}
|
|
271
293
|
}
|
|
272
294
|
ctp?: CTPStyles
|
|
295
|
+
paymentMethodFields?: DynamicFieldStyles
|
|
273
296
|
}
|
|
274
297
|
paymentMethods?: Array<string>
|
|
275
298
|
alternatives?: 'button' | 'radio'
|
|
@@ -497,10 +520,15 @@ export type AddressType = {
|
|
|
497
520
|
postalCode: string
|
|
498
521
|
}
|
|
499
522
|
|
|
523
|
+
export type HeadlessPaymentOptions = {
|
|
524
|
+
saveSourceForFutureUse?: boolean
|
|
525
|
+
}
|
|
526
|
+
|
|
500
527
|
export type HeadlessFn = (
|
|
501
528
|
method: string,
|
|
502
529
|
paymentMethodData?: unknown,
|
|
503
|
-
billingDetails?: AddressType
|
|
530
|
+
billingDetails?: AddressType,
|
|
531
|
+
options?: HeadlessPaymentOptions
|
|
504
532
|
) => Promise<unknown>
|
|
505
533
|
|
|
506
534
|
export type CanMakePaymentsFn = () => Promise<unknown>
|
|
@@ -556,6 +584,70 @@ export type HeadlessCtpObject = {
|
|
|
556
584
|
STATUS_DECLINED: CtpCompletePaymentStatus.declined
|
|
557
585
|
}
|
|
558
586
|
|
|
587
|
+
export type CustomFieldType = 'input' | 'date' | 'checkbox' | 'radio' | 'select'
|
|
588
|
+
|
|
589
|
+
export type CustomFieldsOptions = {
|
|
590
|
+
label: string
|
|
591
|
+
value: string
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export type CustomField = {
|
|
595
|
+
id: string
|
|
596
|
+
placeholder?: string
|
|
597
|
+
label?: string
|
|
598
|
+
type?: CustomFieldType
|
|
599
|
+
inputType?: string
|
|
600
|
+
options?: CustomFieldsOptions[]
|
|
601
|
+
description?: string
|
|
602
|
+
validation?: CustomFieldsValidation
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
export type CustomFieldsValidation = {
|
|
606
|
+
required?: boolean
|
|
607
|
+
max?: number
|
|
608
|
+
min?: number
|
|
609
|
+
maxLength?: number
|
|
610
|
+
minLength?: number
|
|
611
|
+
pattern?: string
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export type CardBrand =
|
|
615
|
+
| 'visa'
|
|
616
|
+
| 'mastercard'
|
|
617
|
+
| 'amex'
|
|
618
|
+
| 'discover'
|
|
619
|
+
| 'jcl'
|
|
620
|
+
| 'unionpay'
|
|
621
|
+
|
|
622
|
+
export type PaymentMethod = {
|
|
623
|
+
paymentMethodType: string
|
|
624
|
+
name: string
|
|
625
|
+
redirect?: boolean
|
|
626
|
+
fields?: CustomField[]
|
|
627
|
+
supportedCardBrands?: CardBrand[]
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
export type ExistingCard = {
|
|
631
|
+
bin: string
|
|
632
|
+
brand: CardBrand
|
|
633
|
+
cardholderCurrency: string
|
|
634
|
+
country: string
|
|
635
|
+
issuerName: string
|
|
636
|
+
expMonth: string
|
|
637
|
+
expYear: string
|
|
638
|
+
last4: string
|
|
639
|
+
fingerprint: string
|
|
640
|
+
funding: 'prepaid' | 'debit' | 'credit' | 'charge'
|
|
641
|
+
network: CardBrand
|
|
642
|
+
payout: string
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export type ExistingSource = {
|
|
646
|
+
id: string
|
|
647
|
+
type: string
|
|
648
|
+
card?: ExistingCard
|
|
649
|
+
}
|
|
650
|
+
|
|
559
651
|
export type CheckoutObject = {
|
|
560
652
|
on: ListenerFn
|
|
561
653
|
once: ListenerFn
|
|
@@ -576,6 +668,8 @@ export type CheckoutObject = {
|
|
|
576
668
|
pay: PayFn
|
|
577
669
|
headless: HeadlessFn
|
|
578
670
|
ctp: (params: InitHeadlessCtpParams) => Promise<HeadlessCtpObject>
|
|
671
|
+
getPaymentMethods: () => Promise<PaymentMethod[]>
|
|
672
|
+
getExistingSources: () => Promise<ExistingSource[]>
|
|
579
673
|
}
|
|
580
674
|
|
|
581
675
|
export type CheckoutFunction = (opts: CheckoutOpts) => CheckoutObject
|
package/lib/index.d.ts
CHANGED
|
@@ -232,6 +232,28 @@ interface ApmStyle {
|
|
|
232
232
|
input?: PayCssConfig
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
type JssObject = {
|
|
236
|
+
[K in keyof PayCssConfig]?: PayCssConfig[K]
|
|
237
|
+
} & {
|
|
238
|
+
[selector: `& ${string}`]: JssObject | string | number | undefined
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
type CheckboxStyleOverrides = {
|
|
242
|
+
':selected'?: CSS.Properties
|
|
243
|
+
} & CSS.Properties
|
|
244
|
+
|
|
245
|
+
type DynamicFieldStyles = {
|
|
246
|
+
label?: CSS.Properties
|
|
247
|
+
input?: CSS.Properties
|
|
248
|
+
date?: CSS.Properties
|
|
249
|
+
select?: JssObject
|
|
250
|
+
radio?: {
|
|
251
|
+
color?: CSS.Properties['color']
|
|
252
|
+
label?: CSS.Properties
|
|
253
|
+
}
|
|
254
|
+
checkbox?: CheckboxStyleOverrides
|
|
255
|
+
}
|
|
256
|
+
|
|
235
257
|
interface UniversalOpts {
|
|
236
258
|
container: string
|
|
237
259
|
cardForm?: Omit<RenderOpts, 'container' | 'style'>
|
|
@@ -275,6 +297,7 @@ interface UniversalOpts {
|
|
|
275
297
|
}
|
|
276
298
|
}
|
|
277
299
|
ctp?: CTPStyles
|
|
300
|
+
paymentMethodFields?: DynamicFieldStyles
|
|
278
301
|
}
|
|
279
302
|
paymentMethods?: Array<string>
|
|
280
303
|
alternatives?: 'button' | 'radio'
|
|
@@ -496,10 +519,15 @@ type AddressType = {
|
|
|
496
519
|
postalCode: string
|
|
497
520
|
}
|
|
498
521
|
|
|
522
|
+
type HeadlessPaymentOptions = {
|
|
523
|
+
saveSourceForFutureUse?: boolean
|
|
524
|
+
}
|
|
525
|
+
|
|
499
526
|
type HeadlessFn = (
|
|
500
527
|
method: string,
|
|
501
528
|
paymentMethodData?: unknown,
|
|
502
|
-
billingDetails?: AddressType
|
|
529
|
+
billingDetails?: AddressType,
|
|
530
|
+
options?: HeadlessPaymentOptions
|
|
503
531
|
) => Promise<unknown>
|
|
504
532
|
|
|
505
533
|
type CanMakePaymentsFn = () => Promise<unknown>
|
|
@@ -555,6 +583,70 @@ type HeadlessCtpObject = {
|
|
|
555
583
|
STATUS_DECLINED: CtpCompletePaymentStatus.declined
|
|
556
584
|
}
|
|
557
585
|
|
|
586
|
+
type CustomFieldType = 'input' | 'date' | 'checkbox' | 'radio' | 'select'
|
|
587
|
+
|
|
588
|
+
type CustomFieldsOptions = {
|
|
589
|
+
label: string
|
|
590
|
+
value: string
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
type CustomField = {
|
|
594
|
+
id: string
|
|
595
|
+
placeholder?: string
|
|
596
|
+
label?: string
|
|
597
|
+
type?: CustomFieldType
|
|
598
|
+
inputType?: string
|
|
599
|
+
options?: CustomFieldsOptions[]
|
|
600
|
+
description?: string
|
|
601
|
+
validation?: CustomFieldsValidation
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
type CustomFieldsValidation = {
|
|
605
|
+
required?: boolean
|
|
606
|
+
max?: number
|
|
607
|
+
min?: number
|
|
608
|
+
maxLength?: number
|
|
609
|
+
minLength?: number
|
|
610
|
+
pattern?: string
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
type CardBrand =
|
|
614
|
+
| 'visa'
|
|
615
|
+
| 'mastercard'
|
|
616
|
+
| 'amex'
|
|
617
|
+
| 'discover'
|
|
618
|
+
| 'jcl'
|
|
619
|
+
| 'unionpay'
|
|
620
|
+
|
|
621
|
+
type PaymentMethod = {
|
|
622
|
+
paymentMethodType: string
|
|
623
|
+
name: string
|
|
624
|
+
redirect?: boolean
|
|
625
|
+
fields?: CustomField[]
|
|
626
|
+
supportedCardBrands?: CardBrand[]
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
type ExistingCard = {
|
|
630
|
+
bin: string
|
|
631
|
+
brand: CardBrand
|
|
632
|
+
cardholderCurrency: string
|
|
633
|
+
country: string
|
|
634
|
+
issuerName: string
|
|
635
|
+
expMonth: string
|
|
636
|
+
expYear: string
|
|
637
|
+
last4: string
|
|
638
|
+
fingerprint: string
|
|
639
|
+
funding: 'prepaid' | 'debit' | 'credit' | 'charge'
|
|
640
|
+
network: CardBrand
|
|
641
|
+
payout: string
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
type ExistingSource = {
|
|
645
|
+
id: string
|
|
646
|
+
type: string
|
|
647
|
+
card?: ExistingCard
|
|
648
|
+
}
|
|
649
|
+
|
|
558
650
|
type CheckoutObject = {
|
|
559
651
|
on: ListenerFn
|
|
560
652
|
once: ListenerFn
|
|
@@ -575,6 +667,8 @@ type CheckoutObject = {
|
|
|
575
667
|
pay: PayFn
|
|
576
668
|
headless: HeadlessFn
|
|
577
669
|
ctp: (params: InitHeadlessCtpParams) => Promise<HeadlessCtpObject>
|
|
670
|
+
getPaymentMethods: () => Promise<PaymentMethod[]>
|
|
671
|
+
getExistingSources: () => Promise<ExistingSource[]>
|
|
578
672
|
}
|
|
579
673
|
|
|
580
674
|
type CheckoutFunction = (opts: CheckoutOpts) => CheckoutObject
|