mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
Check the current method in block
This commit is contained in:
parent
5261484f11
commit
21bba80f49
1 changed files with 6 additions and 1 deletions
|
@ -12,6 +12,7 @@ const PayPalComponent = ({
|
|||
onError,
|
||||
eventRegistration,
|
||||
emitResponse,
|
||||
activePaymentMethod,
|
||||
}) => {
|
||||
const {onPaymentSetup} = eventRegistration;
|
||||
const {responseTypes} = emitResponse;
|
||||
|
@ -110,6 +111,10 @@ const PayPalComponent = ({
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (activePaymentMethod !== config.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
const unsubscribeProcessing = onPaymentSetup(() => {
|
||||
const shippingAddress = paypalOrderToWcShippingAddress(paypalOrder);
|
||||
let billingAddress = paypalPayerToWc(paypalOrder.payer);
|
||||
|
@ -132,7 +137,7 @@ const PayPalComponent = ({
|
|||
return () => {
|
||||
unsubscribeProcessing();
|
||||
};
|
||||
}, [onPaymentSetup, paypalOrder]);
|
||||
}, [onPaymentSetup, paypalOrder, activePaymentMethod]);
|
||||
|
||||
if (!loaded) {
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue