diff --git a/packages/lib/src/components/ThreeDS2/ThreeDS2Challenge.tsx b/packages/lib/src/components/ThreeDS2/ThreeDS2Challenge.tsx index d1f2d795f0..5b43fde06d 100644 --- a/packages/lib/src/components/ThreeDS2/ThreeDS2Challenge.tsx +++ b/packages/lib/src/components/ThreeDS2/ThreeDS2Challenge.tsx @@ -21,7 +21,7 @@ export interface ThreeDS2ChallengeProps { challengeWindowSize?: '01' | '02' | '03' | '04' | '05'; type?: string; loadingContext?: string; - useOriginalFlow?: boolean; + isMDFlow?: boolean; i18n?: Language; onActionHandled: (rtnObj: ActionHandledReturnObject) => void; } @@ -44,11 +44,10 @@ class ThreeDS2Challenge extends UIElement { // existy used because threeds2InMDFlow will send empty string for paymentData and we should be allowed to proceed with this if (!existy(this.props.paymentData)) { /** - * One component is used for both old and new 3DS2 challenge flows - * - The presence of useOriginalFlow indicates the old flow which used paymentData from the 3DS2 action - * - The new flow uses authorisationToken from the 3DS2 action, passed internally in a prop called paymentData + * The presence of props.isMDFlow indicates the action to create this component came from the threeds2InMDFlow process which passes (an empty) paymentsData. + * The regular, "native" flow uses the authorisationToken from the 3DS2 action, which actionTypes.ts assigns to a property called paymentData */ - const dataTypeForError = hasOwnProperty(this.props, 'useOriginalFlow') ? 'paymentData' : 'authorisationToken'; + const dataTypeForError = hasOwnProperty(this.props, 'isMDFlow') ? 'paymentData' : 'authorisationToken'; this.props.onError({ errorCode: 'threeds2.challenge', message: `No ${dataTypeForError} received. Challenge cannot proceed` }); return null; diff --git a/packages/lib/src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx b/packages/lib/src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx index 90dbbe1873..3fe4d84b70 100644 --- a/packages/lib/src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx +++ b/packages/lib/src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx @@ -17,7 +17,7 @@ export interface ThreeDS2DeviceFingerprintProps { paymentData: string; showSpinner: boolean; type: string; - useOriginalFlow?: boolean; + isMDFlow?: boolean; loadingContext?: string; clientKey?: string; elementRef?: UIElement; @@ -53,11 +53,10 @@ class ThreeDS2DeviceFingerprint extends UIElement; + return ; } } diff --git a/packages/lib/src/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.tsx b/packages/lib/src/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.tsx index 71bca811af..43258421bf 100644 --- a/packages/lib/src/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.tsx +++ b/packages/lib/src/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.tsx @@ -57,10 +57,9 @@ class PrepareChallenge3DS2 extends Component { /** * Create the data in the way that the /details endpoint expects. - * This is different for the 'old',v66, flow triggered by a 'threeDS2Challenge' action (which includes the threeds2InMDFlow) - * than for the new, v67, 'threeDS2' action + * This is different for the flow triggered by the threeds2InMDFlow process than for the new, v67, 'threeDS2' action */ - const resolveDataFunction = this.props.useOriginalFlow ? createOldChallengeResolveData : createChallengeResolveData; + const resolveDataFunction = this.props.isMDFlow ? createOldChallengeResolveData : createChallengeResolveData; const data = resolveDataFunction(this.props.dataKey, resultObj.transStatus, this.props.paymentData); this.props.onComplete(data); // (equals onAdditionalDetails - except for 3DS2InMDFlow) diff --git a/packages/lib/src/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.tsx b/packages/lib/src/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.tsx index ceff32322b..43ff24635a 100644 --- a/packages/lib/src/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.tsx +++ b/packages/lib/src/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.tsx @@ -53,11 +53,10 @@ class PrepareFingerprint3DS2 extends Component { /** - * Create the data in the way that the endpoint expects: - * - this will be the /details endpoint for the 'old', v66, flow triggered by a 'threeDS2Fingerprint' action - * - and will be the /submitThreeDS2Fingerprint endpoint for the new, v67, 'threeDS2' action + * Create the data in the way that the /details endpoint expects. + * This is different for the flow triggered by the threeds2InMDFlow process than for the new, v67, 'threeDS2' action */ - const resolveDataFunction = this.props.useOriginalFlow ? createOldFingerprintResolveData : createFingerprintResolveData; + const resolveDataFunction = this.props.isMDFlow ? createOldFingerprintResolveData : createFingerprintResolveData; const data = resolveDataFunction(this.props.dataKey, resultObj, this.props.paymentData); /** diff --git a/packages/lib/src/core/ProcessResponse/PaymentAction/actionTypes.ts b/packages/lib/src/core/ProcessResponse/PaymentAction/actionTypes.ts index a6aced28fd..edc1bb75c5 100644 --- a/packages/lib/src/core/ProcessResponse/PaymentAction/actionTypes.ts +++ b/packages/lib/src/core/ProcessResponse/PaymentAction/actionTypes.ts @@ -40,42 +40,10 @@ const actionTypes = { return createComponent(core, registry, 'redirect', config); }, - threeDS2Fingerprint: (core: ICore, registry, action: PaymentAction, props) => { - const config = { - createFromAction: props.createFromAction, - token: action.token, - paymentData: action.paymentData, - onError: props.onError, - showSpinner: !props.isDropin, - isDropin: !!props.isDropin, - ...props, - type: 'IdentifyShopper', - onComplete: props.onAdditionalDetails, - statusType: 'loading', - useOriginalFlow: true - }; - return createComponent(core, registry, 'threeDS2DeviceFingerprint', config); - }, - - threeDS2Challenge: (core: ICore, registry, action: PaymentAction, props) => { - const config = { - ...props, - token: action.token, - paymentData: action.paymentData, - onComplete: props.onAdditionalDetails, - onError: props.onError, - size: props.size ?? '02', - isDropin: !!props.isDropin, - type: 'ChallengeShopper', - statusType: 'custom', - useOriginalFlow: true - }; - return createComponent(core, registry, 'threeDS2Challenge', config); - }, - threeDS2: (core: ICore, registry, action: PaymentAction, props) => { const componentType = action.subtype === 'fingerprint' ? 'threeDS2DeviceFingerprint' : 'threeDS2Challenge'; - const paymentData = action.subtype === 'fingerprint' ? action.paymentData : action.authorisationToken; + + const paymentData = action.subtype === 'fingerprint' || props.isMDFlow ? action.paymentData : action.authorisationToken; const config = { // Props common to both flows @@ -83,13 +51,14 @@ const actionTypes = { token: action.token, paymentData, onActionHandled: props.onActionHandled, - onComplete: props.onAdditionalDetails, + onComplete: props.isMDFlow ? props.onComplete : props.onAdditionalDetails, onError: props.onError, isDropin: !!props.isDropin, loadingContext: props.loadingContext, clientKey: props.clientKey, paymentMethodType: props.paymentMethodType, challengeWindowSize: props.challengeWindowSize, // always pass challengeWindowSize in case it's been set directly in the handleAction config object + isMDFlow: props.isMDFlow, // Props unique to a particular flow ...get3DS2FlowProps(action.subtype, props)