Skip to content

Commit eda9920

Browse files
committed
refactor: standardize all localized params to camelCase
- Convert account_id → accountId - Convert session_id → sessionId - Convert apple_logo → appleLogo - Convert card_input_style → cardInputStyle - Convert card_brands → cardBrands - Convert payment_request_style → paymentRequestStyle - Apply to both CC and Apple/Google Pay gateways
1 parent 45cdfa9 commit eda9920

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

assets/js/monei-apple-google-classic.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@
187187
},
188188
instantiate_payment_request() {
189189
const paymentRequest = monei.PaymentRequest( {
190-
accountId: wc_monei_apple_google_params.account_id,
191-
sessionId: wc_monei_apple_google_params.session_id,
190+
accountId: wc_monei_apple_google_params.accountId,
191+
sessionId: wc_monei_apple_google_params.sessionId,
192192
amount: parseInt( wc_monei_form.total ),
193193
currency: wc_monei_apple_google_params.currency,
194-
style: wc_monei_apple_google_params.payment_request_style || {},
194+
style: wc_monei_apple_google_params.paymentRequestStyle || {},
195195
onSubmit( result ) {
196196
wc_monei_form.apple_google_token_handler( result.token );
197197
},
@@ -234,7 +234,7 @@
234234
label.childNodes[ 0 ].nodeValue = 'Apple Pay ';
235235
const icon = label.querySelector( 'img' );
236236
if ( icon ) {
237-
icon.src = wc_monei_apple_google_params.apple_logo;
237+
icon.src = wc_monei_apple_google_params.appleLogo;
238238
icon.alt = 'Apple Pay';
239239
}
240240
}

assets/js/monei-cc-classic.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@
184184
document.getElementById( 'monei-card-error' );
185185

186186
wc_monei_form.$cardInput = monei.CardInput( {
187-
accountId: wc_monei_params.account_id,
188-
sessionId: wc_monei_params.session_id,
189-
style: wc_monei_params.card_input_style || {},
187+
accountId: wc_monei_params.accountId,
188+
sessionId: wc_monei_params.sessionId,
189+
style: wc_monei_params.cardInputStyle || {},
190190
onChange( event ) {
191191
// Handle real-time validation errors.
192192
if ( event.isTouched && event.error ) {
@@ -331,7 +331,7 @@
331331
wc_monei_form.$paymentForm.appendChild( hiddenInput );
332332
},
333333
render_card_brands_in_label() {
334-
if ( ! wc_monei_params.card_brands ) {
334+
if ( ! wc_monei_params.cardBrands ) {
335335
return;
336336
}
337337

@@ -341,7 +341,7 @@
341341
}
342342

343343
let html = '<span class="monei-card-brands">';
344-
const brands = Object.values( wc_monei_params.card_brands );
344+
const brands = Object.values( wc_monei_params.cardBrands );
345345

346346
// Skip the 'default' brand
347347
for ( let i = 0; i < brands.length; i++ ) {

src/Gateways/PaymentMethods/WCGatewayMoneiAppleGoogle.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ public function monei_scripts() {
202202
'woocommerce_monei_apple_google',
203203
'wc_monei_apple_google_params',
204204
array(
205-
'account_id' => $this->getAccountId(),
206-
'session_id' => WC()->session->get_customer_id(),
207-
'total' => monei_price_format( $total ),
208-
'currency' => get_woocommerce_currency(),
209-
'apple_logo' => WC_Monei()->image_url( 'apple-logo.svg' ),
210-
'payment_request_style' => json_decode( $payment_request_style ),
205+
'accountId' => $this->getAccountId(),
206+
'sessionId' => WC()->session->get_customer_id(),
207+
'total' => monei_price_format( $total ),
208+
'currency' => get_woocommerce_currency(),
209+
'appleLogo' => WC_Monei()->image_url( 'apple-logo.svg' ),
210+
'paymentRequestStyle' => json_decode( $payment_request_style ),
211211
)
212212
);
213213

src/Gateways/PaymentMethods/WCGatewayMoneiCC.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -452,14 +452,14 @@ public function monei_scripts() {
452452
'woocommerce_monei',
453453
'wc_monei_params',
454454
array(
455-
'account_id' => $this->getAccountId(),
456-
'session_id' => WC()->session->get_customer_id(),
457-
'total' => monei_price_format( $total ),
458-
'currency' => get_woocommerce_currency(),
459-
'apple_logo' => WC_Monei()->image_url( 'apple-logo.svg' ),
460-
'card_input_style' => json_decode( $card_input_style ),
461-
'card_brands' => $this->cardBrandHelper->getCardBrandsConfig(),
462-
'nameErrorString' => esc_html__( 'Please enter a valid name. Special characters are not allowed.', 'monei' ),
455+
'accountId' => $this->getAccountId(),
456+
'sessionId' => WC()->session->get_customer_id(),
457+
'total' => monei_price_format( $total ),
458+
'currency' => get_woocommerce_currency(),
459+
'appleLogo' => WC_Monei()->image_url( 'apple-logo.svg' ),
460+
'cardInputStyle' => json_decode( $card_input_style ),
461+
'cardBrands' => $this->cardBrandHelper->getCardBrandsConfig(),
462+
'nameErrorString' => esc_html__( 'Please enter a valid name. Special characters are not allowed.', 'monei' ),
463463
)
464464
);
465465

0 commit comments

Comments
 (0)