mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Ensure vault enabled false on plugin upgrade if reference transactions is disabled
This commit is contained in:
parent
02506e976a
commit
c008e0eaa5
1 changed files with 7 additions and 5 deletions
|
@ -62,11 +62,13 @@ class SavePaymentMethodsModule implements ModuleInterface {
|
|||
$billing_agreements_endpoint = $c->get( 'api.endpoint.billing-agreements' );
|
||||
assert( $billing_agreements_endpoint instanceof BillingAgreementsEndpoint );
|
||||
|
||||
$reference_transaction_enabled = $billing_agreements_endpoint->reference_transaction_enabled();
|
||||
if ( $reference_transaction_enabled !== true ) {
|
||||
$settings->set( 'vault_enabled', false );
|
||||
$settings->persist();
|
||||
}
|
||||
add_action( 'woocommerce_paypal_payments_gateway_migrate_on_update', function() use($settings, $billing_agreements_endpoint) {
|
||||
$reference_transaction_enabled = $billing_agreements_endpoint->reference_transaction_enabled();
|
||||
if ( $reference_transaction_enabled !== true ) {
|
||||
$settings->set( 'vault_enabled', false );
|
||||
$settings->persist();
|
||||
}
|
||||
});
|
||||
|
||||
if (
|
||||
( ! $settings->has( 'vault_enabled' ) || ! $settings->get( 'vault_enabled' ) )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue