Merge branch 'trunk' into PCP-3742-disable-gpay-sub

This commit is contained in:
Alex P. 2024-10-22 16:59:16 +03:00
commit ad07c05cb7
No known key found for this signature in database
GPG key ID: 54487A734A204D71
37 changed files with 11765 additions and 301 deletions

View file

@ -233,6 +233,15 @@ class SingleProductBootstap {
this.form(),
this.errorHandler
);
if (
! this.gateway.vaultingEnabled &&
[ 'subscription', 'variable-subscription' ].includes(
this.gateway.productType
) &&
this.gateway.manualRenewalEnabled !== '1'
) {
return;
}
if (
PayPalCommerceGateway.data_client_id.has_subscriptions &&

View file

@ -1321,8 +1321,26 @@ document.querySelector("#payment").before(document.querySelector(".ppcp-messages
'should_handle_shipping_in_paypal' => $this->should_handle_shipping_in_paypal && ! $this->is_checkout(),
'needShipping' => $this->need_shipping(),
'vaultingEnabled' => $this->settings->has( 'vault_enabled' ) && $this->settings->get( 'vault_enabled' ),
'productType' => null,
'manualRenewalEnabled' => false,
);
if ( is_product() ) {
$product = wc_get_product( get_the_ID() );
if ( is_a( $product, \WC_Product::class ) ) {
$localize['productType'] = $product->get_type();
}
}
if ( class_exists( '\WCS_Manual_Renewal_Manager' ) ) {
/**
* We verify the existence of the class prior to invoking a static method.
*
* @psalm-suppress UndefinedClass
*/
$localize['manualRenewalEnabled'] = \WCS_Manual_Renewal_Manager::is_manual_renewal_enabled();
}
if ( 'pay-now' === $this->context() ) {
$localize['pay_now'] = $this->pay_now_script_data();
}