mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Merge pull request #1786 from woocommerce/PCP-2139-release-2-4-0-rc-1-place-order-button-remains-could-not-retrieve-order
release 2.4.0_rc1 Place order button remains - Could not retrieve order (2139)
This commit is contained in:
commit
9d43e736c5
7 changed files with 63 additions and 19 deletions
|
@ -20,7 +20,6 @@ import ApplepayManager from "./ApplepayManager";
|
|||
(typeof (buttonConfig) === 'undefined') ||
|
||||
(typeof (ppcpConfig) === 'undefined')
|
||||
) {
|
||||
console.error('PayPal button could not be configured.');
|
||||
return;
|
||||
}
|
||||
const isMiniCart = ppcpConfig.mini_cart_buttons_enabled;
|
||||
|
|
|
@ -129,10 +129,18 @@ class ApplepayModule implements ModuleInterface {
|
|||
function () use ( $c, $button ) {
|
||||
$smart_button = $c->get( 'button.smart-button' );
|
||||
assert( $smart_button instanceof SmartButtonInterface );
|
||||
$page_has_block = has_block( 'woocommerce/checkout' ) || has_block( 'woocommerce/cart' );
|
||||
if ( $smart_button->should_load_ppcp_script() || $page_has_block ) {
|
||||
if ( $smart_button->should_load_ppcp_script() ) {
|
||||
$button->enqueue();
|
||||
}
|
||||
|
||||
if ( has_block( 'woocommerce/checkout' ) || has_block( 'woocommerce/cart' ) ) {
|
||||
/**
|
||||
* Should add this to the ButtonInterface.
|
||||
*
|
||||
* @psalm-suppress UndefinedInterfaceMethod
|
||||
*/
|
||||
$button->enqueue_styles();
|
||||
}
|
||||
}
|
||||
);
|
||||
add_action(
|
||||
|
|
|
@ -1021,13 +1021,7 @@ class ApplePayButton implements ButtonInterface {
|
|||
);
|
||||
wp_enqueue_script( 'wc-ppcp-applepay' );
|
||||
|
||||
wp_register_style(
|
||||
'wc-ppcp-applepay',
|
||||
untrailingslashit( $this->module_url ) . '/assets/css/styles.css',
|
||||
array(),
|
||||
$this->version
|
||||
);
|
||||
wp_enqueue_style( 'wc-ppcp-applepay' );
|
||||
$this->enqueue_styles();
|
||||
|
||||
wp_localize_script(
|
||||
'wc-ppcp-applepay',
|
||||
|
@ -1042,6 +1036,23 @@ class ApplePayButton implements ButtonInterface {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues styles.
|
||||
*/
|
||||
public function enqueue_styles(): void {
|
||||
if ( ! $this->is_enabled() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_register_style(
|
||||
'wc-ppcp-applepay',
|
||||
untrailingslashit( $this->module_url ) . '/assets/css/styles.css',
|
||||
array(),
|
||||
$this->version
|
||||
);
|
||||
wp_enqueue_style( 'wc-ppcp-applepay' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the script data.
|
||||
*
|
||||
|
|
|
@ -189,7 +189,6 @@ class GooglepayButton {
|
|||
callback(el);
|
||||
} else if (timeElapsed > timeout) {
|
||||
clearInterval(interval);
|
||||
console.error('Waiting for wrapper timed out.', selector);
|
||||
}
|
||||
}, delay);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,9 @@ import GooglepayManager from "./GooglepayManager";
|
|||
};
|
||||
|
||||
jQuery(document.body).on('updated_cart_totals updated_checkout', () => {
|
||||
manager.reinit();
|
||||
if (manager) {
|
||||
manager.reinit();
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener(
|
||||
|
|
|
@ -363,6 +363,23 @@ class Button implements ButtonInterface {
|
|||
);
|
||||
wp_enqueue_script( 'wc-ppcp-googlepay' );
|
||||
|
||||
$this->enqueue_styles();
|
||||
|
||||
wp_localize_script(
|
||||
'wc-ppcp-googlepay',
|
||||
'wc_ppcp_googlepay',
|
||||
$this->script_data()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues styles.
|
||||
*/
|
||||
public function enqueue_styles(): void {
|
||||
if ( ! $this->is_enabled() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_register_style(
|
||||
'wc-ppcp-googlepay',
|
||||
untrailingslashit( $this->module_url ) . '/assets/css/styles.css',
|
||||
|
@ -370,12 +387,6 @@ class Button implements ButtonInterface {
|
|||
$this->version
|
||||
);
|
||||
wp_enqueue_style( 'wc-ppcp-googlepay' );
|
||||
|
||||
wp_localize_script(
|
||||
'wc-ppcp-googlepay',
|
||||
'wc_ppcp_googlepay',
|
||||
$this->script_data()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace WooCommerce\PayPalCommerce\Googlepay;
|
|||
|
||||
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry;
|
||||
use WooCommerce\PayPalCommerce\Button\Assets\ButtonInterface;
|
||||
use WooCommerce\PayPalCommerce\Button\Assets\SmartButtonInterface;
|
||||
use WooCommerce\PayPalCommerce\Googlepay\Endpoint\UpdatePaymentDataEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Googlepay\Helper\ApmProductStatus;
|
||||
use WooCommerce\PayPalCommerce\Googlepay\Helper\AvailabilityNotice;
|
||||
|
@ -85,7 +86,20 @@ class GooglepayModule implements ModuleInterface {
|
|||
add_action(
|
||||
'wp_enqueue_scripts',
|
||||
static function () use ( $c, $button ) {
|
||||
$button->enqueue();
|
||||
$smart_button = $c->get( 'button.smart-button' );
|
||||
assert( $smart_button instanceof SmartButtonInterface );
|
||||
if ( $smart_button->should_load_ppcp_script() ) {
|
||||
$button->enqueue();
|
||||
}
|
||||
|
||||
if ( has_block( 'woocommerce/checkout' ) || has_block( 'woocommerce/cart' ) ) {
|
||||
/**
|
||||
* Should add this to the ButtonInterface.
|
||||
*
|
||||
* @psalm-suppress UndefinedInterfaceMethod
|
||||
*/
|
||||
$button->enqueue_styles();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue