Skip to content

Commit ea72233

Browse files
committed
refactor: fix CSS class naming and remove duplicate method
- Fix Account ID field CSS classes (monei-api-key-field → monei-account-id-field) - Update JavaScript to toggle both Account ID and API Key fields - Remove duplicate get_frontend_generated_monei_token() from WCMoneiPaymentGatewayComponent (inherits from parent)
1 parent 4d2665f commit ea72233

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

assets/js/monei-settings.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
jQuery( document ).ready( function ( $ ) {
2-
// Function to toggle API key fields
2+
// Function to toggle API key and Account ID fields
33
function toggleApiKeyFields() {
44
const mode = $( '#monei_apikey_mode' ).val();
55
if ( mode === 'test' ) {
6-
$( '.monei-test-api-key-field' ).closest( 'tr' ).show();
7-
$( '.monei-live-api-key-field' ).closest( 'tr' ).hide();
6+
$( '.monei-test-api-key-field, .monei-test-account-id-field' )
7+
.closest( 'tr' )
8+
.show();
9+
$( '.monei-live-api-key-field, .monei-live-account-id-field' )
10+
.closest( 'tr' )
11+
.hide();
812
} else {
9-
$( '.monei-test-api-key-field' ).closest( 'tr' ).hide();
10-
$( '.monei-live-api-key-field' ).closest( 'tr' ).show();
13+
$( '.monei-test-api-key-field, .monei-test-account-id-field' )
14+
.closest( 'tr' )
15+
.hide();
16+
$( '.monei-live-api-key-field, .monei-live-account-id-field' )
17+
.closest( 'tr' )
18+
.show();
1119
}
1220
}
1321

src/Gateways/Abstracts/WCMoneiPaymentGatewayComponent.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -297,16 +297,6 @@ public function create_payload( $order, $allowed_payment_method = null ) {
297297
return $payload;
298298
}
299299

300-
/**
301-
* Frontend MONEI generated token.
302-
*
303-
* @return false|string
304-
*/
305-
public function get_frontend_generated_monei_token() {
306-
// phpcs:ignore WordPress.Security.NonceVerification, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
307-
return ( isset( $_POST['monei_payment_token'] ) ) ? wc_clean( wp_unslash( $_POST['monei_payment_token'] ) ) : false; // WPCS: CSRF ok.
308-
}
309-
310300
/**
311301
* Frontend MONEI generated flag for block checkout processing.
312302
*

src/Settings/MoneiSettings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function get_settings() {
4646
'desc' => __( 'Your MONEI Test Account ID. Available at your MONEI dashboard.', 'monei' ),
4747
'id' => 'monei_test_accountid',
4848
'default' => '',
49-
'class' => 'monei-api-key-field monei-test-api-key-field',
49+
'class' => 'monei-account-id-field monei-test-account-id-field',
5050
'placeholder' => '9b1deb4d-3b7d-4bad-9bdd-2b0c11b3dcb6d',
5151
),
5252
array(
@@ -55,7 +55,7 @@ public function get_settings() {
5555
'desc' => __( 'Your MONEI Account ID. Available at your MONEI dashboard.', 'monei' ),
5656
'id' => 'monei_live_accountid',
5757
'default' => '',
58-
'class' => 'monei-api-key-field monei-live-api-key-field',
58+
'class' => 'monei-account-id-field monei-live-account-id-field',
5959
'placeholder' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
6060
),
6161
array(

0 commit comments

Comments
 (0)