diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index e708a1848..f4102eb97 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -142,7 +142,7 @@ return array( 'wcgateway.disabler' => static function ( ContainerInterface $container ): DisableGateways { $session_handler = $container->get( 'session.handler' ); $settings = $container->get( 'wcgateway.settings' ); - $settings_status = $container->get( 'wcgateway.settings.status' ); + $settings_status = $container->get( 'wcgateway.settings.status' ); return new DisableGateways( $session_handler, $settings, $settings_status ); }, @@ -195,8 +195,8 @@ return array( }, 'wcgateway.settings' => static function ( ContainerInterface $container ): Settings { - $messaging_locations = $container->get( 'wcgateway.settings.pay-later.messaging-locations' ); - return new Settings( array_keys( $messaging_locations ) ); + $default_button_locations = $container->get( 'wcgateway.button.default-locations' ); + return new Settings( $default_button_locations ); }, 'wcgateway.notice.connect' => static function ( ContainerInterface $container ): ConnectAdminNotice { $state = $container->get( 'onboarding.state' ); @@ -1283,6 +1283,6 @@ return array( $settings = $container->get( 'wcgateway.settings' ); assert( $settings instanceof Settings ); - return $this->settings->has( 'smart_button_locations' ) ? $this->settings->get( 'smart_button_locations' ) : array(); + return $settings->has( 'smart_button_locations' ) ? $settings->get( 'smart_button_locations' ) : array(); }, ); diff --git a/modules/ppcp-wc-gateway/src/Settings/Settings.php b/modules/ppcp-wc-gateway/src/Settings/Settings.php index 7ea6970fe..34b9718a9 100644 --- a/modules/ppcp-wc-gateway/src/Settings/Settings.php +++ b/modules/ppcp-wc-gateway/src/Settings/Settings.php @@ -29,19 +29,19 @@ class Settings implements ContainerInterface { private $settings = array(); /** - * The list of pay later selected default locations. + * The list of selected default button locations. * * @var string[] */ - protected $pay_later_default_locations; + protected $default_button_locations; /** * Settings constructor. * - * @param string[] $pay_later_default_locations The list of pay later selected default locations. + * @param string[] $default_button_locations The list of selected default button locations. */ - public function __construct( array $pay_later_default_locations ) { - $this->pay_later_default_locations = $pay_later_default_locations; + public function __construct( array $default_button_locations ) { + $this->default_button_locations = $default_button_locations; } /** @@ -109,14 +109,11 @@ class Settings implements ContainerInterface { 'Pay via PayPal.', 'woocommerce-paypal-payments' ), - 'button_product_enabled' => true, - 'button_mini-cart_enabled' => false, - 'button_cart_enabled' => true, + 'smart_button_locations' => $this->default_button_locations, 'pay_later_messaging_enabled' => true, - 'button_enabled' => true, 'pay_later_button_enabled' => true, - 'pay_later_button_locations' => $this->pay_later_default_locations, - 'pay_later_messaging_locations' => $this->pay_later_default_locations, + 'pay_later_button_locations' => $this->default_button_locations, + 'pay_later_messaging_locations' => $this->default_button_locations, 'brand_name' => get_bloginfo( 'name' ), 'dcc_gateway_title' => __( 'Credit Cards', 'woocommerce-paypal-payments' ), 'dcc_gateway_description' => __(