mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
improve the wording.
This commit is contained in:
parent
834f1e6579
commit
a16ad7fef5
1 changed files with 13 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* A helper for mapping the old/new subscription settings.
|
* A helper for mapping old and new subscription settings.
|
||||||
*
|
*
|
||||||
* @package WooCommerce\PayPalCommerce\Compat\Settings
|
* @package WooCommerce\PayPalCommerce\Compat\Settings
|
||||||
*/
|
*/
|
||||||
|
@ -12,13 +12,13 @@ namespace WooCommerce\PayPalCommerce\Compat\Settings;
|
||||||
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A map of old to new styling settings.
|
* Handles mapping between old and new subscription settings.
|
||||||
*
|
*
|
||||||
* In new settings UI we have to automatically set Subscriptions mode value based on the type of merchant.
|
* In the new settings UI, the Subscriptions mode value is set automatically based on the merchant type.
|
||||||
* So here we will fake the map and later inject the value of the old subscription setting value based on the type of merchant.
|
* This class fakes the mapping and injects the appropriate value based on the merchant:
|
||||||
* - Non-vaulting merchants should have it set to PayPal Subscriptions.
|
* - Non-vaulting merchants will use PayPal Subscriptions.
|
||||||
* - Merchants with vaulting should have it set to PayPal Vaulting.
|
* - Merchants with vaulting will use PayPal Vaulting.
|
||||||
* - The disabled subscriptions can be retrieved by using a filter.
|
* - Disabled subscriptions can be controlled using a filter.
|
||||||
*
|
*
|
||||||
* @psalm-import-type newSettingsKey from SettingsMap
|
* @psalm-import-type newSettingsKey from SettingsMap
|
||||||
* @psalm-import-type oldSettingsKey from SettingsMap
|
* @psalm-import-type oldSettingsKey from SettingsMap
|
||||||
|
@ -48,8 +48,8 @@ class SubscriptionSettingsMapHelper {
|
||||||
/**
|
/**
|
||||||
* Maps the old subscription setting key.
|
* Maps the old subscription setting key.
|
||||||
*
|
*
|
||||||
* We just need to fake the map here as this setting doesn't exist it new settings.
|
* This method creates a placeholder mapping as this setting doesn't exist in the new settings.
|
||||||
* We will automatically set Subscriptions mode value based on the type of merchant.
|
* The Subscriptions mode value is set automatically based on the merchant type.
|
||||||
*
|
*
|
||||||
* @psalm-return array<oldSettingsKey, newSettingsKey>
|
* @psalm-return array<oldSettingsKey, newSettingsKey>
|
||||||
*/
|
*/
|
||||||
|
@ -58,12 +58,12 @@ class SubscriptionSettingsMapHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the value of a mapped subscriptions_mode key from the new settings.
|
* Retrieves the mapped value for the subscriptions_mode key from the new settings.
|
||||||
*
|
*
|
||||||
* @param string $old_key The key from the legacy settings.
|
* @param string $old_key The key from the legacy settings.
|
||||||
* @param array<string, scalar|array> $settings_model The new settings model data as an array.
|
* @param array<string, scalar|array> $settings_model The new settings model data as an array.
|
||||||
*
|
*
|
||||||
* @return 'vaulting_api'|'subscriptions_api'|'disable_paypal_subscriptions'|null The value of the mapped subscriptions_mode setting (null if not found).
|
* @return 'vaulting_api'|'subscriptions_api'|'disable_paypal_subscriptions'|null The mapped subscriptions_mode value, or null if not applicable.
|
||||||
*/
|
*/
|
||||||
public function mapped_value( string $old_key, array $settings_model ): ?string {
|
public function mapped_value( string $old_key, array $settings_model ): ?string {
|
||||||
if ( $old_key !== 'subscriptions_mode' || ! $this->subscription_helper->plugin_is_active() ) {
|
if ( $old_key !== 'subscriptions_mode' || ! $this->subscription_helper->plugin_is_active() ) {
|
||||||
|
@ -74,9 +74,9 @@ class SubscriptionSettingsMapHelper {
|
||||||
$subscription_mode_value = $vaulting ? self::OLD_SETTINGS_SUBSCRIPTION_MODE_VALUE_VAULTING : self::OLD_SETTINGS_SUBSCRIPTION_MODE_VALUE_SUBSCRIPTIONS;
|
$subscription_mode_value = $vaulting ? self::OLD_SETTINGS_SUBSCRIPTION_MODE_VALUE_VAULTING : self::OLD_SETTINGS_SUBSCRIPTION_MODE_VALUE_SUBSCRIPTIONS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows to disable the subscription mode when using the new settings UI.
|
* Allows disabling the subscription mode when using the new settings UI.
|
||||||
*
|
*
|
||||||
* @returns bool true if the subscription mode should be disabled, otherwise false (also by default).
|
* @returns bool true if the subscription mode should be disabled, false otherwise (default is false).
|
||||||
*/
|
*/
|
||||||
$subscription_mode_disabled = (bool) apply_filters( 'woocommerce_paypal_payments_subscription_mode_disabled', false );
|
$subscription_mode_disabled = (bool) apply_filters( 'woocommerce_paypal_payments_subscription_mode_disabled', false );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue