Skip to content

Commit

Permalink
fix: Redirect flow with Adyen 3DS-1
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza committed Dec 16, 2021
1 parent 3bbc03e commit 1e14e00
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/AdyenPayment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ const AdyenPayment: FunctionComponent<AdyenPaymentProps> = ({
recurringProcessingModel: 'CardOnFile',
origin: window.location.origin,
return_url: window.location.href,
redirect_from_issuer_method: 'GET',
browser_info: {
acceptHeader:
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
Expand Down
16 changes: 15 additions & 1 deletion src/components/PlaceOrderButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,24 @@ const PlaceOrderButton: FunctionComponent<PlaceOrderButtonProps> = (props) => {
handleClick()
}
}, [options?.paypalPayerId])
useEffect(() => {
if (
paymentType === 'adyen_payments' &&
options?.adyen?.MD &&
options?.adyen?.PaRes &&
order?.status &&
['draft', 'pending'].includes(order?.status)
) {
handleClick()
}
}, [options?.adyen])
const handleClick = async () => {
let isValid = true
setForceDisable(true)
if (currentPaymentMethodRef?.current?.onsubmit && !options?.paypalPayerId) {
if (
currentPaymentMethodRef?.current?.onsubmit &&
(!options?.paypalPayerId || !options?.adyen?.MD)
) {
// @ts-ignore
isValid = (await currentPaymentMethodRef.current?.onsubmit()) as any
// @ts-ignore
Expand Down
4 changes: 4 additions & 0 deletions src/reducers/PlaceOrderReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export type PlaceOrderActionType = 'setErrors' | 'setPlaceOrderPermitted'

export type PlaceOrderOptions = {
paypalPayerId?: string
adyen?: {
MD: string
PaRes: string
}
}

export interface PlaceOrderActionPayload {
Expand Down

0 comments on commit 1e14e00

Please sign in to comment.