mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-03 08:37:53 +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]);
|
}, [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 (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue