Skip to content

Commit 4dcfffd

Browse files
committed
feat: add (Test Mode) suffix to payment method titles in checkout
- Append ' (Test Mode)' to payment method titles when using test API keys - Follows PrestaShop plugin pattern for consistency - Applied to all payment methods: Credit Card, Apple/Google, Bizum, PayPal, Multibanco, MBWay - Moved testmode initialization before title setting for proper order
1 parent 4f958e2 commit 4dcfffd

File tree

6 files changed

+22
-4
lines changed

6 files changed

+22
-4
lines changed

src/Gateways/PaymentMethods/WCGatewayMoneiAppleGoogle.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public function __construct(
7070
$iconUrl = apply_filters( 'woocommerce_monei_icon', WC_Monei()->image_url( 'google-logo.svg' ) );
7171
$iconMarkup = '<img src="' . $iconUrl . '" alt="MONEI" class="monei-icons" />';
7272
$this->testmode = $this->getTestmode();
73+
if ( $this->testmode && ! empty( $this->title ) ) {
74+
$this->title .= ' (' . __( 'Test Mode', 'monei' ) . ')';
75+
}
7376
$this->icon = ( $this->hide_logo ) ? '' : $iconMarkup;
7477
$this->settings = get_option( 'woocommerce_monei_apple_google_settings', array() );
7578
$this->enabled = ( ! empty( $this->get_option( 'enabled' ) && 'yes' === $this->get_option( 'enabled' ) ) && $this->is_valid_for_use() ) ? 'yes' : false;

src/Gateways/PaymentMethods/WCGatewayMoneiBizum.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,17 @@ public function __construct(
6161
$this->hide_logo = ( ! empty( $this->get_option( 'hide_logo' ) && 'yes' === $this->get_option( 'hide_logo' ) ) ) ? true : false;
6262
$this->icon = ( $this->hide_logo ) ? '' : $iconMarkup;
6363
$this->redirect_flow = ( ! empty( $this->get_option( 'bizum_mode' ) && 'yes' === $this->get_option( 'bizum_mode' ) ) ) ? true : false;
64+
$this->testmode = $this->getTestmode();
6465
$hide_title = ( ! empty( $this->get_option( 'hide_title' ) && 'yes' === $this->get_option( 'hide_title' ) ) ) ? true : false;
6566
$this->title = ( ! $hide_title && ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';
67+
if ( $this->testmode && ! empty( $this->title ) ) {
68+
$this->title .= ' (' . __( 'Test Mode', 'monei' ) . ')';
69+
}
6670
$this->description = ( ! empty( $this->get_option( 'description' ) ) ) ? $this->get_option( 'description' ) : '';
6771
$this->status_after_payment = ( ! empty( $this->get_option( 'orderdo' ) ) ) ? $this->get_option( 'orderdo' ) : '';
6872
$this->api_key = $this->getApiKey();
6973
$this->account_id = $this->getAccountId();
7074
$this->shop_name = get_bloginfo( 'name' );
71-
$this->testmode = $this->getTestmode();
7275
$this->logging = ( ! empty( get_option( 'monei_debug' ) ) && 'yes' === get_option( 'monei_debug' ) ) ? true : false;
7376

7477
// IPN callbacks

src/Gateways/PaymentMethods/WCGatewayMoneiCC.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ public function __construct(
9898
$this->testmode = $this->getTestmode();
9999
$hide_title = ( ! empty( $this->get_option( 'hide_title' ) && 'yes' === $this->get_option( 'hide_title' ) ) ) ? true : false;
100100
$this->title = ( ! $hide_title && ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';
101+
if ( $this->testmode && ! empty( $this->title ) ) {
102+
$this->title .= ' (' . __( 'Test Mode', 'monei' ) . ')';
103+
}
101104
$this->description = ( ! empty( $this->get_option( 'description' ) ) ) ? $this->get_option( 'description' ) : '';
102105
$this->status_after_payment = ( ! empty( $this->get_option( 'orderdo' ) ) ) ? $this->get_option( 'orderdo' ) : '';
103106
$this->account_id = $this->getAccountId();

src/Gateways/PaymentMethods/WCGatewayMoneiMBWay.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@ public function __construct(
5555
// Settings variable
5656
$this->hide_logo = ( ! empty( $this->get_option( 'hide_logo' ) && 'yes' === $this->get_option( 'hide_logo' ) ) ) ? true : false;
5757
$this->icon = ( $this->hide_logo ) ? '' : $iconMarkup;
58+
$this->testmode = $this->getTestmode();
5859
$hide_title = ( ! empty( $this->get_option( 'hide_title' ) && 'yes' === $this->get_option( 'hide_title' ) ) ) ? true : false;
5960
$this->title = ( ! $hide_title && ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';
61+
if ( $this->testmode && ! empty( $this->title ) ) {
62+
$this->title .= ' (' . __( 'Test Mode', 'monei' ) . ')';
63+
}
6064
$this->description = ( ! empty( $this->get_option( 'description' ) ) ) ? $this->get_option( 'description' ) : '';
6165
$this->status_after_payment = ( ! empty( $this->get_option( 'orderdo' ) ) ) ? $this->get_option( 'orderdo' ) : '';
6266
$this->api_key = $this->getApiKey();
6367
$this->account_id = $this->getAccountId();
6468
$this->shop_name = get_bloginfo( 'name' );
65-
$this->testmode = $this->getTestmode();
6669
$this->logging = ( ! empty( get_option( 'monei_debug' ) ) && 'yes' === get_option( 'monei_debug' ) ) ? true : false;
6770

6871
// IPN callbacks

src/Gateways/PaymentMethods/WCGatewayMoneiMultibanco.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,17 @@ public function __construct(
5454
// Settings variable
5555
$this->hide_logo = ( ! empty( $this->get_option( 'hide_logo' ) && 'yes' === $this->get_option( 'hide_logo' ) ) ) ? true : false;
5656
$this->icon = ( $this->hide_logo ) ? '' : $iconMarkup;
57+
$this->testmode = $this->getTestmode();
5758
$hide_title = ( ! empty( $this->get_option( 'hide_title' ) && 'yes' === $this->get_option( 'hide_title' ) ) ) ? true : false;
5859
$this->title = ( ! $hide_title && ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';
60+
if ( $this->testmode && ! empty( $this->title ) ) {
61+
$this->title .= ' (' . __( 'Test Mode', 'monei' ) . ')';
62+
}
5963
$this->description = ( ! empty( $this->get_option( 'description' ) ) ) ? $this->get_option( 'description' ) : '';
6064
$this->status_after_payment = ( ! empty( $this->get_option( 'orderdo' ) ) ) ? $this->get_option( 'orderdo' ) : '';
6165
$this->api_key = $this->getApiKey();
6266
$this->account_id = $this->getAccountId();
6367
$this->shop_name = get_bloginfo( 'name' );
64-
$this->testmode = $this->getTestmode();
6568
$this->logging = ( ! empty( get_option( 'monei_debug' ) ) && 'yes' === get_option( 'monei_debug' ) ) ? true : false;
6669

6770
// IPN callbacks

src/Gateways/PaymentMethods/WCGatewayMoneiPaypal.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,17 @@ public function __construct(
6060
$this->hide_logo = ( ! empty( $this->get_option( 'hide_logo' ) && 'yes' === $this->get_option( 'hide_logo' ) ) ) ? true : false;
6161
$this->icon = ( $this->hide_logo ) ? '' : $iconMarkup;
6262
$this->redirect_flow = ( ! empty( $this->get_option( 'paypal_mode' ) && 'yes' === $this->get_option( 'paypal_mode' ) ) ) ? true : false;
63+
$this->testmode = $this->getTestmode();
6364
$hide_title = ( ! empty( $this->get_option( 'hide_title' ) && 'yes' === $this->get_option( 'hide_title' ) ) ) ? true : false;
6465
$this->title = ( ! $hide_title && ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';
66+
if ( $this->testmode && ! empty( $this->title ) ) {
67+
$this->title .= ' (' . __( 'Test Mode', 'monei' ) . ')';
68+
}
6569
$this->description = ( ! empty( $this->get_option( 'description' ) ) ) ? $this->get_option( 'description' ) : '';
6670
$this->status_after_payment = ( ! empty( $this->get_option( 'orderdo' ) ) ) ? $this->get_option( 'orderdo' ) : '';
6771
$this->api_key = $this->getApiKey();
6872
$this->account_id = $this->getAccountId();
6973
$this->shop_name = get_bloginfo( 'name' );
70-
$this->testmode = $this->getTestmode();
7174
$this->pre_auth = ( ! empty( $this->get_option( 'pre-authorize' ) && 'yes' === $this->get_option( 'pre-authorize' ) ) ) ? true : false;
7275
$this->logging = ( ! empty( $this->get_option( 'debug' ) ) && 'yes' === $this->get_option( 'debug' ) ) ? true : false;
7376

0 commit comments

Comments
 (0)