mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
Merge branch 'trunk' into PCP-1486-paylater-block
This commit is contained in:
commit
c83975f293
54 changed files with 2315 additions and 1600 deletions
|
@ -34,6 +34,7 @@ const PayPalComponent = ({
|
|||
const {responseTypes} = emitResponse;
|
||||
|
||||
const [paypalOrder, setPaypalOrder] = useState(null);
|
||||
const [gotoContinuationOnError, setGotoContinuationOnError] = useState(false);
|
||||
|
||||
const [paypalScriptLoaded, setPaypalScriptLoaded] = useState(false);
|
||||
|
||||
|
@ -165,6 +166,7 @@ const PayPalComponent = ({
|
|||
if (config.finalReviewEnabled) {
|
||||
location.href = getCheckoutRedirectUrl();
|
||||
} else {
|
||||
setGotoContinuationOnError(true);
|
||||
onSubmit();
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -183,7 +185,7 @@ const PayPalComponent = ({
|
|||
if (config.scriptData.continuation) {
|
||||
return true;
|
||||
}
|
||||
if (wp.data.select('wc/store/validation').hasValidationErrors()) {
|
||||
if (gotoContinuationOnError && wp.data.select('wc/store/validation').hasValidationErrors()) {
|
||||
location.href = getCheckoutRedirectUrl();
|
||||
return { type: responseTypes.ERROR };
|
||||
}
|
||||
|
@ -191,7 +193,7 @@ const PayPalComponent = ({
|
|||
return true;
|
||||
});
|
||||
return unsubscribe;
|
||||
}, [onCheckoutValidation] );
|
||||
}, [onCheckoutValidation, gotoContinuationOnError] );
|
||||
|
||||
const handleClick = (data, actions) => {
|
||||
if (isEditing) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue