mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
add new setting requirement for PUI readiness
This commit is contained in:
parent
f6e2b345c9
commit
aeb840ff5f
1 changed files with 18 additions and 2 deletions
|
@ -33,6 +33,13 @@ class SettingsRenderer {
|
||||||
*/
|
*/
|
||||||
protected $settings_status;
|
protected $settings_status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The api shop country.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $api_shop_country;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The settings.
|
* The settings.
|
||||||
*
|
*
|
||||||
|
@ -93,6 +100,7 @@ class SettingsRenderer {
|
||||||
* @param DCCProductStatus $dcc_product_status The product status.
|
* @param DCCProductStatus $dcc_product_status The product status.
|
||||||
* @param SettingsStatus $settings_status The Settings status helper.
|
* @param SettingsStatus $settings_status The Settings status helper.
|
||||||
* @param string $page_id ID of the current PPCP gateway settings page, or empty if it is not such page.
|
* @param string $page_id ID of the current PPCP gateway settings page, or empty if it is not such page.
|
||||||
|
* @param string $api_shop_country The api shop country.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ContainerInterface $settings,
|
ContainerInterface $settings,
|
||||||
|
@ -102,7 +110,8 @@ class SettingsRenderer {
|
||||||
MessagesApply $messages_apply,
|
MessagesApply $messages_apply,
|
||||||
DCCProductStatus $dcc_product_status,
|
DCCProductStatus $dcc_product_status,
|
||||||
SettingsStatus $settings_status,
|
SettingsStatus $settings_status,
|
||||||
string $page_id
|
string $page_id,
|
||||||
|
string $api_shop_country
|
||||||
) {
|
) {
|
||||||
|
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
|
@ -113,6 +122,7 @@ class SettingsRenderer {
|
||||||
$this->dcc_product_status = $dcc_product_status;
|
$this->dcc_product_status = $dcc_product_status;
|
||||||
$this->settings_status = $settings_status;
|
$this->settings_status = $settings_status;
|
||||||
$this->page_id = $page_id;
|
$this->page_id = $page_id;
|
||||||
|
$this->api_shop_country = $api_shop_country;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -348,7 +358,7 @@ $data_rows_html
|
||||||
/**
|
/**
|
||||||
* Renders the settings.
|
* Renders the settings.
|
||||||
*/
|
*/
|
||||||
public function render() {
|
public function render(): void {
|
||||||
|
|
||||||
$is_dcc = CreditCardGateway::ID === $this->page_id;
|
$is_dcc = CreditCardGateway::ID === $this->page_id;
|
||||||
//phpcs:enable WordPress.Security.NonceVerification.Recommended
|
//phpcs:enable WordPress.Security.NonceVerification.Recommended
|
||||||
|
@ -392,6 +402,12 @@ $data_rows_html
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
in_array( 'pui_ready', $config['requirements'], true )
|
||||||
|
&& $this->api_shop_country !== 'DE'
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$value = $this->settings->has( $field ) ? $this->settings->get( $field ) : ( isset( $config['value'] ) ? $config['value']() : null );
|
$value = $this->settings->has( $field ) ? $this->settings->get( $field ) : ( isset( $config['value'] ) ? $config['value']() : null );
|
||||||
$key = 'ppcp[' . $field . ']';
|
$key = 'ppcp[' . $field . ']';
|
||||||
$id = 'ppcp-' . $field;
|
$id = 'ppcp-' . $field;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue