From 0d02c1f4210af2f40fe580bd0b31806c61adcca9 Mon Sep 17 00:00:00 2001 From: David Remer Date: Tue, 18 Aug 2020 11:48:38 +0300 Subject: [PATCH] disable dcc gateway dependingon onboarding --- .../ppcp-wc-gateway/src/Checkout/DisableGateways.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules.local/ppcp-wc-gateway/src/Checkout/DisableGateways.php b/modules.local/ppcp-wc-gateway/src/Checkout/DisableGateways.php index cc6aa58be..427f7fd89 100644 --- a/modules.local/ppcp-wc-gateway/src/Checkout/DisableGateways.php +++ b/modules.local/ppcp-wc-gateway/src/Checkout/DisableGateways.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Inpsyde\PayPalCommerce\WcGateway\Checkout; use Inpsyde\PayPalCommerce\Session\SessionHandler; +use Inpsyde\PayPalCommerce\WcGateway\Gateway\CreditCardGateway; use Inpsyde\PayPalCommerce\WcGateway\Gateway\PayPalGateway; use Psr\Container\ContainerInterface; @@ -32,9 +33,15 @@ class DisableGateways || ! is_email($this->settings->get('merchant_email')) ) { unset($methods[PayPalGateway::ID]); + unset($methods[CreditCardGateway::ID]); return $methods; } + if (! $this->settings->has('client_id') || empty($this->settings->get('client_id'))) { + unset($methods[CreditCardGateway::ID]); + } + + if (! $this->needsToDisableGateways()) { return $methods; }