mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Use the new helper for payment methods
This commit is contained in:
parent
ddb80b5a89
commit
6e928acfed
1 changed files with 25 additions and 12 deletions
|
@ -74,6 +74,13 @@ class SettingsMapHelper {
|
|||
*/
|
||||
protected GeneralSettingsMapHelper $general_settings_map_helper;
|
||||
|
||||
/**
|
||||
* A helper for mapping old and new payment method settings.
|
||||
*
|
||||
* @var PaymentMethodSettingsMapHelper
|
||||
*/
|
||||
protected PaymentMethodSettingsMapHelper $payment_method_settings_map_helper;
|
||||
|
||||
/**
|
||||
* Whether the new settings module is enabled.
|
||||
*
|
||||
|
@ -84,12 +91,13 @@ class SettingsMapHelper {
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param SettingsMap[] $settings_map A list of settings maps containing key definitions.
|
||||
* @param StylingSettingsMapHelper $styling_settings_map_helper A helper for mapping the old/new styling settings.
|
||||
* @param SettingsTabMapHelper $settings_tab_map_helper A helper for mapping the old/new settings tab settings.
|
||||
* @param SubscriptionSettingsMapHelper $subscription_map_helper A helper for mapping old and new subscription settings.
|
||||
* @param GeneralSettingsMapHelper $general_settings_map_helper A helper for mapping old and new general settings.
|
||||
* @param bool $new_settings_module_enabled Whether the new settings module is enabled.
|
||||
* @param SettingsMap[] $settings_map A list of settings maps containing key definitions.
|
||||
* @param StylingSettingsMapHelper $styling_settings_map_helper A helper for mapping the old/new styling settings.
|
||||
* @param SettingsTabMapHelper $settings_tab_map_helper A helper for mapping the old/new settings tab settings.
|
||||
* @param SubscriptionSettingsMapHelper $subscription_map_helper A helper for mapping old and new subscription settings.
|
||||
* @param GeneralSettingsMapHelper $general_settings_map_helper A helper for mapping old and new general settings.
|
||||
* @param PaymentMethodSettingsMapHelper $payment_method_settings_map_helper A helper for mapping old and new payment method settings.
|
||||
* @param bool $new_settings_module_enabled Whether the new settings module is enabled.
|
||||
* @throws RuntimeException When an old key has multiple mappings.
|
||||
*/
|
||||
public function __construct(
|
||||
|
@ -98,15 +106,17 @@ class SettingsMapHelper {
|
|||
SettingsTabMapHelper $settings_tab_map_helper,
|
||||
SubscriptionSettingsMapHelper $subscription_map_helper,
|
||||
GeneralSettingsMapHelper $general_settings_map_helper,
|
||||
PaymentMethodSettingsMapHelper $payment_method_settings_map_helper,
|
||||
bool $new_settings_module_enabled
|
||||
) {
|
||||
$this->validate_settings_map( $settings_map );
|
||||
$this->settings_map = $settings_map;
|
||||
$this->styling_settings_map_helper = $styling_settings_map_helper;
|
||||
$this->settings_tab_map_helper = $settings_tab_map_helper;
|
||||
$this->subscription_map_helper = $subscription_map_helper;
|
||||
$this->general_settings_map_helper = $general_settings_map_helper;
|
||||
$this->new_settings_module_enabled = $new_settings_module_enabled;
|
||||
$this->settings_map = $settings_map;
|
||||
$this->styling_settings_map_helper = $styling_settings_map_helper;
|
||||
$this->settings_tab_map_helper = $settings_tab_map_helper;
|
||||
$this->subscription_map_helper = $subscription_map_helper;
|
||||
$this->general_settings_map_helper = $general_settings_map_helper;
|
||||
$this->payment_method_settings_map_helper = $payment_method_settings_map_helper;
|
||||
$this->new_settings_module_enabled = $new_settings_module_enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -203,6 +213,9 @@ class SettingsMapHelper {
|
|||
? $this->subscription_map_helper->mapped_value( $old_key, $this->model_cache[ $model_id ] )
|
||||
: $this->settings_tab_map_helper->mapped_value( $old_key, $this->model_cache[ $model_id ] );
|
||||
|
||||
case $model instanceof PaymentSettings:
|
||||
return $this->payment_method_settings_map_helper->mapped_value( $old_key, $model );
|
||||
|
||||
default:
|
||||
return $this->model_cache[ $model_id ][ $new_key ] ?? null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue