mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add client-side vaulting for subscription renewals
This commit is contained in:
parent
e7f592efe3
commit
ed3a91f333
6 changed files with 53 additions and 21 deletions
|
@ -654,7 +654,7 @@ return array(
|
|||
'desc_tip' => true,
|
||||
'label' => __( 'Enable Vaulting for PayPal Accounts', 'woocommerce-paypal-payments' ),
|
||||
'description' => __( '', 'woocommerce-paypal-payments' ),
|
||||
'default' => true,
|
||||
'default' => false,
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
|
@ -667,7 +667,7 @@ return array(
|
|||
'desc_tip' => true,
|
||||
'label' => __( 'Allow Registered Buyers to Save PayPal Account', 'woocommerce-paypal-payments' ),
|
||||
'description' => __( 'Buyers that create an account on your store may save their PayPal account for faster checkout. Note that you may not present Pay Later messages when using this feature.', 'woocommerce-paypal-payments' ),
|
||||
'default' => true,
|
||||
'default' => false,
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
|
|
|
@ -81,8 +81,7 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
|
|||
if (
|
||||
defined( 'PPCP_FLAG_SUBSCRIPTION' )
|
||||
&& PPCP_FLAG_SUBSCRIPTION
|
||||
&& $this->config->has( 'vault_enabled' )
|
||||
&& $this->config->get( 'vault_enabled' )
|
||||
&& $this->vault_settings_enabled()
|
||||
) {
|
||||
$this->supports = array(
|
||||
'refunds',
|
||||
|
|
|
@ -119,8 +119,7 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
|||
if (
|
||||
defined( 'PPCP_FLAG_SUBSCRIPTION' )
|
||||
&& PPCP_FLAG_SUBSCRIPTION
|
||||
&& $this->config->has( 'vault_enabled' )
|
||||
&& $this->config->get( 'vault_enabled' )
|
||||
&& $this->vault_settings_enabled()
|
||||
) {
|
||||
$this->supports = array(
|
||||
'refunds',
|
||||
|
|
|
@ -85,4 +85,17 @@ trait ProcessPaymentTrait {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException
|
||||
*/
|
||||
protected function vault_settings_enabled(): bool {
|
||||
if ( ! $this->config->has( 'vault_enabled' ) && ! $this->config->has( 'dcc_vault_enabled' )
|
||||
|| ! $this->config->get( 'dcc_vault_enabled' ) && ! $this->config->get( 'dcc_vault_enabled' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue