disable dcc gateway dependingon onboarding

This commit is contained in:
David Remer 2020-08-18 11:48:38 +03:00
parent a0c419187a
commit 0d02c1f421

View file

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\WcGateway\Checkout; namespace Inpsyde\PayPalCommerce\WcGateway\Checkout;
use Inpsyde\PayPalCommerce\Session\SessionHandler; use Inpsyde\PayPalCommerce\Session\SessionHandler;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\PayPalGateway; use Inpsyde\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
@ -32,9 +33,15 @@ class DisableGateways
|| ! is_email($this->settings->get('merchant_email')) || ! is_email($this->settings->get('merchant_email'))
) { ) {
unset($methods[PayPalGateway::ID]); unset($methods[PayPalGateway::ID]);
unset($methods[CreditCardGateway::ID]);
return $methods; return $methods;
} }
if (! $this->settings->has('client_id') || empty($this->settings->get('client_id'))) {
unset($methods[CreditCardGateway::ID]);
}
if (! $this->needsToDisableGateways()) { if (! $this->needsToDisableGateways()) {
return $methods; return $methods;
} }