This commit is contained in:
David Remer 2020-07-02 14:42:08 +03:00
parent af99ab0647
commit f0b6e362b7
2 changed files with 9 additions and 5 deletions

View file

@ -17,13 +17,17 @@ class DisableGateways
SessionHandler $sessionHandler,
ContainerInterface $settings
) {
$this->sessionHandler = $sessionHandler;
$this->settings = $settings;
}
public function handler(array $methods): array
{
if (! $this->settings->has('merchant_email') || ! is_email($this->settings->get('merchant_email'))) {
if (
! $this->settings->has('merchant_email')
|| ! is_email($this->settings->get('merchant_email'))
) {
unset($methods[WcGateway::ID]);
return $methods;
}
@ -31,8 +35,6 @@ class DisableGateways
return $methods;
}
return [WcGateway::ID => $methods[WcGateway::ID]];
}

View file

@ -55,8 +55,10 @@ class WcGateway extends \WC_Payment_Gateway
'Provide your customers with the PayPal payment system',
'woocommerce-paypal-gateway'
);
$this->title = $this->config->has('title') ? $this->config->get('title') : $this->method_title;
$this->description = $this->config->has('description') ? $this->config->get('description') : $this->method_description;
$this->title = $this->config->has('title') ?
$this->config->get('title') : $this->method_title;
$this->description = $this->config->has('description') ?
$this->config->get('description') : $this->method_description;
$this->init_form_fields();
$this->init_settings();