Display payment gateways for guest users when subscription in the cart

This commit is contained in:
dinamiko 2021-12-22 12:46:48 +01:00
parent 3c074eb529
commit de48bcbb9e
2 changed files with 2 additions and 18 deletions

View file

@ -120,8 +120,7 @@ return array(
'wcgateway.disabler' => static function ( ContainerInterface $container ): DisableGateways {
$session_handler = $container->get( 'session.handler' );
$settings = $container->get( 'wcgateway.settings' );
$subscription_helper = $container->get( 'subscription.helper' );
return new DisableGateways( $session_handler, $settings, $subscription_helper );
return new DisableGateways( $session_handler, $settings);
},
'wcgateway.is-wc-payments-page' => static function ( ContainerInterface $container ): bool {
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';

View file

@ -10,7 +10,6 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\WcGateway\Checkout;
use WooCommerce\PayPalCommerce\Session\SessionHandler;
use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use Psr\Container\ContainerInterface;
@ -34,29 +33,19 @@ class DisableGateways {
*/
private $settings;
/**
* The subscription helper
*
* @var SubscriptionHelper
*/
private $subscription_helper;
/**
* DisableGateways constructor.
*
* @param SessionHandler $session_handler The Session Handler.
* @param ContainerInterface $settings The Settings.
* @param SubscriptionHelper $subscription_helper The subscription helper.
*/
public function __construct(
SessionHandler $session_handler,
ContainerInterface $settings,
SubscriptionHelper $subscription_helper
ContainerInterface $settings
) {
$this->session_handler = $session_handler;
$this->settings = $settings;
$this->subscription_helper = $subscription_helper;
}
/**
@ -110,10 +99,6 @@ class DisableGateways {
return true;
}
if ( $this->subscription_helper->cart_contains_subscription() && ! is_user_logged_in() ) {
return true;
}
return false;
}