@adyen/adyen-web 5.22.0 → 5.23.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/dist/adyen.css +13 -4
- package/dist/adyen.css.map +1 -1
- package/dist/adyen.js +1 -1
- package/dist/adyen.js.map +1 -1
- package/dist/cjs/adyen.css +13 -4
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/es/adyen.css +13 -4
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es.modern/adyen.css +13 -4
- package/dist/es.modern/adyen.css.map +1 -1
- package/dist/es.modern/index.js +1 -1
- package/dist/types/components/BcmcMobile/BcmcMobile.d.ts +1 -0
- package/dist/types/components/Card/Bancontact.d.ts +12 -0
- package/dist/types/components/Card/Card.d.ts +28 -1
- package/dist/types/components/Card/ClickToPayHolder.d.ts +6 -0
- package/dist/types/components/Card/ClickToPayWrapper.d.ts +4 -0
- package/dist/types/components/Card/components/CardInput/defaultProps.d.ts +1 -0
- package/dist/types/components/Card/components/CardInput/types.d.ts +1 -0
- package/dist/types/components/Card/components/ClickToPay/ClickToPayComponent.d.ts +6 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPCards/CtPCards.d.ts +7 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPCards/CtPCardsList/CtPCardsList.d.ts +8 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPCards/CtPCardsList/index.d.ts +1 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPCards/CtPEmptyCardsList/CtPEmptyCardsList.d.ts +6 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPCards/CtPEmptyCardsList/index.d.ts +1 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPCards/CtPSingleCard/CtPSingleCard.d.ts +8 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPCards/CtPSingleCard/index.d.ts +1 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPCards/index.d.ts +1 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPLoader/CtPLoader.d.ts +4 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPLoader/index.d.ts +1 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPLogin/CtPLogin.d.ts +4 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPLogin/CtPLoginInput.d.ts +18 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPLogin/index.d.ts +1 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPLogin/validate.d.ts +2 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.d.ts +4 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.d.ts +20 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.d.ts +7 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/index.d.ts +1 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/validate.d.ts +2 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPOneTimePassword/index.d.ts +1 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPSection/CtPLogoutLink.d.ts +4 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPSection/CtPSection.d.ts +7 -0
- package/dist/types/components/Card/components/ClickToPay/components/CtPSection/index.d.ts +1 -0
- package/dist/types/components/Card/components/ClickToPay/context/ClickToPayContext.d.ts +22 -0
- package/dist/types/components/Card/components/ClickToPay/context/ClickToPayProvider.d.ts +16 -0
- package/dist/types/components/Card/components/ClickToPay/context/useClickToPayContext.d.ts +3 -0
- package/dist/types/components/Card/components/ClickToPay/index.d.ts +1 -0
- package/dist/types/components/Card/components/ClickToPay/models/ShopperCard.d.ts +15 -0
- package/dist/types/components/Card/components/ClickToPay/services/ClickToPayService.d.ts +79 -0
- package/dist/types/components/Card/components/ClickToPay/services/sdks/AbstractSrcInitiator.d.ts +75 -0
- package/dist/types/components/Card/components/ClickToPay/services/sdks/MastercardSdk.d.ts +13 -0
- package/dist/types/components/Card/components/ClickToPay/services/sdks/SrcSdkLoader.d.ts +12 -0
- package/dist/types/components/Card/components/ClickToPay/services/sdks/SrciError.d.ts +16 -0
- package/dist/types/components/Card/components/ClickToPay/services/sdks/VisaSdk.d.ts +13 -0
- package/dist/types/components/Card/components/ClickToPay/services/sdks/config.d.ts +28 -0
- package/dist/types/components/Card/components/ClickToPay/services/sdks/types.d.ts +46 -0
- package/dist/types/components/Card/components/ClickToPay/services/sdks/utils.d.ts +5 -0
- package/dist/types/components/Card/components/ClickToPay/services/types.d.ts +39 -0
- package/dist/types/components/Card/components/ClickToPay/services/utils.d.ts +6 -0
- package/dist/types/components/Card/components/ClickToPay/utils.d.ts +7 -0
- package/dist/types/components/Card/types.d.ts +26 -0
- package/dist/types/components/Dragonpay/Dragonpay.d.ts +1 -0
- package/dist/types/components/Dropin/Dropin.d.ts +1 -0
- package/dist/types/components/Pix/Pix.d.ts +1 -0
- package/dist/types/components/Swish/Swish.d.ts +1 -0
- package/dist/types/components/UIElement.d.ts +1 -0
- package/dist/types/components/WeChat/WeChat.d.ts +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/internal/Button/types.d.ts +3 -1
- package/dist/types/components/internal/ContentSeparator/ContentSeparator.d.ts +2 -1
- package/dist/types/components/internal/FormFields/Field/types.d.ts +2 -1
- package/dist/types/components/internal/FormFields/Select/Select.d.ts +1 -1
- package/dist/types/components/internal/FormFields/Select/components/SelectListItem.d.ts +1 -1
- package/dist/types/components/internal/FormFields/Select/types.d.ts +4 -0
- package/dist/types/components/internal/Icon/Icon.d.ts +3 -1
- package/dist/types/components/internal/PayButton/PayButton.d.ts +7 -6
- package/dist/types/components/internal/PayButton/components/SecondaryButtonLabel.d.ts +6 -0
- package/dist/types/components/internal/PayButton/utils.d.ts +7 -0
- package/dist/types/components/types.d.ts +3 -1
- package/dist/types/components/utils.d.ts +2 -2
- package/dist/types/core/types.d.ts +6 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/language/config.d.ts +33 -0
- package/dist/types/language/locales/index.d.ts +66 -0
- package/dist/types/types/index.d.ts +8 -0
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ declare class BCMCMobileElement extends QRLoaderContainer {
|
|
|
25
25
|
name?: string;
|
|
26
26
|
icon?: string;
|
|
27
27
|
amount?: import("../../types").PaymentAmount;
|
|
28
|
+
secondaryAmount?: import("../../types").PaymentAmountExtended;
|
|
28
29
|
showPayButton?: boolean;
|
|
29
30
|
setStatusAutomatically?: boolean;
|
|
30
31
|
payButton?: (options: import("../types").PayButtonFunctionProps) => import("preact").JSX.Element;
|
|
@@ -6,6 +6,7 @@ declare class BancontactElement extends CardElement {
|
|
|
6
6
|
brands: string[];
|
|
7
7
|
onBinLookup: () => void;
|
|
8
8
|
showBrandsUnderCardNumber: boolean;
|
|
9
|
+
useClickToPay: boolean;
|
|
9
10
|
SRConfig: {};
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
@@ -23,6 +24,10 @@ declare class BancontactElement extends CardElement {
|
|
|
23
24
|
countryCode: any;
|
|
24
25
|
configuration: {
|
|
25
26
|
socialSecurityNumberMode: import("./types").SocialSecurityMode;
|
|
27
|
+
visaSrciDpaId?: string;
|
|
28
|
+
visaSrcInitiatorId?: string;
|
|
29
|
+
mcSrcClientId?: string;
|
|
30
|
+
mcDpaId?: string;
|
|
26
31
|
merchantIdentifier?: string;
|
|
27
32
|
merchantOrigin?: string;
|
|
28
33
|
gatewayMerchantId?: string;
|
|
@@ -43,7 +48,13 @@ declare class BancontactElement extends CardElement {
|
|
|
43
48
|
showPanel: any;
|
|
44
49
|
};
|
|
45
50
|
installmentOptions: any;
|
|
51
|
+
clickToPayConfiguration: {
|
|
52
|
+
shopperIdentityValue: any;
|
|
53
|
+
locale: string;
|
|
54
|
+
shopperIdentityType?: "email" | "mobilePhone";
|
|
55
|
+
};
|
|
46
56
|
brand?: string;
|
|
57
|
+
useClickToPay: boolean;
|
|
47
58
|
brands?: string[];
|
|
48
59
|
showBrandsUnderCardNumber?: boolean;
|
|
49
60
|
showBrandIcon?: boolean;
|
|
@@ -70,6 +81,7 @@ declare class BancontactElement extends CardElement {
|
|
|
70
81
|
isInstantPayment?: boolean;
|
|
71
82
|
name?: string;
|
|
72
83
|
amount?: import("../../types").PaymentAmount;
|
|
84
|
+
secondaryAmount?: import("../../types").PaymentAmountExtended;
|
|
73
85
|
showPayButton?: boolean;
|
|
74
86
|
setStatusAutomatically?: boolean;
|
|
75
87
|
payButton?: (options: import("../types").PayButtonFunctionProps) => import("preact").JSX.Element;
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { h } from 'preact';
|
|
2
2
|
import { UIElement } from '../UIElement';
|
|
3
|
-
import { CardElementData, CardElementProps
|
|
3
|
+
import { BinLookupResponse, CardElementData, CardElementProps } from './types';
|
|
4
4
|
import { CbObjOnBinLookup } from '../internal/SecuredFields/lib/types';
|
|
5
|
+
import { UIElementStatus } from '../types';
|
|
5
6
|
export declare class CardElement extends UIElement<CardElementProps> {
|
|
6
7
|
static type: string;
|
|
8
|
+
private readonly clickToPayService;
|
|
9
|
+
/**
|
|
10
|
+
* Reference to the 'ClickToPayComponent'
|
|
11
|
+
*/
|
|
12
|
+
private clickToPayRef;
|
|
13
|
+
constructor(props: any);
|
|
7
14
|
protected static defaultProps: {
|
|
8
15
|
onBinLookup: () => void;
|
|
9
16
|
showBrandsUnderCardNumber: boolean;
|
|
17
|
+
useClickToPay: boolean;
|
|
10
18
|
SRConfig: {};
|
|
11
19
|
};
|
|
20
|
+
setStatus(status: UIElementStatus, props?: any): this;
|
|
12
21
|
setComponentRef: (ref: any) => void;
|
|
22
|
+
private setClickToPayRef;
|
|
13
23
|
formatProps(props: CardElementProps): {
|
|
14
24
|
holderNameRequired: boolean;
|
|
15
25
|
hasCVC: boolean;
|
|
@@ -18,6 +28,10 @@ export declare class CardElement extends UIElement<CardElementProps> {
|
|
|
18
28
|
countryCode: any;
|
|
19
29
|
configuration: {
|
|
20
30
|
socialSecurityNumberMode: import("./types").SocialSecurityMode;
|
|
31
|
+
visaSrciDpaId?: string;
|
|
32
|
+
visaSrcInitiatorId?: string;
|
|
33
|
+
mcSrcClientId?: string;
|
|
34
|
+
mcDpaId?: string;
|
|
21
35
|
merchantIdentifier?: string;
|
|
22
36
|
merchantOrigin?: string;
|
|
23
37
|
gatewayMerchantId?: string;
|
|
@@ -38,7 +52,17 @@ export declare class CardElement extends UIElement<CardElementProps> {
|
|
|
38
52
|
showPanel: any;
|
|
39
53
|
};
|
|
40
54
|
installmentOptions: any;
|
|
55
|
+
/**
|
|
56
|
+
* Click to Pay configuration
|
|
57
|
+
* - If email is set explicitly in the configuration, then it can override the one used in the session creation
|
|
58
|
+
*/
|
|
59
|
+
clickToPayConfiguration: {
|
|
60
|
+
shopperIdentityValue: any;
|
|
61
|
+
locale: string;
|
|
62
|
+
shopperIdentityType?: "email" | "mobilePhone";
|
|
63
|
+
};
|
|
41
64
|
brand?: string;
|
|
65
|
+
useClickToPay: boolean;
|
|
42
66
|
brands?: string[];
|
|
43
67
|
showBrandsUnderCardNumber?: boolean;
|
|
44
68
|
showBrandIcon?: boolean;
|
|
@@ -65,6 +89,7 @@ export declare class CardElement extends UIElement<CardElementProps> {
|
|
|
65
89
|
isInstantPayment?: boolean;
|
|
66
90
|
name?: string;
|
|
67
91
|
amount?: import("../../types").PaymentAmount;
|
|
92
|
+
secondaryAmount?: import("../../types").PaymentAmountExtended;
|
|
68
93
|
showPayButton?: boolean;
|
|
69
94
|
setStatusAutomatically?: boolean;
|
|
70
95
|
payButton?: (options: import("../types").PayButtonFunctionProps) => h.JSX.Element;
|
|
@@ -90,6 +115,7 @@ export declare class CardElement extends UIElement<CardElementProps> {
|
|
|
90
115
|
onBrand: (event: any) => void;
|
|
91
116
|
processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset?: boolean): this;
|
|
92
117
|
handleUnsupportedCard(errObj: any): this;
|
|
118
|
+
private handleClickToPaySubmit;
|
|
93
119
|
onBinLookup(obj: CbObjOnBinLookup): void;
|
|
94
120
|
onBinValue: (callbackObj: import("../internal/SecuredFields/lib/types").CbObjOnBinValue) => void;
|
|
95
121
|
get isValid(): boolean;
|
|
@@ -102,6 +128,7 @@ export declare class CardElement extends UIElement<CardElementProps> {
|
|
|
102
128
|
get displayName(): string;
|
|
103
129
|
get accessibleName(): string;
|
|
104
130
|
get browserInfo(): import("../../types").BrowserInfo;
|
|
131
|
+
private renderCardInput;
|
|
105
132
|
render(): h.JSX.Element;
|
|
106
133
|
}
|
|
107
134
|
export default CardElement;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ClickToPayProviderProps } from './components/ClickToPay/context/ClickToPayProvider';
|
|
2
|
+
import { h } from 'preact';
|
|
3
|
+
declare const ClickToPayWrapper: ({ amount, clickToPayService, setClickToPayRef, onSetStatus, onSubmit, onError, ...props }: ClickToPayProviderProps) => h.JSX.Element;
|
|
4
|
+
export default ClickToPayWrapper;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import ShopperCard from '../../../models/ShopperCard';
|
|
3
|
+
declare type CtPCardsListProps = {
|
|
4
|
+
cards: ShopperCard[];
|
|
5
|
+
onChangeCard(card: ShopperCard): void;
|
|
6
|
+
};
|
|
7
|
+
declare const CtPCardsList: ({ cards, onChangeCard }: CtPCardsListProps) => h.JSX.Element;
|
|
8
|
+
export default CtPCardsList;
|
package/dist/types/components/Card/components/ClickToPay/components/CtPCards/CtPCardsList/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CtPCardsList';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CtPEmptyCardsList';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import ShopperCard from '../../../models/ShopperCard';
|
|
3
|
+
import './CtPSingleCard.scss';
|
|
4
|
+
declare type CtPSingleCardProps = {
|
|
5
|
+
card: ShopperCard;
|
|
6
|
+
};
|
|
7
|
+
declare const CtPSingleCard: ({ card }: CtPSingleCardProps) => h.JSX.Element;
|
|
8
|
+
export default CtPSingleCard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CtPSingleCard';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CtPCards';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CtPLoader';
|
package/dist/types/components/Card/components/ClickToPay/components/CtPLogin/CtPLoginInput.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface CtPLoginInputProps {
|
|
2
|
+
disabled: boolean;
|
|
3
|
+
errorMessage?: string;
|
|
4
|
+
onPressEnter(): void;
|
|
5
|
+
onChange({ data: CtPLoginInputDataState, valid, errors, isValid: boolean }: {
|
|
6
|
+
data: any;
|
|
7
|
+
valid: any;
|
|
8
|
+
errors: any;
|
|
9
|
+
isValid: any;
|
|
10
|
+
}): void;
|
|
11
|
+
}
|
|
12
|
+
export declare type CtPLoginInputHandlers = {
|
|
13
|
+
validateInput(): void;
|
|
14
|
+
};
|
|
15
|
+
declare const CtPLoginInput: import("preact").FunctionalComponent<Omit<CtPLoginInputProps, "ref"> & {
|
|
16
|
+
ref?: import("preact").Ref<CtPLoginInputHandlers>;
|
|
17
|
+
}>;
|
|
18
|
+
export default CtPLoginInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CtPLogin';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import './CtPOneTimePasswordInput.scss';
|
|
2
|
+
interface CtPOneTimePasswordInputProps {
|
|
3
|
+
disabled: boolean;
|
|
4
|
+
isValidatingOtp: boolean;
|
|
5
|
+
errorMessage?: string;
|
|
6
|
+
onPressEnter(): Promise<void>;
|
|
7
|
+
onChange({ data: CtPOneTimePasswordInputDataState, valid, errors, isValid: boolean }: {
|
|
8
|
+
data: any;
|
|
9
|
+
valid: any;
|
|
10
|
+
errors: any;
|
|
11
|
+
isValid: any;
|
|
12
|
+
}): void;
|
|
13
|
+
}
|
|
14
|
+
export declare type CtPOneTimePasswordInputHandlers = {
|
|
15
|
+
validateInput(): void;
|
|
16
|
+
};
|
|
17
|
+
declare const CtPOneTimePasswordInput: import("preact").FunctionalComponent<Omit<CtPOneTimePasswordInputProps, "ref"> & {
|
|
18
|
+
ref?: import("preact").Ref<CtPOneTimePasswordInputHandlers>;
|
|
19
|
+
}>;
|
|
20
|
+
export default CtPOneTimePasswordInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CtPOneTimePasswordInput';
|
package/dist/types/components/Card/components/ClickToPay/components/CtPOneTimePassword/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CtPOneTimePassword';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CtPSection';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CtpState } from '../services/ClickToPayService';
|
|
2
|
+
import { ClickToPayCheckoutPayload, IClickToPayService } from '../services/types';
|
|
3
|
+
import { PaymentAmount } from '../../../../../types';
|
|
4
|
+
import ShopperCard from '../models/ShopperCard';
|
|
5
|
+
import { UIElementStatus } from '../../../../types';
|
|
6
|
+
import AdyenCheckoutError from '../../../../../core/Errors/AdyenCheckoutError';
|
|
7
|
+
export interface ClickToPayContextInterface extends Pick<IClickToPayService, 'checkout' | 'startIdentityValidation' | 'finishIdentityValidation' | 'verifyIfShopperIsEnrolled'> {
|
|
8
|
+
isCtpPrimaryPaymentMethod: boolean;
|
|
9
|
+
setIsCtpPrimaryPaymentMethod(isPrimary: boolean): void;
|
|
10
|
+
logoutShopper(): void;
|
|
11
|
+
ctpState: CtpState;
|
|
12
|
+
cards: ShopperCard[];
|
|
13
|
+
schemes: string[];
|
|
14
|
+
otpMaskedContact: string;
|
|
15
|
+
amount: PaymentAmount;
|
|
16
|
+
status: UIElementStatus;
|
|
17
|
+
onSubmit(payload: ClickToPayCheckoutPayload): void;
|
|
18
|
+
onSetStatus(status: UIElementStatus): void;
|
|
19
|
+
onError(error: AdyenCheckoutError): void;
|
|
20
|
+
}
|
|
21
|
+
declare const ClickToPayContext: import("preact").Context<ClickToPayContextInterface>;
|
|
22
|
+
export { ClickToPayContext };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { ClickToPayCheckoutPayload, IClickToPayService } from '../services/types';
|
|
3
|
+
import { PaymentAmount } from '../../../../../types';
|
|
4
|
+
import { UIElementStatus } from '../../../../types';
|
|
5
|
+
import AdyenCheckoutError from '../../../../../core/Errors/AdyenCheckoutError';
|
|
6
|
+
export declare type ClickToPayProviderProps = {
|
|
7
|
+
clickToPayService: IClickToPayService | null;
|
|
8
|
+
amount: PaymentAmount;
|
|
9
|
+
children: any;
|
|
10
|
+
setClickToPayRef(ref: any): void;
|
|
11
|
+
onSubmit(payload: ClickToPayCheckoutPayload): void;
|
|
12
|
+
onSetStatus(status: UIElementStatus): void;
|
|
13
|
+
onError(error: AdyenCheckoutError): void;
|
|
14
|
+
};
|
|
15
|
+
declare const ClickToPayProvider: ({ clickToPayService, amount, children, setClickToPayRef, onSubmit, onSetStatus, onError }: ClickToPayProviderProps) => h.JSX.Element;
|
|
16
|
+
export default ClickToPayProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ClickToPayComponent';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SrcCard } from '../services/sdks/types';
|
|
2
|
+
import { ClickToPayScheme } from '../../../types';
|
|
3
|
+
declare class ShopperCard {
|
|
4
|
+
dateOfCardLastUsed: string;
|
|
5
|
+
panLastFour: string;
|
|
6
|
+
srcDigitalCardId: string;
|
|
7
|
+
scheme: ClickToPayScheme;
|
|
8
|
+
artUri: string;
|
|
9
|
+
srcCorrelationId: string;
|
|
10
|
+
tokenId?: string;
|
|
11
|
+
private descriptorName?;
|
|
12
|
+
constructor(maskedCard: SrcCard, scheme: ClickToPayScheme, srcCorrelationId: string);
|
|
13
|
+
get title(): string;
|
|
14
|
+
}
|
|
15
|
+
export default ShopperCard;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { CallbackStateSubscriber, IClickToPayService, IdentityLookupParams, ClickToPayCheckoutPayload } from './types';
|
|
2
|
+
import { ISrcSdkLoader } from './sdks/SrcSdkLoader';
|
|
3
|
+
import { SrcInitParams } from './sdks/types';
|
|
4
|
+
import { ClickToPayScheme } from '../../../types';
|
|
5
|
+
import ShopperCard from '../models/ShopperCard';
|
|
6
|
+
export declare enum CtpState {
|
|
7
|
+
Idle = "Idle",
|
|
8
|
+
Loading = "Loading",
|
|
9
|
+
ShopperIdentified = "ShopperIdentified",
|
|
10
|
+
OneTimePassword = "OneTimePassword",
|
|
11
|
+
Ready = "Ready",
|
|
12
|
+
Login = "Login",
|
|
13
|
+
NotAvailable = "NotAvailable"
|
|
14
|
+
}
|
|
15
|
+
declare class ClickToPayService implements IClickToPayService {
|
|
16
|
+
private readonly sdkLoader;
|
|
17
|
+
private readonly schemesConfig;
|
|
18
|
+
private readonly shopperIdentity?;
|
|
19
|
+
private readonly environment;
|
|
20
|
+
/**
|
|
21
|
+
* Mandatory unique ID passed to all the networks (Click to Pay systems), used to track user journey
|
|
22
|
+
*/
|
|
23
|
+
private readonly srciTransactionId;
|
|
24
|
+
private sdks;
|
|
25
|
+
private validationSchemeSdk;
|
|
26
|
+
private stateSubscriber;
|
|
27
|
+
state: CtpState;
|
|
28
|
+
shopperCards: ShopperCard[];
|
|
29
|
+
shopperValidationContact: string;
|
|
30
|
+
constructor(schemesConfig: Record<ClickToPayScheme, SrcInitParams>, sdkLoader: ISrcSdkLoader, environment: string, shopperIdentity?: IdentityLookupParams);
|
|
31
|
+
get schemes(): string[];
|
|
32
|
+
initialize(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Set the callback for notifying when the CtPState changes
|
|
35
|
+
*/
|
|
36
|
+
subscribeOnStateChange(callback: CallbackStateSubscriber): void;
|
|
37
|
+
/**
|
|
38
|
+
* Initiates Consumer Identity validation with one Click to Pay System.
|
|
39
|
+
* The Click to Pay System sends a one-time-password (OTP) to the registered email address or mobile number.
|
|
40
|
+
**/
|
|
41
|
+
startIdentityValidation(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Completes the validation of the Shopper by evaluating the supplied OTP.
|
|
44
|
+
*/
|
|
45
|
+
finishIdentityValidation(otpCode: string): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* This method performs checkout using the selected card
|
|
48
|
+
*/
|
|
49
|
+
checkout(card: ShopperCard): Promise<ClickToPayCheckoutPayload>;
|
|
50
|
+
/**
|
|
51
|
+
* Call the 'unbindAppInstance()' method of each SRC SDK in order to remove the shopper cookies.
|
|
52
|
+
* Besides, it deletes all information stored about the shopper.
|
|
53
|
+
*/
|
|
54
|
+
logout(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Call the 'identityLookup()' method of each SRC SDK in order to verify if the shopper has an account.
|
|
57
|
+
*
|
|
58
|
+
* Based on the responses from the Click to Pay Systems, we should do the validation process using the SDK that
|
|
59
|
+
* that responds faster with 'consumerPresent=true'
|
|
60
|
+
*/
|
|
61
|
+
verifyIfShopperIsEnrolled(value: string, type?: 'email' | 'mobilePhone'): Promise<{
|
|
62
|
+
isEnrolled: boolean;
|
|
63
|
+
}>;
|
|
64
|
+
private setState;
|
|
65
|
+
private setSdkForPerformingShopperIdentityValidation;
|
|
66
|
+
/**
|
|
67
|
+
* Based on the given idToken, this method goes through each SRCi SDK and fetches the shopper
|
|
68
|
+
* profile with his cards
|
|
69
|
+
*/
|
|
70
|
+
private getShopperProfile;
|
|
71
|
+
/**
|
|
72
|
+
* Calls the 'isRecognized()' method of each SRC SDK in order to verify if the shopper is
|
|
73
|
+
* recognized on the device. The shopper is recognized if he/she has the Cookies stored
|
|
74
|
+
* on their browser
|
|
75
|
+
*/
|
|
76
|
+
private verifyIfShopperIsRecognized;
|
|
77
|
+
private initiateSdks;
|
|
78
|
+
}
|
|
79
|
+
export default ClickToPayService;
|
package/dist/types/components/Card/components/ClickToPay/services/sdks/AbstractSrcInitiator.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { IdentityLookupParams } from '../types';
|
|
2
|
+
import { SrcCheckoutParams, SrciCheckoutResponse, SrciCompleteIdentityValidationResponse, SrciIdentityLookupResponse, SrciInitiateIdentityValidationResponse, SrciIsRecognizedResponse, SrcInitParams, SrcProfile } from './types';
|
|
3
|
+
import { ClickToPayScheme } from '../../../../types';
|
|
4
|
+
export interface ISrcInitiator {
|
|
5
|
+
schemeName: ClickToPayScheme;
|
|
6
|
+
loadSdkScript(): Promise<void>;
|
|
7
|
+
removeSdkScript(): void;
|
|
8
|
+
init(params: SrcInitParams, srciTransactionId: string): Promise<void>;
|
|
9
|
+
isRecognized(): Promise<SrciIsRecognizedResponse>;
|
|
10
|
+
identityLookup(params: IdentityLookupParams): Promise<SrciIdentityLookupResponse>;
|
|
11
|
+
initiateIdentityValidation(): Promise<SrciInitiateIdentityValidationResponse>;
|
|
12
|
+
completeIdentityValidation(validationData: string): Promise<SrciCompleteIdentityValidationResponse>;
|
|
13
|
+
getSrcProfile(idTokens: string[]): Promise<SrcProfile>;
|
|
14
|
+
checkout(params: SrcCheckoutParams): Promise<SrciCheckoutResponse>;
|
|
15
|
+
unbindAppInstance(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export default abstract class AbstractSrcInitiator implements ISrcInitiator {
|
|
18
|
+
schemeSdk: any;
|
|
19
|
+
abstract readonly schemeName: ClickToPayScheme;
|
|
20
|
+
protected readonly dpaLocale: string;
|
|
21
|
+
private readonly sdkUrl;
|
|
22
|
+
private scriptElement;
|
|
23
|
+
protected constructor(sdkUrl: string, dpaLocale: string);
|
|
24
|
+
loadSdkScript(): Promise<void>;
|
|
25
|
+
removeSdkScript(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Verifies if SDK is already loaded on the window object.
|
|
28
|
+
* Example: Merchant can preload the SDK to speed up the loading time
|
|
29
|
+
*/
|
|
30
|
+
protected abstract isSdkIsAvailableOnWindow(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Assign SchemeSDK object to 'schemeSdk' property.
|
|
33
|
+
* Each scheme creates its own object reference on 'window' using different naming,
|
|
34
|
+
* therefore this method should be implemented by the subclass to assign the property
|
|
35
|
+
* accordingly
|
|
36
|
+
*/
|
|
37
|
+
protected abstract assignSdkReference(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Initializes the app with common state. The init method must be called before any other methods.
|
|
40
|
+
*/
|
|
41
|
+
abstract init(params: SrcInitParams, srciTransactionId: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* This method performs checkout using the specified card. If successful, the
|
|
44
|
+
* response contains summary checkout information.
|
|
45
|
+
*/
|
|
46
|
+
checkout(params: SrcCheckoutParams): Promise<SrciCheckoutResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* This method disassociates the Consumer application / Consumer Device from the Consumer’s SRC Profile.
|
|
49
|
+
*/
|
|
50
|
+
unbindAppInstance(): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Determines whether the consumer is recognized, e.g. by detecting the presence of a local cookie in
|
|
53
|
+
* the browser environment.
|
|
54
|
+
*/
|
|
55
|
+
isRecognized(): Promise<SrciIsRecognizedResponse>;
|
|
56
|
+
/**
|
|
57
|
+
* Sends a validation code to the specified consumer.
|
|
58
|
+
* This method sends a one-time password (OTP) to the consumer to start validation
|
|
59
|
+
*/
|
|
60
|
+
initiateIdentityValidation(): Promise<SrciInitiateIdentityValidationResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Obtains the masked card and other account profile data associated with the userId.
|
|
63
|
+
*/
|
|
64
|
+
getSrcProfile(idTokens: string[]): Promise<any>;
|
|
65
|
+
/**
|
|
66
|
+
* Obtains the user account associated with the consumer’s identity (an email address or phone
|
|
67
|
+
* number).
|
|
68
|
+
*/
|
|
69
|
+
abstract identityLookup(params: IdentityLookupParams): Promise<SrciIdentityLookupResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* This method completes the identity validation by receiving the one-time password (OTP) sent to the
|
|
72
|
+
* consumer to start validation.
|
|
73
|
+
*/
|
|
74
|
+
abstract completeIdentityValidation(otp: string): Promise<SrciCompleteIdentityValidationResponse>;
|
|
75
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IdentityLookupParams } from '../types';
|
|
2
|
+
import AbstractSrcInitiator from './AbstractSrcInitiator';
|
|
3
|
+
import { SrciCompleteIdentityValidationResponse, SrciIdentityLookupResponse, SrcInitParams } from './types';
|
|
4
|
+
declare class MastercardSdk extends AbstractSrcInitiator {
|
|
5
|
+
readonly schemeName = "mc";
|
|
6
|
+
constructor(environment: string, locale: string);
|
|
7
|
+
protected isSdkIsAvailableOnWindow(): boolean;
|
|
8
|
+
protected assignSdkReference(): void;
|
|
9
|
+
init(params: SrcInitParams, srciTransactionId: string): Promise<void>;
|
|
10
|
+
identityLookup(params: IdentityLookupParams): Promise<SrciIdentityLookupResponse>;
|
|
11
|
+
completeIdentityValidation(otp: string): Promise<SrciCompleteIdentityValidationResponse>;
|
|
12
|
+
}
|
|
13
|
+
export default MastercardSdk;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ISrcInitiator } from './AbstractSrcInitiator';
|
|
2
|
+
export interface ISrcSdkLoader {
|
|
3
|
+
load(environment: string): Promise<ISrcInitiator[]>;
|
|
4
|
+
schemes: string[];
|
|
5
|
+
}
|
|
6
|
+
declare class SrcSdkLoader implements ISrcSdkLoader {
|
|
7
|
+
readonly schemes: string[];
|
|
8
|
+
private readonly locale;
|
|
9
|
+
constructor(schemes: string[], locale?: string);
|
|
10
|
+
load(environment: string): Promise<ISrcInitiator[]>;
|
|
11
|
+
}
|
|
12
|
+
export default SrcSdkLoader;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare type MastercardError = {
|
|
2
|
+
message: string;
|
|
3
|
+
reason: string;
|
|
4
|
+
};
|
|
5
|
+
declare type VisaError = {
|
|
6
|
+
error: {
|
|
7
|
+
message: string;
|
|
8
|
+
reason: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
declare class SrciError extends Error {
|
|
12
|
+
reason: string;
|
|
13
|
+
message: string;
|
|
14
|
+
constructor(schemeError: VisaError | MastercardError);
|
|
15
|
+
}
|
|
16
|
+
export default SrciError;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IdentityLookupParams } from '../types';
|
|
2
|
+
import AbstractSrcInitiator from './AbstractSrcInitiator';
|
|
3
|
+
import { SrciCompleteIdentityValidationResponse, SrciIdentityLookupResponse, SrcInitParams } from './types';
|
|
4
|
+
declare class VisaSdk extends AbstractSrcInitiator {
|
|
5
|
+
readonly schemeName = "visa";
|
|
6
|
+
constructor(environment: string, locale: string);
|
|
7
|
+
protected isSdkIsAvailableOnWindow(): boolean;
|
|
8
|
+
protected assignSdkReference(): void;
|
|
9
|
+
init(params: SrcInitParams, srciTransactionId: string): Promise<void>;
|
|
10
|
+
identityLookup(params: IdentityLookupParams): Promise<SrciIdentityLookupResponse>;
|
|
11
|
+
completeIdentityValidation(otp: string): Promise<SrciCompleteIdentityValidationResponse>;
|
|
12
|
+
}
|
|
13
|
+
export default VisaSdk;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const VISA_SDK_TEST = "https://sandbox-assets.secure.checkout.visa.com/checkout-widget/resources/js/src-i-adapter/visaSdk.js";
|
|
2
|
+
declare const VISA_SDK_PROD = "https://assets.secure.checkout.visa.com/checkout-widget/resources/js/src-i-adapter/visaSdk.js";
|
|
3
|
+
declare const MC_SDK_TEST = "https://sandbox.src.mastercard.com/sdk/srcsdk.mastercard.js";
|
|
4
|
+
declare const MC_SDK_PROD = "https://src.mastercard.com/sdk/srcsdk.mastercard.js";
|
|
5
|
+
declare const getVisaSetttings: ({ dpaLocale }: {
|
|
6
|
+
dpaLocale?: string;
|
|
7
|
+
}) => {
|
|
8
|
+
dpaTransactionOptions: {
|
|
9
|
+
dpaLocale: string;
|
|
10
|
+
payloadTypeIndicator: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
declare const getMastercardSettings: ({ dpaLocale }: {
|
|
14
|
+
dpaLocale?: string;
|
|
15
|
+
}) => {
|
|
16
|
+
dpaTransactionOptions: {
|
|
17
|
+
dpaLocale: string;
|
|
18
|
+
paymentOptions: {
|
|
19
|
+
dynamicDataType: string;
|
|
20
|
+
};
|
|
21
|
+
consumerNameRequested: boolean;
|
|
22
|
+
customInputData: {
|
|
23
|
+
'com.mastercard.dcfExperience': string;
|
|
24
|
+
};
|
|
25
|
+
confirmPayment: boolean;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export { VISA_SDK_TEST, VISA_SDK_PROD, MC_SDK_TEST, MC_SDK_PROD, getVisaSetttings, getMastercardSettings };
|