mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Do not show subscription behavior setting if subscriptions plugin is not active
This commit is contained in:
parent
b1a49a9af1
commit
ae11b15164
8 changed files with 54 additions and 11 deletions
|
@ -69,5 +69,9 @@
|
|||
togglePayLater()
|
||||
|
||||
vaultingCheckboxes.forEach(node => node.addEventListener('change', togglePayLater));
|
||||
|
||||
if(PayPalCommerceGatewaySettings.is_subscriptions_plugin_active !== '1') {
|
||||
document.getElementById('field-subscription_behavior_when_vault_fails').style.display = 'none';
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -869,7 +869,7 @@ return array(
|
|||
'default' => 'void_auth',
|
||||
'desc_tip' => true,
|
||||
'description' => __( 'By default, subscription payments are captured only when saving the payment method was successful. Without a saved payment method, automatic renewal payments are not possible.', 'woocommerce-paypal-payments' ),
|
||||
'description_with_tip' => __( 'Determines the capture behavior for subscriptions if saving the payment method failed. This setting only applies when the intent capture is configured.', 'woocommerce-paypal-payments' ),
|
||||
'description_with_tip' => __( 'Determines whether authorized payments for subscription orders are captured or voided if there is no saved payment method. This only applies when the intent Capture is used for the subscription order.', 'woocommerce-paypal-payments' ),
|
||||
'options' => array(
|
||||
'void_auth' => __( 'Void authorization & fail the order/subscription', 'woocommerce-paypal-payments' ),
|
||||
'capture_auth' => __( 'Capture authorized payment & set subscription to Manual Renewal', 'woocommerce-paypal-payments' ),
|
||||
|
@ -2368,7 +2368,11 @@ return array(
|
|||
},
|
||||
|
||||
'button.helper.vaulting-label' => static function ( ContainerInterface $container ): string {
|
||||
$vaulting_label = __( 'Enable saved cards and subscription features on your store.', 'woocommerce-paypal-payments' );
|
||||
$vaulting_label = sprintf(
|
||||
__( 'Enable saved cards, PayPal accounts, and subscription features on your store. Payment methods are saved in the secure %1$sPayPal Vault%2$s.', 'woocommerce-paypal-payments' ),
|
||||
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#vaulting-saving-a-payment-method" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
|
||||
if ( ! $container->get( 'wcgateway.helper.vaulting-scope' ) ) {
|
||||
$vaulting_label .= sprintf(
|
||||
|
@ -2383,7 +2387,20 @@ return array(
|
|||
}
|
||||
|
||||
$vaulting_label .= '<p class="description">';
|
||||
$vaulting_label .= __( 'This will disable all Pay Later messaging on your site.', 'woocommerce-paypal-payments' );
|
||||
$vaulting_label .= sprintf(
|
||||
// translators: %1$s, %2$s, %3$s and %4$s are the opening and closing of HTML <a> tag.
|
||||
__( 'This will disable all %1$sPay Later%2$s features and %3$sAlternative Payment Methods%4$s on your site.', 'woocommerce-paypal-payments' ),
|
||||
'<a
|
||||
href="https://woocommerce.com/document/woocommerce-paypal-payments/#pay-later"
|
||||
target="_blank"
|
||||
>',
|
||||
'</a>',
|
||||
'<a
|
||||
href="https://woocommerce.com/document/woocommerce-paypal-payments/#alternative-payment-methods"
|
||||
target="_blank"
|
||||
>',
|
||||
'</a>'
|
||||
);
|
||||
$vaulting_label .= '</p>';
|
||||
|
||||
return $vaulting_label;
|
||||
|
|
|
@ -9,7 +9,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Assets;
|
||||
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
|
||||
|
||||
/**
|
||||
* Class SettingsPageAssets
|
||||
|
@ -30,15 +30,24 @@ class SettingsPageAssets {
|
|||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* The subscription helper.
|
||||
*
|
||||
* @var SubscriptionHelper
|
||||
*/
|
||||
protected $subscription_helper;
|
||||
|
||||
/**
|
||||
* Assets constructor.
|
||||
*
|
||||
* @param string $module_url The url of this module.
|
||||
* @param string $version The assets version.
|
||||
* @param string $module_url The url of this module.
|
||||
* @param string $version The assets version.
|
||||
* @param SubscriptionHelper $subscription_helper The subscription helper.
|
||||
*/
|
||||
public function __construct( string $module_url, string $version ) {
|
||||
$this->module_url = $module_url;
|
||||
$this->version = $version;
|
||||
public function __construct( string $module_url, string $version, SubscriptionHelper $subscription_helper ) {
|
||||
$this->module_url = $module_url;
|
||||
$this->version = $version;
|
||||
$this->subscription_helper = $subscription_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,5 +105,14 @@ class SettingsPageAssets {
|
|||
$this->version,
|
||||
true
|
||||
);
|
||||
|
||||
// Intent is configured with Authorize and Capture Virtual-Only Orders is not set.
|
||||
wp_localize_script(
|
||||
'ppcp-gateway-settings',
|
||||
'PayPalCommerceGatewaySettings',
|
||||
array(
|
||||
'is_subscriptions_plugin_active' => $this->subscription_helper->plugin_is_active(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,7 +148,8 @@ class WCGatewayModule implements ModuleInterface {
|
|||
if ( $c->has( 'wcgateway.url' ) ) {
|
||||
$assets = new SettingsPageAssets(
|
||||
$c->get( 'wcgateway.url' ),
|
||||
$c->get( 'ppcp.asset-version' )
|
||||
$c->get( 'ppcp.asset-version' ),
|
||||
$c->get( 'subscription.helper' )
|
||||
);
|
||||
$assets->register_assets();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue