Implement AXO settings

This commit is contained in:
Pedro Silva 2024-02-13 14:37:50 +00:00
parent 91b2df246f
commit e71c34913f
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
3 changed files with 30 additions and 3 deletions

View file

@ -36,8 +36,12 @@ class AxoModule implements ModuleInterface {
add_filter(
'woocommerce_payment_gateways',
function ( $methods ): array {
$methods[] = new AxoGateway();
function ( $methods ) use ( $c ): array {
$settings = $c->get( 'wcgateway.settings' );
$methods[] = new AxoGateway(
$settings
);
return $methods;
},
1,

View file

@ -10,6 +10,7 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\Axo\Gateway;
use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
/**
* Class AXOGateway.
@ -18,11 +19,23 @@ class AxoGateway extends WC_Payment_Gateway {
const ID = 'ppcp-axo-gateway';
/**
* The settings.
*
* @var ContainerInterface
*/
protected $config;
/**
* AXOGateway constructor.
*
* @param ContainerInterface $config The settings.
*/
public function __construct(
ContainerInterface $config
) {
$this->config = $config;
$this->id = self::ID;
$this->method_title = __( 'Fastlane Debit & Credit Cards', 'woocommerce-paypal-payments' );
@ -51,7 +64,8 @@ class AxoGateway extends WC_Payment_Gateway {
// $this->icon = esc_url( $this->module_url ) . 'assets/images/axo.svg'; // TODO
// $this->environment = $environment;
$this->update_option( 'enabled', 'yes' ); // TODO : depend on settings
$is_axo_enabled = $this->config->has( 'axo_enabled' ) && $this->config->get( 'axo_enabled' );
$this->update_option( 'enabled', $is_axo_enabled ? 'yes' : 'no' );
}
/**

View file

@ -39,3 +39,12 @@
font-weight: bold;
}
}
.ppcp-field-indent {
background-color: #f9f9f9;
border: 1px solid #c3c4c7;
& + .ppcp-field-indent {
border-top: 2px solid transparent;
}
}