♻️ Switch gateways to use new configuration class

This commit is contained in:
Philipp Stracker 2024-09-18 15:35:46 +02:00
parent 8712e37587
commit 0adc8ae4ba
No known key found for this signature in database
6 changed files with 41 additions and 6 deletions

View file

@ -35,6 +35,7 @@ return array(
$container->get( 'axo.gateway' ),
fn() : SmartButtonInterface => $container->get( 'button.smart-button' ),
$container->get( 'wcgateway.settings' ),
$container->get( 'wcgateway.configuration.dcc' ),
$container->get( 'onboarding.environment' ),
$container->get( 'wcgateway.url' )
);

View file

@ -16,6 +16,7 @@ use WooCommerce\PayPalCommerce\Button\Assets\SmartButtonInterface;
use WooCommerce\PayPalCommerce\Onboarding\Environment;
use WooCommerce\PayPalCommerce\Axo\Gateway\AxoGateway;
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
/**
* Class AxoBlockPaymentMethod
@ -57,6 +58,13 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType {
*/
protected $settings;
/**
* The DCC gateway settings.
*
* @var DCCGatewayConfiguration
*/
protected DCCGatewayConfiguration $dcc_configuration;
/**
* The environment object.
*
@ -80,6 +88,7 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType {
* @param SmartButtonInterface|callable $smart_button The smart button script loading
* handler.
* @param Settings $settings The settings.
* @param DCCGatewayConfiguration $dcc_configuration The DCC gateway settings.
* @param Environment $environment The environment object.
* @param string $wcgateway_module_url The WcGateway module URL.
*/
@ -89,6 +98,7 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType {
WC_Payment_Gateway $gateway,
$smart_button,
Settings $settings,
DCCGatewayConfiguration $dcc_configuration,
Environment $environment,
string $wcgateway_module_url
) {
@ -98,6 +108,7 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType {
$this->gateway = $gateway;
$this->smart_button = $smart_button;
$this->settings = $settings;
$this->dcc_configuration = $dcc_configuration;
$this->environment = $environment;
$this->wcgateway_module_url = $wcgateway_module_url;
@ -215,7 +226,7 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType {
'focusBorderColor' => $this->settings->has( 'axo_style_input_focus_border_color' ) ? $this->settings->get( 'axo_style_input_focus_border_color' ) : '',
),
),
'name_on_card' => $this->settings->has( 'axo_name_on_card' ) ? $this->settings->get( 'axo_name_on_card' ) : '',
'name_on_card' => $this->dcc_configuration->show_name_on_card(),
'woocommerce' => array(
'states' => array(
'US' => WC()->countries->get_states( 'US' ),