This commit is contained in:
David Remer 2020-07-10 12:34:29 +03:00
parent cdfb405fe4
commit 563488e727
3 changed files with 8 additions and 7 deletions

View file

@ -49,7 +49,7 @@ class OnboardingAssets
'error' => __( 'error' => __(
'We could not properly onboard you. Please reload and try again.', 'We could not properly onboard you. Please reload and try again.',
'woocommerce-paypal-commerce-gateway' 'woocommerce-paypal-commerce-gateway'
) ),
] ]
); );

View file

@ -72,7 +72,9 @@ class WcGateway extends \WC_Payment_Gateway
); );
} }
public function needs_setup() { public function needs_setup()
{
return true; return true;
} }

View file

@ -58,14 +58,14 @@ class WcGatewayModule implements ModuleInterface
add_action( add_action(
'wp_ajax_woocommerce_toggle_gateway_enabled', 'wp_ajax_woocommerce_toggle_gateway_enabled',
function() use ($container) { static function () use ($container) {
if ( if (
! current_user_can( 'manage_woocommerce' ) ! current_user_can('manage_woocommerce')
|| ! check_ajax_referer( || ! check_ajax_referer(
'woocommerce-toggle-payment-gateway-enabled', 'woocommerce-toggle-payment-gateway-enabled',
'security' 'security'
) )
|| ! isset( $_POST['gateway_id'] ) || ! isset($_POST['gateway_id'])
) { ) {
return; return;
} }
@ -85,11 +85,10 @@ class WcGatewayModule implements ModuleInterface
); );
add_action( add_action(
'woocommerce-paypal-commerce-gateway.deactivate', 'woocommerce-paypal-commerce-gateway.deactivate',
function() use ($container) { static function () use ($container) {
delete_option(Settings::KEY); delete_option(Settings::KEY);
} }
); );
} }
private function registerPaymentGateWay(ContainerInterface $container) private function registerPaymentGateWay(ContainerInterface $container)