Skip to content

Commit 9f9c47a

Browse files
committed
fix: standardize redirect mode field names across payment methods
- Rename field keys from 'cc_mode', 'paypal_mode', 'bizum_mode' to unified 'mode' - Update JavaScript selector to match actual HTML IDs - Update gateway classes to read 'mode' field - Update Blocks support classes to read 'mode' field - Each payment method maintains separate mode configuration Actual HTML IDs generated by WooCommerce: - CC: #woocommerce_monei_mode - PayPal: #woocommerce_monei_paypal_mode - Bizum: #woocommerce_monei_bizum_mode
1 parent f8b1cbe commit 9f9c47a

File tree

11 files changed

+18
-22
lines changed

11 files changed

+18
-22
lines changed

assets/js/monei-settings.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ jQuery( document ).ready( function ( $ ) {
2424
// Credit Card gateway ID is 'monei', not 'monei_cc', so handle it specially
2525
const gatewayId =
2626
paymentMethod === 'cc' ? 'monei' : 'monei_' + paymentMethod;
27-
const redirectCheckbox = $(
28-
'#woocommerce_' + gatewayId + '_' + paymentMethod + '_mode'
29-
);
27+
const redirectCheckbox = $( '#woocommerce_' + gatewayId + '_mode' );
3028
const descriptionField = $(
3129
'.monei-' + paymentMethod + '-description-field'
3230
);
@@ -58,10 +56,8 @@ jQuery( document ).ready( function ( $ ) {
5856
$( '#monei_apikey_mode' ).change( toggleApiKeyFields );
5957
paymentMethods.forEach( function ( method ) {
6058
const gatewayId = method === 'cc' ? 'monei' : 'monei_' + method;
61-
$( '#woocommerce_' + gatewayId + '_' + method + '_mode' ).change(
62-
function () {
63-
toggleDescriptionField( method );
64-
}
65-
);
59+
$( '#woocommerce_' + gatewayId + '_mode' ).change( function () {
60+
toggleDescriptionField( method );
61+
} );
6662
} );
6763
} );

includes/admin/monei-bizum-settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
'label' => __( 'Enable Bizum by MONEI', 'monei' ),
3232
'default' => 'no',
3333
),
34-
'bizum_mode' => array(
34+
'mode' => array(
3535
'title' => __( 'Use Redirect Flow', 'monei' ),
3636
'type' => 'checkbox',
3737
'label' => __( 'This will redirect the customer to the Hosted Payment Page.', 'monei' ),

includes/admin/monei-cc-settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
'label' => __( 'Enable Credit Card by MONEI', 'monei' ),
3232
'default' => 'no',
3333
),
34-
'cc_mode' => array(
34+
'mode' => array(
3535
'title' => __( 'Use Redirect Flow', 'monei' ),
3636
'type' => 'checkbox',
3737
'label' => __( 'This will redirect the customer to the Hosted Payment Page.', 'monei' ),

includes/admin/monei-paypal-settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
'label' => __( 'Enable PayPal by MONEI', 'monei' ),
3232
'default' => 'no',
3333
),
34-
'paypal_mode' => array(
34+
'mode' => array(
3535
'title' => __( 'Use Redirect Flow', 'monei' ),
3636
'type' => 'checkbox',
3737
'label' => __( 'This will redirect the customer to the Hosted Payment Page.', 'monei' ),

languages/monei-fi.po

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ msgstr "MONEI Payments for WooCommerce"
2525
#. Plugin URI of the plugin
2626
#: woocommerce-gateway-monei.php
2727
msgid "https://wordpress.org/plugins/monei/"
28-
msgstr ""
28+
msgstr "https://wordpress.org/plugins/monei/"
2929

3030
#. Description of the plugin
3131
#: woocommerce-gateway-monei.php
@@ -37,12 +37,12 @@ msgstr "Hyväksy kortti-, Apple Pay-, Google Pay-, Bizum-, PayPal- ja monet muut
3737
#. Author of the plugin
3838
#: woocommerce-gateway-monei.php
3939
msgid "MONEI"
40-
msgstr ""
40+
msgstr "MONEI"
4141

4242
#. Author URI of the plugin
4343
#: woocommerce-gateway-monei.php
4444
msgid "https://www.monei.com/"
45-
msgstr ""
45+
msgstr "https://www.monei.com/"
4646

4747
#: class-woocommerce-gateway-monei.php:65
4848
msgid "Use Singleton."
@@ -254,7 +254,7 @@ msgstr "Kuvaus"
254254
msgid ""
255255
"This description is only displayed when using redirect mode. It will be "
256256
"shown to customers before they are redirected to the payment page."
257-
msgstr "Tämä kuvaus näytetään vain uudelleenohjaustilas sa. Se näytetään asiakkaille ennen kuin heidät ohjataan maksusivulle."
257+
msgstr "Tämä kuvaus näytetään vain uudelleenohjaustilassa. Se näytetään asiakkaille ennen kuin heidät ohjataan maksusivulle."
258258

259259
#: includes/admin/monei-bizum-settings.php:68
260260
msgid ""
@@ -964,7 +964,7 @@ msgstr "CVC/CVV2-numero vaaditaan"
964964

965965
#: src/Services/MoneiStatusCodeHandler.php:150
966966
msgid "Unsupported card type"
967-
msgstr "Ei-tuettu korttilyyppi"
967+
msgstr "Ei-tuettu korttityyppi"
968968

969969
#: src/Services/MoneiStatusCodeHandler.php:152
970970
msgid "Transaction type not allowed for this type of card"

src/Gateways/Blocks/MoneiBizumBlocksSupport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function get_payment_method_data() {
8585
$total = WC()->cart !== null ? WC()->cart->get_total( false ) : 0;
8686
$cart_has_subscription = $this->handler ? $this->handler->cart_has_subscription() : false;
8787
$bizum_style = $this->get_setting( 'bizum_style' );
88-
$bizum_mode = $this->get_setting( 'bizum_mode' );
88+
$bizum_mode = $this->get_setting( 'mode' );
8989
$redirect_flow = ( ! empty( $bizum_mode ) && 'yes' === $bizum_mode );
9090

9191
if ( ! $bizum_style ) {

src/Gateways/Blocks/MoneiCCBlocksSupport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function get_payment_method_data() {
112112
$card_input_style = '{"base": {"height": "50"}, "input": {"background": "none"}}';
113113
}
114114

115-
$redirect_mode = $this->get_setting( 'cc_mode' ) ?? 'no';
115+
$redirect_mode = $this->get_setting( 'mode' ) ?? 'no';
116116
$description = '';
117117
if ( 'yes' === $redirect_mode && $this->gateway->description !== ' ' ) {
118118
$description = $this->gateway->description;

src/Gateways/Blocks/MoneiPaypalBlocksSupport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function is_active() {
7979
public function get_payment_method_data() {
8080
$total = WC()->cart !== null ? WC()->cart->get_total( false ) : 0;
8181
$paypal_style = $this->get_setting( 'paypal_style' );
82-
$paypal_mode = $this->get_setting( 'paypal_mode' );
82+
$paypal_mode = $this->get_setting( 'mode' );
8383
$redirect_flow = ( ! empty( $paypal_mode ) && 'yes' === $paypal_mode );
8484

8585
if ( ! $paypal_style ) {

src/Gateways/PaymentMethods/WCGatewayMoneiBizum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct(
6262
// Settings variable
6363
$this->hide_logo = ( ! empty( $this->get_option( 'hide_logo' ) ) && 'yes' === $this->get_option( 'hide_logo' ) ) ? true : false;
6464
$this->icon = ( $this->hide_logo ) ? '' : $iconMarkup;
65-
$this->redirect_flow = ( ! empty( $this->get_option( 'bizum_mode' ) ) && 'yes' === $this->get_option( 'bizum_mode' ) ) ? true : false;
65+
$this->redirect_flow = ( ! empty( $this->get_option( 'mode' ) ) && 'yes' === $this->get_option( 'mode' ) ) ? true : false;
6666
$this->testmode = $this->getTestmode();
6767
$hide_title = ( ! empty( $this->get_option( 'hide_title' ) ) && 'yes' === $this->get_option( 'hide_title' ) ) ? true : false;
6868
$this->title = ( ! $hide_title && ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';

src/Gateways/PaymentMethods/WCGatewayMoneiCC.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function __construct(
102102
$hasCardBrands = ! empty( $cardBrands ) && count( array_filter( array_keys( $cardBrands ), fn( $key ) => $key !== 'default' ) ) > 0;
103103

104104
$this->icon = ( $this->hide_logo || $hasCardBrands ) ? '' : $iconMarkup;
105-
$this->redirect_flow = ( ! empty( $this->get_option( 'cc_mode' ) ) && 'yes' === $this->get_option( 'cc_mode' ) ) ? true : false;
105+
$this->redirect_flow = ( ! empty( $this->get_option( 'mode' ) ) && 'yes' === $this->get_option( 'mode' ) ) ? true : false;
106106
$this->testmode = $this->getTestmode();
107107
$hide_title = ( ! empty( $this->get_option( 'hide_title' ) ) && 'yes' === $this->get_option( 'hide_title' ) ) ? true : false;
108108
$this->title = ( ! $hide_title && ! empty( $this->get_option( 'title' ) ) ) ? $this->get_option( 'title' ) : '';

0 commit comments

Comments
 (0)