mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
Merge branch 'trunk' into PCP-3320-separate-google-pay-button-for-classic-checkout
This commit is contained in:
commit
74f319dd82
4 changed files with 14 additions and 5 deletions
|
@ -606,9 +606,11 @@ const PayPalComponent = ( {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( data, actions ) => {
|
return ( data, actions ) => {
|
||||||
shouldHandleShippingInPayPal()
|
let shippingAddressChange = shouldHandleShippingInPayPal()
|
||||||
? handleShippingAddressChange( data, actions )
|
? handleShippingAddressChange( data, actions )
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
return shippingAddressChange;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ use WooCommerce\PayPalCommerce\Button\Endpoint\RequestData;
|
||||||
* Class UpdateShippingEndpoint
|
* Class UpdateShippingEndpoint
|
||||||
*/
|
*/
|
||||||
class UpdateShippingEndpoint implements EndpointInterface {
|
class UpdateShippingEndpoint implements EndpointInterface {
|
||||||
const ENDPOINT = 'ppc-update-shipping';
|
const ENDPOINT = 'ppc-update-shipping';
|
||||||
|
const WC_STORE_API_ENDPOINT = '/wp-json/wc/store/cart/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Request Data Helper.
|
* The Request Data Helper.
|
||||||
|
|
|
@ -141,6 +141,7 @@ class Renderer {
|
||||||
// Check the condition and add the handler if needed
|
// Check the condition and add the handler if needed
|
||||||
if ( this.defaultSettings.should_handle_shipping_in_paypal ) {
|
if ( this.defaultSettings.should_handle_shipping_in_paypal ) {
|
||||||
options.onShippingOptionsChange = ( data, actions ) => {
|
options.onShippingOptionsChange = ( data, actions ) => {
|
||||||
|
let shippingOptionsChange =
|
||||||
! this.isVenmoButtonClickedWhenVaultingIsEnabled(
|
! this.isVenmoButtonClickedWhenVaultingIsEnabled(
|
||||||
venmoButtonClicked
|
venmoButtonClicked
|
||||||
)
|
)
|
||||||
|
@ -150,8 +151,11 @@ class Renderer {
|
||||||
this.defaultSettings
|
this.defaultSettings
|
||||||
)
|
)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
return shippingOptionsChange
|
||||||
};
|
};
|
||||||
options.onShippingAddressChange = ( data, actions ) => {
|
options.onShippingAddressChange = ( data, actions ) => {
|
||||||
|
let shippingAddressChange =
|
||||||
! this.isVenmoButtonClickedWhenVaultingIsEnabled(
|
! this.isVenmoButtonClickedWhenVaultingIsEnabled(
|
||||||
venmoButtonClicked
|
venmoButtonClicked
|
||||||
)
|
)
|
||||||
|
@ -161,6 +165,8 @@ class Renderer {
|
||||||
this.defaultSettings
|
this.defaultSettings
|
||||||
)
|
)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
return shippingAddressChange
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1166,11 +1166,11 @@ document.querySelector("#payment").before(document.querySelector(".ppcp-messages
|
||||||
),
|
),
|
||||||
'update_customer_shipping' => array(
|
'update_customer_shipping' => array(
|
||||||
'shipping_options' => array(
|
'shipping_options' => array(
|
||||||
'endpoint' => '/wp-json/wc/store/cart/select-shipping-rate',
|
'endpoint' => home_url( UpdateShippingEndpoint::WC_STORE_API_ENDPOINT . 'select-shipping-rate' ),
|
||||||
),
|
),
|
||||||
'shipping_address' => array(
|
'shipping_address' => array(
|
||||||
'cart_endpoint' => '/wp-json/wc/store/cart/',
|
'cart_endpoint' => home_url( UpdateShippingEndpoint::WC_STORE_API_ENDPOINT ),
|
||||||
'update_customer_endpoint' => '/wp-json/wc/store/v1/cart/update-customer/',
|
'update_customer_endpoint' => home_url( UpdateShippingEndpoint::WC_STORE_API_ENDPOINT . 'update-customer' ),
|
||||||
),
|
),
|
||||||
'wp_rest_nonce' => wp_create_nonce( 'wc_store_api' ),
|
'wp_rest_nonce' => wp_create_nonce( 'wc_store_api' ),
|
||||||
'update_shipping_method' => \WC_AJAX::get_endpoint( 'update_shipping_method' ),
|
'update_shipping_method' => \WC_AJAX::get_endpoint( 'update_shipping_method' ),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue