mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
🚚 Rename configuration class
The class name does not reflect the purpose of the class
This commit is contained in:
parent
29f56a7db8
commit
afb7044b03
17 changed files with 123 additions and 129 deletions
|
@ -14,15 +14,11 @@ use Psr\Log\LoggerInterface;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\SdkClientToken;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
use WooCommerce\PayPalCommerce\Blocks\Endpoint\UpdateShippingEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Button\Assets\SmartButtonInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExtendingModule;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ModuleClassNameIdTrait;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ServiceModule;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
|
||||
/**
|
||||
* Class AxoBlockModule
|
||||
|
|
|
@ -16,7 +16,7 @@ use WooCommerce\PayPalCommerce\Button\Assets\SmartButtonInterface;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Helper\Environment;
|
||||
use WooCommerce\PayPalCommerce\Axo\Gateway\AxoGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
|
||||
/**
|
||||
* Class AxoBlockPaymentMethod
|
||||
|
@ -61,9 +61,9 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType {
|
|||
/**
|
||||
* The DCC gateway settings.
|
||||
*
|
||||
* @var DCCGatewayConfiguration
|
||||
* @var CardPaymentsConfiguration
|
||||
*/
|
||||
protected DCCGatewayConfiguration $dcc_configuration;
|
||||
protected CardPaymentsConfiguration $dcc_configuration;
|
||||
|
||||
/**
|
||||
* The environment object.
|
||||
|
@ -101,7 +101,7 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType {
|
|||
* @param WC_Payment_Gateway $gateway Credit card gateway.
|
||||
* @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 CardPaymentsConfiguration $dcc_configuration The DCC gateway settings.
|
||||
* @param Environment $environment The environment object.
|
||||
* @param string $wcgateway_module_url The WcGateway module URL.
|
||||
* @param array $payment_method_selected_map Mapping of payment methods to the PayPal Insights 'payment_method_selected' types.
|
||||
|
@ -113,7 +113,7 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType {
|
|||
WC_Payment_Gateway $gateway,
|
||||
$smart_button,
|
||||
Settings $settings,
|
||||
DCCGatewayConfiguration $dcc_configuration,
|
||||
CardPaymentsConfiguration $dcc_configuration,
|
||||
Environment $environment,
|
||||
string $wcgateway_module_url,
|
||||
array $payment_method_selected_map,
|
||||
|
|
|
@ -17,7 +17,7 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\CurrencyGetter;
|
||||
|
||||
return array(
|
||||
|
@ -229,7 +229,7 @@ return array(
|
|||
|
||||
'axo.smart-button-location-notice' => static function ( ContainerInterface $container ) : string {
|
||||
$dcc_configuration = $container->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_configuration instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_configuration instanceof CardPaymentsConfiguration );
|
||||
|
||||
if ( $dcc_configuration->use_fastlane() ) {
|
||||
$fastlane_settings_url = admin_url(
|
||||
|
|
|
@ -30,7 +30,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Helper\CartCheckoutDetector;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsListener;
|
||||
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
||||
use WC_Payment_Gateways;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
|
||||
/**
|
||||
* Class AxoModule
|
||||
|
@ -99,7 +99,7 @@ class AxoModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
|||
}
|
||||
|
||||
$dcc_configuration = $c->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_configuration instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_configuration instanceof CardPaymentsConfiguration );
|
||||
|
||||
if ( ! $dcc_configuration->is_enabled() ) {
|
||||
return $methods;
|
||||
|
@ -165,7 +165,7 @@ class AxoModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
|||
assert( $listener instanceof SettingsListener );
|
||||
|
||||
$dcc_configuration = $c->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_configuration instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_configuration instanceof CardPaymentsConfiguration );
|
||||
|
||||
$listener->filter_settings(
|
||||
$dcc_configuration->use_fastlane(),
|
||||
|
@ -248,7 +248,7 @@ class AxoModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
|||
'woocommerce_paypal_payments_sdk_components_hook',
|
||||
function( $components ) use ( $c ) {
|
||||
$dcc_configuration = $c->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_configuration instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_configuration instanceof CardPaymentsConfiguration );
|
||||
|
||||
if ( ! $dcc_configuration->use_fastlane() ) {
|
||||
return $components;
|
||||
|
@ -263,7 +263,7 @@ class AxoModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
|||
function () use ( $c ) {
|
||||
// Add meta tag to allow feature-detection of the site's AXO payment state.
|
||||
$dcc_configuration = $c->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_configuration instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_configuration instanceof CardPaymentsConfiguration );
|
||||
|
||||
if ( $dcc_configuration->use_fastlane() ) {
|
||||
// phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
|
||||
|
@ -404,7 +404,7 @@ class AxoModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
|||
*/
|
||||
private function should_render_fastlane( ContainerInterface $c ): bool {
|
||||
$dcc_configuration = $c->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_configuration instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_configuration instanceof CardPaymentsConfiguration );
|
||||
|
||||
$subscription_helper = $c->get( 'wc-subscriptions.helper' );
|
||||
assert( $subscription_helper instanceof SubscriptionHelper );
|
||||
|
|
|
@ -29,7 +29,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\ProcessPaymentTrait;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Exception\GatewayGenericException;
|
||||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
|
||||
/**
|
||||
* Class AXOGateway.
|
||||
|
@ -56,9 +56,9 @@ class AxoGateway extends WC_Payment_Gateway {
|
|||
/**
|
||||
* Gateway configuration object, providing relevant settings.
|
||||
*
|
||||
* @var DCCGatewayConfiguration
|
||||
* @var CardPaymentsConfiguration
|
||||
*/
|
||||
protected DCCGatewayConfiguration $dcc_configuration;
|
||||
protected CardPaymentsConfiguration $dcc_configuration;
|
||||
|
||||
/**
|
||||
* The WcGateway module URL.
|
||||
|
@ -133,24 +133,24 @@ class AxoGateway extends WC_Payment_Gateway {
|
|||
/**
|
||||
* AXOGateway constructor.
|
||||
*
|
||||
* @param SettingsRenderer $settings_renderer The settings renderer.
|
||||
* @param ContainerInterface $ppcp_settings The settings.
|
||||
* @param DCCGatewayConfiguration $dcc_configuration The DCC Gateway configuration.
|
||||
* @param string $wcgateway_module_url The WcGateway module URL.
|
||||
* @param SessionHandler $session_handler The Session Handler.
|
||||
* @param OrderProcessor $order_processor The Order processor.
|
||||
* @param array $card_icons The card icons.
|
||||
* @param OrderEndpoint $order_endpoint The order endpoint.
|
||||
* @param PurchaseUnitFactory $purchase_unit_factory The purchase unit factory.
|
||||
* @param SettingsRenderer $settings_renderer The settings renderer.
|
||||
* @param ContainerInterface $ppcp_settings The settings.
|
||||
* @param CardPaymentsConfiguration $dcc_configuration The DCC Gateway configuration.
|
||||
* @param string $wcgateway_module_url The WcGateway module URL.
|
||||
* @param SessionHandler $session_handler The Session Handler.
|
||||
* @param OrderProcessor $order_processor The Order processor.
|
||||
* @param array $card_icons The card icons.
|
||||
* @param OrderEndpoint $order_endpoint The order endpoint.
|
||||
* @param PurchaseUnitFactory $purchase_unit_factory The purchase unit factory.
|
||||
* @param ShippingPreferenceFactory $shipping_preference_factory The shipping preference factory.
|
||||
* @param TransactionUrlProvider $transaction_url_provider The transaction url provider.
|
||||
* @param Environment $environment The environment.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
* @param TransactionUrlProvider $transaction_url_provider The transaction url provider.
|
||||
* @param Environment $environment The environment.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
*/
|
||||
public function __construct(
|
||||
SettingsRenderer $settings_renderer,
|
||||
ContainerInterface $ppcp_settings,
|
||||
DCCGatewayConfiguration $dcc_configuration,
|
||||
CardPaymentsConfiguration $dcc_configuration,
|
||||
string $wcgateway_module_url,
|
||||
SessionHandler $session_handler,
|
||||
OrderProcessor $order_processor,
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace WooCommerce\PayPalCommerce\Axo\Helper;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CartCheckoutDetector;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
|
||||
/**
|
||||
* Class CompatibilityChecker
|
||||
|
@ -38,18 +38,18 @@ class CompatibilityChecker {
|
|||
/**
|
||||
* Provides details about the DCC configuration.
|
||||
*
|
||||
* @var DCCGatewayConfiguration
|
||||
* @var CardPaymentsConfiguration
|
||||
*/
|
||||
private DCCGatewayConfiguration $dcc_configuration;
|
||||
private CardPaymentsConfiguration $dcc_configuration;
|
||||
|
||||
/**
|
||||
* CompatibilityChecker constructor.
|
||||
*
|
||||
* @param string[] $incompatible_plugin_names The list of Fastlane incompatible
|
||||
* plugin names.
|
||||
* @param DCCGatewayConfiguration $dcc_configuration DCC gateway configuration.
|
||||
* @param string[] $incompatible_plugin_names The list of Fastlane incompatible
|
||||
* plugin names.
|
||||
* @param CardPaymentsConfiguration $dcc_configuration DCC gateway configuration.
|
||||
*/
|
||||
public function __construct( array $incompatible_plugin_names, DCCGatewayConfiguration $dcc_configuration ) {
|
||||
public function __construct( array $incompatible_plugin_names, CardPaymentsConfiguration $dcc_configuration ) {
|
||||
$this->incompatible_plugin_names = $incompatible_plugin_names;
|
||||
$this->dcc_configuration = $dcc_configuration;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ use WooCommerce\PayPalCommerce\Button\Helper\MessagesApply;
|
|||
use WooCommerce\PayPalCommerce\Button\Helper\ThreeDSecure;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\Environment;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\SettingsStatus;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
|
||||
return array(
|
||||
'button.client_id' => static function ( ContainerInterface $container ): string {
|
||||
|
@ -116,7 +116,7 @@ return array(
|
|||
|
||||
$no_smart_buttons = ! $settings_status->is_smart_button_enabled_for_location( $context );
|
||||
$dcc_configuration = $container->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_configuration instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_configuration instanceof CardPaymentsConfiguration );
|
||||
|
||||
if ( $no_smart_buttons && ! $dcc_configuration->is_enabled() ) {
|
||||
// Smart buttons disabled, and also not using advanced card payments.
|
||||
|
|
|
@ -54,7 +54,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Helper\SettingsStatus;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WC_Shipping_Method;
|
||||
use WC_Cart;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
|
||||
/**
|
||||
* Class SmartButton
|
||||
|
@ -241,38 +241,38 @@ class SmartButton implements SmartButtonInterface {
|
|||
/**
|
||||
* Provides details about the DCC configuration.
|
||||
*
|
||||
* @var DCCGatewayConfiguration
|
||||
* @var CardPaymentsConfiguration
|
||||
*/
|
||||
private DCCGatewayConfiguration $dcc_configuration;
|
||||
private CardPaymentsConfiguration $dcc_configuration;
|
||||
|
||||
/**
|
||||
* SmartButton constructor.
|
||||
*
|
||||
* @param string $module_url The URL to the module.
|
||||
* @param string $version The assets version.
|
||||
* @param SessionHandler $session_handler The Session handler.
|
||||
* @param Settings $settings The Settings.
|
||||
* @param PayerFactory $payer_factory The Payer factory.
|
||||
* @param string $client_id The client ID.
|
||||
* @param RequestData $request_data The Request Data helper.
|
||||
* @param DccApplies $dcc_applies The DCC applies helper.
|
||||
* @param SubscriptionHelper $subscription_helper The subscription helper.
|
||||
* @param MessagesApply $messages_apply The Messages apply helper.
|
||||
* @param Environment $environment The environment object.
|
||||
* @param PaymentTokenRepository $payment_token_repository The payment token repository.
|
||||
* @param SettingsStatus $settings_status The Settings status helper.
|
||||
* @param CurrencyGetter $currency The getter of the 3-letter currency code of the shop.
|
||||
* @param array $all_funding_sources All existing funding sources.
|
||||
* @param bool $basic_checkout_validation_enabled Whether the basic JS validation of the form iss enabled.
|
||||
* @param bool $early_validation_enabled Whether to execute WC validation of the checkout form.
|
||||
* @param array $pay_now_contexts The contexts that should have the Pay Now button.
|
||||
* @param string[] $funding_sources_without_redirect The sources that do not cause issues about redirecting (on mobile, ...) and sometimes not returning back.
|
||||
* @param bool $vault_v3_enabled Whether Vault v3 module is enabled.
|
||||
* @param PaymentTokensEndpoint $payment_tokens_endpoint Payment tokens endpoint.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
* @param bool $should_handle_shipping_in_paypal Whether the shipping should be handled in PayPal.
|
||||
* @param DisabledFundingSources $disabled_funding_sources List of funding sources to be disabled.
|
||||
* @param DCCGatewayConfiguration $dcc_configuration The DCC Gateway Configuration.
|
||||
* @param string $module_url The URL to the module.
|
||||
* @param string $version The assets version.
|
||||
* @param SessionHandler $session_handler The Session handler.
|
||||
* @param Settings $settings The Settings.
|
||||
* @param PayerFactory $payer_factory The Payer factory.
|
||||
* @param string $client_id The client ID.
|
||||
* @param RequestData $request_data The Request Data helper.
|
||||
* @param DccApplies $dcc_applies The DCC applies helper.
|
||||
* @param SubscriptionHelper $subscription_helper The subscription helper.
|
||||
* @param MessagesApply $messages_apply The Messages apply helper.
|
||||
* @param Environment $environment The environment object.
|
||||
* @param PaymentTokenRepository $payment_token_repository The payment token repository.
|
||||
* @param SettingsStatus $settings_status The Settings status helper.
|
||||
* @param CurrencyGetter $currency The getter of the 3-letter currency code of the shop.
|
||||
* @param array $all_funding_sources All existing funding sources.
|
||||
* @param bool $basic_checkout_validation_enabled Whether the basic JS validation of the form iss enabled.
|
||||
* @param bool $early_validation_enabled Whether to execute WC validation of the checkout form.
|
||||
* @param array $pay_now_contexts The contexts that should have the Pay Now button.
|
||||
* @param string[] $funding_sources_without_redirect The sources that do not cause issues about redirecting (on mobile, ...) and sometimes not returning back.
|
||||
* @param bool $vault_v3_enabled Whether Vault v3 module is enabled.
|
||||
* @param PaymentTokensEndpoint $payment_tokens_endpoint Payment tokens endpoint.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
* @param bool $should_handle_shipping_in_paypal Whether the shipping should be handled in PayPal.
|
||||
* @param DisabledFundingSources $disabled_funding_sources List of funding sources to be disabled.
|
||||
* @param CardPaymentsConfiguration $dcc_configuration The DCC Gateway Configuration.
|
||||
*/
|
||||
public function __construct(
|
||||
string $module_url,
|
||||
|
@ -299,7 +299,7 @@ class SmartButton implements SmartButtonInterface {
|
|||
LoggerInterface $logger,
|
||||
bool $should_handle_shipping_in_paypal,
|
||||
DisabledFundingSources $disabled_funding_sources,
|
||||
DCCGatewayConfiguration $dcc_configuration
|
||||
CardPaymentsConfiguration $dcc_configuration
|
||||
) {
|
||||
$this->module_url = $module_url;
|
||||
$this->version = $version;
|
||||
|
|
|
@ -13,7 +13,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CardButtonGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\WcSubscriptions\FreeTrialHandlerTrait;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
|
||||
/**
|
||||
* Class DisabledFundingSources
|
||||
|
@ -39,18 +39,18 @@ class DisabledFundingSources {
|
|||
/**
|
||||
* Provides details about the DCC configuration.
|
||||
*
|
||||
* @var DCCGatewayConfiguration
|
||||
* @var CardPaymentsConfiguration
|
||||
*/
|
||||
private DCCGatewayConfiguration $dcc_configuration;
|
||||
private CardPaymentsConfiguration $dcc_configuration;
|
||||
|
||||
/**
|
||||
* DisabledFundingSources constructor.
|
||||
*
|
||||
* @param Settings $settings The settings.
|
||||
* @param array $all_funding_sources All existing funding sources.
|
||||
* @param DCCGatewayConfiguration $dcc_configuration DCC gateway configuration.
|
||||
* @param Settings $settings The settings.
|
||||
* @param array $all_funding_sources All existing funding sources.
|
||||
* @param CardPaymentsConfiguration $dcc_configuration DCC gateway configuration.
|
||||
*/
|
||||
public function __construct( Settings $settings, array $all_funding_sources, DCCGatewayConfiguration $dcc_configuration ) {
|
||||
public function __construct( Settings $settings, array $all_funding_sources, CardPaymentsConfiguration $dcc_configuration ) {
|
||||
$this->settings = $settings;
|
||||
$this->all_funding_sources = $all_funding_sources;
|
||||
$this->dcc_configuration = $dcc_configuration;
|
||||
|
|
|
@ -16,7 +16,7 @@ use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ServiceModule;
|
|||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
|
||||
/**
|
||||
* Class CardFieldsModule
|
||||
|
@ -55,7 +55,7 @@ class CardFieldsModule implements ServiceModule, ExtendingModule, ExecutableModu
|
|||
'woocommerce_paypal_payments_sdk_components_hook',
|
||||
static function( $components ) use ( $c ) {
|
||||
$dcc_config = $c->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_config instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_config instanceof CardPaymentsConfiguration );
|
||||
|
||||
if ( ! $dcc_config->is_enabled() ) {
|
||||
return $components;
|
||||
|
|
|
@ -83,7 +83,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsListener;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
|
||||
use WooCommerce\PayPalCommerce\Axo\Helper\PropertiesDictionary;
|
||||
use WooCommerce\PayPalCommerce\Applepay\ApplePayGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\ConnectionState;
|
||||
|
||||
return array(
|
||||
|
@ -465,7 +465,7 @@ return array(
|
|||
|
||||
$axo_available = $container->has( 'axo.available' ) && $container->get( 'axo.available' );
|
||||
$dcc_configuration = $container->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_configuration instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_configuration instanceof CardPaymentsConfiguration );
|
||||
|
||||
if ( $axo_available && $dcc_configuration->use_fastlane() ) {
|
||||
return '';
|
||||
|
@ -688,7 +688,7 @@ return array(
|
|||
assert( $subscription_helper instanceof SubscriptionHelper );
|
||||
|
||||
$dcc_configuration = $container->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_configuration instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_configuration instanceof CardPaymentsConfiguration );
|
||||
|
||||
$fields = array(
|
||||
'checkout_settings_heading' => array(
|
||||
|
@ -1362,14 +1362,14 @@ return array(
|
|||
return new TransactionUrlProvider( $sandbox_url_base, $live_url_base );
|
||||
},
|
||||
|
||||
'wcgateway.configuration.card-configuration' => static function ( ContainerInterface $container ) : DCCGatewayConfiguration {
|
||||
'wcgateway.configuration.card-configuration' => static function ( ContainerInterface $container ) : CardPaymentsConfiguration {
|
||||
$connection_state = $container->get( 'settings.connection-state' );
|
||||
assert( $connection_state instanceof ConnectionState );
|
||||
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
assert( $settings instanceof Settings );
|
||||
|
||||
return new DCCGatewayConfiguration( $connection_state, $settings );
|
||||
return new CardPaymentsConfiguration( $connection_state, $settings );
|
||||
},
|
||||
|
||||
'wcgateway.helper.dcc-product-status' => static function ( ContainerInterface $container ) : DCCProductStatus {
|
||||
|
|
|
@ -34,7 +34,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Processor\TransactionIdHandlingTrait;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
|
||||
use WooCommerce\PayPalCommerce\WcSubscriptions\FreeTrialHandlerTrait;
|
||||
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
|
||||
/**
|
||||
* Class CreditCardGateway
|
||||
|
@ -76,9 +76,9 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
|
|||
/**
|
||||
* The DCC Gateway Configuration.
|
||||
*
|
||||
* @var DCCGatewayConfiguration
|
||||
* @var CardPaymentsConfiguration
|
||||
*/
|
||||
protected DCCGatewayConfiguration $dcc_configuration;
|
||||
protected CardPaymentsConfiguration $dcc_configuration;
|
||||
|
||||
/**
|
||||
* The vaulted credit card handler.
|
||||
|
@ -188,31 +188,31 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
|
|||
/**
|
||||
* CreditCardGateway constructor.
|
||||
*
|
||||
* @param SettingsRenderer $settings_renderer The Settings Renderer.
|
||||
* @param OrderProcessor $order_processor The Order processor.
|
||||
* @param ContainerInterface $config The settings.
|
||||
* @param DCCGatewayConfiguration $dcc_configuration The DCC Gateway Configuration.
|
||||
* @param array $card_icons The card icons.
|
||||
* @param string $module_url The URL to the module.
|
||||
* @param SessionHandler $session_handler The Session Handler.
|
||||
* @param RefundProcessor $refund_processor The refund processor.
|
||||
* @param TransactionUrlProvider $transaction_url_provider Service able to provide view transaction url base.
|
||||
* @param SubscriptionHelper $subscription_helper The subscription helper.
|
||||
* @param PaymentsEndpoint $payments_endpoint The payments endpoint.
|
||||
* @param VaultedCreditCardHandler $vaulted_credit_card_handler The vaulted credit card handler.
|
||||
* @param Environment $environment The environment.
|
||||
* @param OrderEndpoint $order_endpoint The order endpoint.
|
||||
* @param CaptureCardPayment $capture_card_payment Capture card payment.
|
||||
* @param string $prefix The prefix.
|
||||
* @param PaymentTokensEndpoint $payment_tokens_endpoint Payment tokens endpoint.
|
||||
* @param WooCommercePaymentTokens $wc_payment_tokens WooCommerce payment tokens factory.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
* @param SettingsRenderer $settings_renderer The Settings Renderer.
|
||||
* @param OrderProcessor $order_processor The Order processor.
|
||||
* @param ContainerInterface $config The settings.
|
||||
* @param CardPaymentsConfiguration $dcc_configuration The DCC Gateway Configuration.
|
||||
* @param array $card_icons The card icons.
|
||||
* @param string $module_url The URL to the module.
|
||||
* @param SessionHandler $session_handler The Session Handler.
|
||||
* @param RefundProcessor $refund_processor The refund processor.
|
||||
* @param TransactionUrlProvider $transaction_url_provider Service able to provide view transaction url base.
|
||||
* @param SubscriptionHelper $subscription_helper The subscription helper.
|
||||
* @param PaymentsEndpoint $payments_endpoint The payments endpoint.
|
||||
* @param VaultedCreditCardHandler $vaulted_credit_card_handler The vaulted credit card handler.
|
||||
* @param Environment $environment The environment.
|
||||
* @param OrderEndpoint $order_endpoint The order endpoint.
|
||||
* @param CaptureCardPayment $capture_card_payment Capture card payment.
|
||||
* @param string $prefix The prefix.
|
||||
* @param PaymentTokensEndpoint $payment_tokens_endpoint Payment tokens endpoint.
|
||||
* @param WooCommercePaymentTokens $wc_payment_tokens WooCommerce payment tokens factory.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
*/
|
||||
public function __construct(
|
||||
SettingsRenderer $settings_renderer,
|
||||
OrderProcessor $order_processor,
|
||||
ContainerInterface $config,
|
||||
DCCGatewayConfiguration $dcc_configuration,
|
||||
CardPaymentsConfiguration $dcc_configuration,
|
||||
array $card_icons,
|
||||
string $module_url,
|
||||
SessionHandler $session_handler,
|
||||
|
|
|
@ -36,10 +36,8 @@ use WooCommerce\PayPalCommerce\Axo\Helper\PropertiesDictionary;
|
|||
* - BCDC uses "hosted-fields"
|
||||
*
|
||||
* DI service: 'wcgateway.configuration.card-configuration'
|
||||
*
|
||||
* @todo: Rename this class to CardPaymentsConfiguration!
|
||||
*/
|
||||
class DCCGatewayConfiguration {
|
||||
class CardPaymentsConfiguration {
|
||||
/**
|
||||
* The connection state.
|
||||
*
|
|
@ -13,7 +13,7 @@ use WC_Payment_Gateway;
|
|||
use WooCommerce\PayPalCommerce\AdminNotices\Entity\Message;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\SettingsStatus;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
|
||||
/**
|
||||
* Creates the admin message about the gateway being enabled without the PayPal gateway.
|
||||
|
@ -69,20 +69,20 @@ class GatewayWithoutPayPalAdminNotice {
|
|||
/**
|
||||
* Provides details about the DCC configuration.
|
||||
*
|
||||
* @var DCCGatewayConfiguration
|
||||
* @var CardPaymentsConfiguration
|
||||
*/
|
||||
private DCCGatewayConfiguration $dcc_configuration;
|
||||
private CardPaymentsConfiguration $dcc_configuration;
|
||||
|
||||
/**
|
||||
* ConnectAdminNotice constructor.
|
||||
*
|
||||
* @param string $id The gateway ID.
|
||||
* @param bool $is_connected Whether onboarding was completed.
|
||||
* @param ContainerInterface $settings The settings.
|
||||
* @param bool $is_payments_page Whether the current page is the WC payment page.
|
||||
* @param bool $is_ppcp_settings_page Whether the current page is the PPCP settings page.
|
||||
* @param DCCGatewayConfiguration $dcc_configuration DCC gateway configuration.
|
||||
* @param SettingsStatus|null $settings_status The Settings status helper.
|
||||
* @param string $id The gateway ID.
|
||||
* @param bool $is_connected Whether onboarding was completed.
|
||||
* @param ContainerInterface $settings The settings.
|
||||
* @param bool $is_payments_page Whether the current page is the WC payment page.
|
||||
* @param bool $is_ppcp_settings_page Whether the current page is the PPCP settings page.
|
||||
* @param CardPaymentsConfiguration $dcc_configuration DCC gateway configuration.
|
||||
* @param SettingsStatus|null $settings_status The Settings status helper.
|
||||
*/
|
||||
public function __construct(
|
||||
string $id,
|
||||
|
@ -90,7 +90,7 @@ class GatewayWithoutPayPalAdminNotice {
|
|||
ContainerInterface $settings,
|
||||
bool $is_payments_page,
|
||||
bool $is_ppcp_settings_page,
|
||||
DCCGatewayConfiguration $dcc_configuration,
|
||||
CardPaymentsConfiguration $dcc_configuration,
|
||||
?SettingsStatus $settings_status = null
|
||||
) {
|
||||
$this->id = $id;
|
||||
|
|
|
@ -58,7 +58,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsListener;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\WcTasks\Registrar\TaskRegistrarInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
use WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods\LocalApmProductStatus;
|
||||
|
||||
/**
|
||||
|
@ -196,7 +196,7 @@ class WCGatewayModule implements ServiceModule, ExtendingModule, ExecutableModul
|
|||
assert( $settings instanceof Settings );
|
||||
|
||||
$dcc_configuration = $c->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_configuration instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_configuration instanceof CardPaymentsConfiguration );
|
||||
|
||||
$assets = new SettingsPageAssets(
|
||||
$c->get( 'wcgateway.url' ),
|
||||
|
@ -615,7 +615,7 @@ class WCGatewayModule implements ServiceModule, ExtendingModule, ExecutableModul
|
|||
}
|
||||
|
||||
$dcc_configuration = $container->get( 'wcgateway.configuration.card-configuration' );
|
||||
assert( $dcc_configuration instanceof DCCGatewayConfiguration );
|
||||
assert( $dcc_configuration instanceof CardPaymentsConfiguration );
|
||||
|
||||
$standard_card_button = get_option( 'woocommerce_ppcp-card-button-gateway_settings' );
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use WC_Payment_Gateways;
|
|||
use WooCommerce;
|
||||
use WooCommerce\PayPalCommerce\TestCase;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
use function Brain\Monkey\Functions\when;
|
||||
|
||||
class DisabledFundingSourcesTest extends TestCase
|
||||
|
@ -21,7 +21,7 @@ class DisabledFundingSourcesTest extends TestCase
|
|||
parent::setUp();
|
||||
|
||||
$this->settings = Mockery::mock(Settings::class);
|
||||
$this->dcc_configuration = Mockery::mock(DCCGatewayConfiguration::class);
|
||||
$this->dcc_configuration = Mockery::mock(CardPaymentsConfiguration::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Endpoint\CaptureCardPayment;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Processor\OrderProcessor;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCGatewayConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CardPaymentsConfiguration;
|
||||
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
||||
use function Brain\Monkey\Functions\when;
|
||||
|
||||
|
@ -53,7 +53,7 @@ class CreditCardGatewayTest extends TestCase
|
|||
$this->settingsRenderer = Mockery::mock(SettingsRenderer::class);
|
||||
$this->orderProcessor = Mockery::mock(OrderProcessor::class);
|
||||
$this->config = Mockery::mock(ContainerInterface::class);
|
||||
$this->dcc_configuration = Mockery::mock(DCCGatewayConfiguration::class);
|
||||
$this->dcc_configuration = Mockery::mock(CardPaymentsConfiguration::class);
|
||||
$this->creditCardIcons = [];
|
||||
$this->moduleUrl = '';
|
||||
$this->sessionHandler = Mockery::mock(SessionHandler::class);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue