mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge branch 'trunk' into PCP-1970-unify-conditional-display-logic-for-plugin-settings
# Conflicts: # modules/ppcp-wc-gateway/resources/js/SettingsHandler/SubElementsHandler.js
This commit is contained in:
commit
a9766c01e1
6 changed files with 39 additions and 5 deletions
|
@ -180,10 +180,7 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
|
|||
'products',
|
||||
);
|
||||
|
||||
if (
|
||||
( $this->config->has( 'vault_enabled_dcc' ) && $this->config->get( 'vault_enabled_dcc' ) )
|
||||
|| ( $this->config->has( 'subscriptions_mode' ) && $this->config->get( 'subscriptions_mode' ) === 'subscriptions_api' )
|
||||
) {
|
||||
if ( $this->config->has( 'vault_enabled_dcc' ) && $this->config->get( 'vault_enabled_dcc' ) ) {
|
||||
array_push(
|
||||
$this->supports,
|
||||
'subscriptions',
|
||||
|
|
|
@ -543,6 +543,7 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
|||
}
|
||||
|
||||
$wc_order->payment_complete();
|
||||
|
||||
return $this->handle_payment_success( $wc_order );
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ trait ProcessPaymentTrait {
|
|||
}
|
||||
|
||||
$this->session_handler->destroy_session_data();
|
||||
WC()->session->set( 'ppcp_subscription_id', '' );
|
||||
|
||||
wc_add_notice( $error->getMessage(), 'error' );
|
||||
|
||||
|
@ -100,6 +101,7 @@ trait ProcessPaymentTrait {
|
|||
}
|
||||
|
||||
$this->session_handler->destroy_session_data();
|
||||
WC()->session->set( 'ppcp_subscription_id', '' );
|
||||
|
||||
return array(
|
||||
'result' => 'success',
|
||||
|
|
|
@ -340,7 +340,20 @@ class SettingsListener {
|
|||
* phpcs:disable WordPress.Security.NonceVerification.Missing
|
||||
* phpcs:disable WordPress.Security.NonceVerification.Recommended
|
||||
*/
|
||||
if ( ! isset( $_POST['ppcp']['vault_enabled'] ) ) {
|
||||
$vault_enabled = wc_clean( wp_unslash( $_POST['ppcp']['vault_enabled'] ?? '' ) );
|
||||
$subscription_mode = wc_clean( wp_unslash( $_POST['ppcp']['subscriptions_mode'] ?? '' ) );
|
||||
|
||||
if ( $subscription_mode === 'vaulting_api' && $vault_enabled !== '1' ) {
|
||||
$this->settings->set( 'vault_enabled', true );
|
||||
$this->settings->persist();
|
||||
}
|
||||
|
||||
if ( $subscription_mode === 'disable_paypal_subscriptions' && $vault_enabled === '1' ) {
|
||||
$this->settings->set( 'vault_enabled', false );
|
||||
$this->settings->persist();
|
||||
}
|
||||
|
||||
if ( $vault_enabled !== '1' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue