Disable oxxo feature via constant

This commit is contained in:
dinamiko 2022-08-02 12:11:18 +02:00
parent b05112d056
commit d5e2d8585c
2 changed files with 13 additions and 1 deletions

View file

@ -232,6 +232,10 @@ class WCGatewayModule implements ModuleInterface {
add_action(
'init',
function () use ( $c ) {
if ( defined( 'PPCP_FLAG_OXXO' ) && PPCP_FLAG_OXXO === false ) {
return;
}
if ( 'DE' === $c->get( 'api.shop.country' ) && 'EUR' === $c->get( 'api.shop.currency' ) ) {
( $c->get( 'wcgateway.pay-upon-invoice' ) )->init();
}
@ -270,6 +274,10 @@ class WCGatewayModule implements ModuleInterface {
add_action(
'wc_ajax_ppc-oxxo',
static function () use ( $c ) {
if ( defined( 'PPCP_FLAG_OXXO' ) && PPCP_FLAG_OXXO === false ) {
return;
}
$endpoint = $c->get( 'wcgateway.endpoint.oxxo' );
$endpoint->handle_request();
}
@ -306,7 +314,9 @@ class WCGatewayModule implements ModuleInterface {
$methods[] = $container->get( 'wcgateway.pay-upon-invoice-gateway' );
}
$methods[] = $container->get( 'wcgateway.oxxo-gateway' );
if ( defined( 'PPCP_FLAG_OXXO' ) && PPCP_FLAG_OXXO === true ) {
$methods[] = $container->get( 'wcgateway.oxxo-gateway' );
}
return (array) $methods;
}