mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Redirect to continuation on block server error
This commit is contained in:
parent
bb92792420
commit
f13fc1d987
1 changed files with 10 additions and 7 deletions
|
@ -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 (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue