Display subscription mode option name instead of value in status report

This commit is contained in:
Emili Castells Guasch 2024-02-23 11:59:13 +01:00
parent ac8459f47e
commit a4bccbbb12
2 changed files with 9 additions and 6 deletions

View file

@ -78,6 +78,8 @@ class StatusReportModule implements ModuleInterface {
$had_ppec_plugin = PPECHelper::is_plugin_configured();
$subscription_mode_options = $c->get( 'wcgateway.settings.fields.subscriptions_mode_options' );
$items = array(
array(
'label' => esc_html__( 'Onboarded', 'woocommerce-paypal-payments' ),
@ -169,7 +171,7 @@ class StatusReportModule implements ModuleInterface {
'description' => esc_html__( 'Whether subscriptions are active and their mode.', 'woocommerce-paypal-payments' ),
'value' => $this->subscriptions_mode_text(
$subscription_helper->plugin_is_active(),
$settings->has( 'subscriptions_mode' ) ? (string) $settings->get( 'subscriptions_mode' ) : '',
$settings->has( 'subscriptions_mode' ) ? (string) $subscription_mode_options[ $settings->get( 'subscriptions_mode' ) ] : '',
$subscriptions_mode_settings
),
),

View file

@ -404,7 +404,6 @@ return array(
'wcgateway.admin.fees-renderer' => static function ( ContainerInterface $container ): FeesRenderer {
return new FeesRenderer();
},
'wcgateway.settings.should-render-settings' => static function ( ContainerInterface $container ): bool {
$sections = array(
@ -419,13 +418,15 @@ return array(
return array_key_exists( $current_page_id, $sections );
},
'wcgateway.settings.fields.subscriptions_mode' => static function ( ContainerInterface $container ): array {
$subscription_mode_options = array(
'wcgateway.settings.fields.subscriptions_mode_options' => static function ( ContainerInterface $container ): array {
return array(
'vaulting_api' => __( 'PayPal Vaulting', 'woocommerce-paypal-payments' ),
'subscriptions_api' => __( 'PayPal Subscriptions', 'woocommerce-paypal-payments' ),
'disable_paypal_subscriptions' => __( 'Disable PayPal for subscriptions', 'woocommerce-paypal-payments' ),
);
},
'wcgateway.settings.fields.subscriptions_mode' => static function ( ContainerInterface $container ): array {
$subscription_mode_options = $container->get( 'wcgateway.settings.fields.subscriptions_mode_options' );
$billing_agreements_endpoint = $container->get( 'api.endpoint.billing-agreements' );
$reference_transaction_enabled = $billing_agreements_endpoint->reference_transaction_enabled();
@ -440,7 +441,7 @@ return array(
'input_class' => array( 'wc-enhanced-select' ),
'desc_tip' => true,
'description' => __( 'Utilize PayPal Vaulting for flexible subscription processing with saved payment methods, create “PayPal Subscriptions” to bill customers at regular intervals, or disable PayPal for subscription-type products.', 'woocommerce-paypal-payments' ),
'default' => 'vaulting_api',
'default' => array_key_first( $subscription_mode_options ),
'options' => $subscription_mode_options,
'screens' => array(
State::STATE_ONBOARDED,