Merge branch 'trunk' into PCP-2006-google-pay-settings-improvements

This commit is contained in:
Pedro Silva 2023-10-13 15:32:49 +01:00 committed by GitHub
commit a4ddb81d54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 298 additions and 116 deletions

View file

@ -202,8 +202,10 @@ return array(
'wcgateway.settings' => SingletonDecorator::make(
static function ( ContainerInterface $container ): Settings {
$default_button_locations = $container->get( 'wcgateway.button.default-locations' );
return new Settings( $default_button_locations );
return new Settings(
$container->get( 'wcgateway.button.default-locations' ),
$container->get( 'wcgateway.settings.dcc-gateway-title.default' )
);
}
),
'wcgateway.notice.connect' => static function ( ContainerInterface $container ): ConnectAdminNotice {
@ -489,7 +491,7 @@ return array(
'This controls the title which the user sees during checkout.',
'woocommerce-paypal-payments'
),
'default' => __( 'Credit Cards', 'woocommerce-paypal-payments' ),
'default' => $container->get( 'wcgateway.settings.dcc-gateway-title.default' ),
'desc_tip' => true,
'screens' => array(
State::STATE_ONBOARDED,
@ -1190,6 +1192,10 @@ return array(
return $vaulting_label;
},
'wcgateway.settings.dcc-gateway-title.default' => static function ( ContainerInterface $container ): string {
return __( 'Debit & Credit Cards', 'woocommerce-paypal-payments' );
},
'wcgateway.settings.card_billing_data_mode.default' => static function ( ContainerInterface $container ): string {
return $container->get( 'api.shop.is-latin-america' ) ? CardBillingMode::MINIMAL_INPUT : CardBillingMode::USE_WC;
},

View file

@ -35,13 +35,22 @@ class Settings implements ContainerInterface {
*/
protected $default_button_locations;
/**
* The default ACDC gateway title.
*
* @var string
*/
protected $default_dcc_gateway_title;
/**
* Settings constructor.
*
* @param string[] $default_button_locations The list of selected default button locations.
* @param string $default_dcc_gateway_title The default ACDC gateway title.
*/
public function __construct( array $default_button_locations ) {
$this->default_button_locations = $default_button_locations;
public function __construct( array $default_button_locations, string $default_dcc_gateway_title ) {
$this->default_button_locations = $default_button_locations;
$this->default_dcc_gateway_title = $default_dcc_gateway_title;
}
/**
@ -116,7 +125,7 @@ class Settings implements ContainerInterface {
'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_title' => $this->default_dcc_gateway_title,
'dcc_gateway_description' => __(
'Pay with your credit card.',
'woocommerce-paypal-payments'