Redirect to continuation on block server error

This commit is contained in:
Alex P 2023-10-19 16:56:07 +03:00
parent bb92792420
commit f13fc1d987
No known key found for this signature in database
GPG key ID: 54487A734A204D71

View file

@ -253,21 +253,24 @@ const PayPalComponent = ({
}, [onPaymentSetup, paypalOrder, activePaymentMethod]);
useEffect(() => {
if (activePaymentMethod !== config.id) {
return;
}
const unsubscribe = onCheckoutFail(({ processingResponse }) => {
console.error(processingResponse)
if (onClose) {
onClose();
}
if (processingResponse?.paymentDetails?.errorMessage) {
return {
type: emitResponse.responseTypes.ERROR,
message: processingResponse.paymentDetails.errorMessage,
messageContext: config.scriptData.continuation ? emitResponse.noticeContexts.PAYMENTS : emitResponse.noticeContexts.EXPRESS_PAYMENTS,
};
if (config.scriptData.continuation) {
return true;
}
if (!config.finalReviewEnabled) {
location.href = getCheckoutRedirectUrl();
}
return true;
});
return unsubscribe;
}, [onCheckoutFail, onClose]);
}, [onCheckoutFail, onClose, activePaymentMethod]);
if (config.scriptData.continuation) {
return (