fix(2526): fix check for payment with card without 3ds

keep-around/47eb31df4c19e533395e7a7a017207ca41855574
Andrei Dekterev 3 years ago
parent a1797acf9b
commit 47eb31df4c
  1. 7
      src/features/AddCardForm/components/Form/hooks/index.tsx
  2. 11
      src/features/BuyMatchPopup/store/hooks/index.tsx

@ -87,8 +87,9 @@ export const useFormSubmit = ({ onAddSuccess }: Props) => {
const [errorMessage, setErrorMessage] = useState('')
const [loader, setLoader] = useState(false)
const dataHighlights = useRecoilValue(dataForPayHighlights)
const {
onConfirmationSuccessHiglights,
onSuccessfulHighlights,
onUnsuccessfulSubscription,
} = useBuyMatchPopupStore()
@ -189,7 +190,7 @@ export const useFormSubmit = ({ onAddSuccess }: Props) => {
cardId: defaultCard?.id,
order: { ...dataHighlights?.data },
})
.then(() => onConfirmationSuccessHiglights, onUnsuccessfulSubscription)
.then(onSuccessfulHighlights, onUnsuccessfulSubscription)
.catch(() => setErrorMessage(translate('error_payment_unsuccessful')))
.finally(() => setLoader(false))
return
@ -234,7 +235,7 @@ export const useFormSubmit = ({ onAddSuccess }: Props) => {
cardId: defaultCard.id,
order: { ...dataHighlights?.data },
})
.then(() => onConfirmationSuccessHiglights, onUnsuccessfulSubscription)
.then(onSuccessfulHighlights, onUnsuccessfulSubscription)
.catch(() => setErrorMessage(translate('error_payment_unsuccessful')))
}
})

@ -141,14 +141,16 @@ export const useBuyMatchPopup = () => {
.then(onSuccessfulSubscription, goToError)
}
const onConfirmationSuccessHiglights = ({ id }: PaymentIntent) => {
notifySuccessfulSubscription({ paymentIntentId: id })
.then(() => {
const onSuccessfulHighlights = () => {
setDataHighlights((prev) => ({
...prev,
isOpenThanksPopup: true,
}))
})
}
const onConfirmationSuccessHiglights = ({ id }: PaymentIntent) => {
notifySuccessfulSubscription({ paymentIntentId: id })
.then(onSuccessfulHighlights)
}
const onUnsuccessfulSubscription = (data?: OnFailedPaymentActionData) => {
@ -213,6 +215,7 @@ export const useBuyMatchPopup = () => {
onPackageSelect,
onPeriodSelect,
onSubscriptionSelect,
onSuccessfulHighlights,
onUnsuccessfulSubscription,
open: openPopup,
postPaymentHandler,

Loading…
Cancel
Save