mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Ensure shipping callback is removed from venmo button
This commit is contained in:
parent
167c2c6883
commit
a08ce87839
1 changed files with 28 additions and 20 deletions
|
@ -505,6 +505,30 @@ const PayPalComponent = ({
|
||||||
|
|
||||||
const PayPalButton = paypal.Buttons.driver("react", { React, ReactDOM });
|
const PayPalButton = paypal.Buttons.driver("react", { React, ReactDOM });
|
||||||
|
|
||||||
|
const getOnShippingOptionsChange = (fundingSource) => {
|
||||||
|
if(fundingSource === 'venmo') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (data, actions) => {
|
||||||
|
shouldHandleShippingInPayPal()
|
||||||
|
? handleShippingOptionsChange(data, actions)
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const getOnShippingAddressChange = (fundingSource) => {
|
||||||
|
if(fundingSource === 'venmo') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (data, actions) => {
|
||||||
|
shouldHandleShippingInPayPal()
|
||||||
|
? handleShippingAddressChange(data, actions)
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if(isPayPalSubscription(config.scriptData)) {
|
if(isPayPalSubscription(config.scriptData)) {
|
||||||
return (
|
return (
|
||||||
<PayPalButton
|
<PayPalButton
|
||||||
|
@ -515,16 +539,8 @@ const PayPalComponent = ({
|
||||||
onError={onClose}
|
onError={onClose}
|
||||||
createSubscription={createSubscription}
|
createSubscription={createSubscription}
|
||||||
onApprove={handleApproveSubscription}
|
onApprove={handleApproveSubscription}
|
||||||
onShippingOptionsChange={(data, actions) => {
|
onShippingOptionsChange={getOnShippingOptionsChange(fundingSource)}
|
||||||
shouldHandleShippingInPayPal()
|
onShippingAddressChange={getOnShippingAddressChange(fundingSource)}
|
||||||
? handleSubscriptionShippingOptionsChange(data, actions)
|
|
||||||
: null;
|
|
||||||
}}
|
|
||||||
onShippingAddressChange={(data, actions) => {
|
|
||||||
shouldHandleShippingInPayPal()
|
|
||||||
? handleSubscriptionShippingAddressChange(data, actions)
|
|
||||||
: null;
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -538,16 +554,8 @@ const PayPalComponent = ({
|
||||||
onError={onClose}
|
onError={onClose}
|
||||||
createOrder={createOrder}
|
createOrder={createOrder}
|
||||||
onApprove={handleApprove}
|
onApprove={handleApprove}
|
||||||
onShippingOptionsChange={(data, actions) => {
|
onShippingOptionsChange={getOnShippingOptionsChange(fundingSource)}
|
||||||
shouldHandleShippingInPayPal()
|
onShippingAddressChange={getOnShippingAddressChange(fundingSource)}
|
||||||
? handleShippingOptionsChange(data, actions)
|
|
||||||
: null;
|
|
||||||
}}
|
|
||||||
onShippingAddressChange={(data, actions) => {
|
|
||||||
shouldHandleShippingInPayPal()
|
|
||||||
? handleShippingAddressChange(data, actions)
|
|
||||||
: null;
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue