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