Skip to content

Commit 7eab4e3

Browse files
committed
refactor: standardize all blocks params to camelCase
- Convert logo_google → logoGoogle - Convert logo_apple → logoApple - Convert test_mode → testMode (all blocks) - Convert cart_has_subscription → cartHasSubscription Now all localized params use consistent camelCase naming
1 parent eda9920 commit 7eab4e3

8 files changed

+27
-27
lines changed

assets/js/components/monei-apple-google-component.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import { useButtonStateManager } from '../helpers/monei-shared-utils';
77
*/
88
export const createAppleGoogleLabel = ( moneiData ) => {
99
const isApple = window.ApplePaySession?.canMakePayments?.();
10-
const appleEnabled = moneiData.logo_apple !== false;
11-
const googleEnabled = moneiData.logo_google !== false;
10+
const appleEnabled = moneiData.logoApple !== false;
11+
const googleEnabled = moneiData.logoGoogle !== false;
1212

13-
let logo = googleEnabled ? moneiData.logo_google : false;
14-
logo = isApple && appleEnabled ? moneiData.logo_apple : logo;
13+
let logo = googleEnabled ? moneiData.logoGoogle : false;
14+
logo = isApple && appleEnabled ? moneiData.logoApple : logo;
1515

1616
const title = moneiData.title || '';
1717
const shouldShowLogo =
18-
( isApple && moneiData?.logo_apple ) ||
19-
( ! isApple && moneiData?.logo_google );
18+
( isApple && moneiData?.logoApple ) ||
19+
( ! isApple && moneiData?.logoGoogle );
2020

2121
return (
2222
<div className="monei-label-container">

assets/js/monei-block-checkout-bizum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@
382382
canMakePayment: ( { billingData } ) => {
383383
return (
384384
billingData.country === 'ES' &&
385-
! bizumData.cart_has_subscription
385+
! bizumData.cartHasSubscription
386386
);
387387
},
388388
supports: bizumData.supports,

src/Gateways/Blocks/MoneiAppleGoogleBlocksSupport.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ public function get_payment_method_data() {
100100
$data = array(
101101
'title' => $this->gateway->title,
102102
'description' => $this->gateway->description === '&nbsp;' ? '' : $this->gateway->description,
103-
'logo_google' => $isGoogleEnabled ? $logoGoogle : false,
104-
'logo_apple' => $isAppleEnabled ? $logoApple : false,
103+
'logoGoogle' => $isGoogleEnabled ? $logoGoogle : false,
104+
'logoApple' => $isAppleEnabled ? $logoApple : false,
105105
'supports' => $supports,
106106

107107
// yes: test mode.
108108
// no: live,
109-
'test_mode' => $this->gateway->getTestmode(),
109+
'testMode' => $this->gateway->getTestmode(),
110110
'accountId' => $this->gateway->getAccountId() ?? false,
111111
'sessionId' => wc()->session !== null ? wc()->session->get_customer_id() : '',
112112
'currency' => get_woocommerce_currency(),

src/Gateways/Blocks/MoneiBizumBlocksSupport.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,22 @@ public function get_payment_method_data() {
9494
}
9595
$data = array(
9696

97-
'title' => $this->gateway->title,
98-
'logo' => WC_Monei()->plugin_url() . '/public/images/bizum-logo.svg',
99-
'supports' => $this->get_supported_features(),
100-
'currency' => get_woocommerce_currency(),
101-
'total' => $total,
102-
'language' => locale_iso_639_1_code(),
97+
'title' => $this->gateway->title,
98+
'logo' => WC_Monei()->plugin_url() . '/public/images/bizum-logo.svg',
99+
'supports' => $this->get_supported_features(),
100+
'currency' => get_woocommerce_currency(),
101+
'total' => $total,
102+
'language' => locale_iso_639_1_code(),
103103

104104
// yes: test mode.
105105
// no: live,
106-
'test_mode' => $this->gateway->getTestmode() ?? false,
107-
'accountId' => $this->gateway->getAccountId() ?? false,
108-
'sessionId' => wc()->session !== null ? wc()->session->get_customer_id() : '',
109-
'cart_has_subscription' => $cart_has_subscription,
110-
'bizumStyle' => json_decode( $bizum_style ),
111-
'redirectFlow' => $redirect_flow,
112-
'description' => $this->get_setting( 'description' ),
106+
'testMode' => $this->gateway->getTestmode() ?? false,
107+
'accountId' => $this->gateway->getAccountId() ?? false,
108+
'sessionId' => wc()->session !== null ? wc()->session->get_customer_id() : '',
109+
'cartHasSubscription' => $cart_has_subscription,
110+
'bizumStyle' => json_decode( $bizum_style ),
111+
'redirectFlow' => $redirect_flow,
112+
'description' => $this->get_setting( 'description' ),
113113
);
114114

115115
$hide_logo = $this->get_setting( 'hide_logo' );

src/Gateways/Blocks/MoneiCCBlocksSupport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function get_payment_method_data() {
134134

135135
// yes: test mode.
136136
// no: live,
137-
'test_mode' => $this->gateway->getTestmode(),
137+
'testMode' => $this->gateway->getTestmode(),
138138

139139
// yes: redirect the customer to the Hosted Payment Page.
140140
// no: credit card input will be rendered directly on the checkout page

src/Gateways/Blocks/MoneiMBWayBlocksSupport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function get_payment_method_data() {
8989

9090
// yes: test mode.
9191
// no: live,
92-
'test_mode' => $this->gateway->getTestmode() ?? false,
92+
'testMode' => $this->gateway->getTestmode() ?? false,
9393
'accountId' => $this->gateway->getAccountId() ?? false,
9494
'sessionId' => wc()->session !== null ? wc()->session->get_customer_id() : '',
9595
);

src/Gateways/Blocks/MoneiMultibancoBlocksSupport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function get_payment_method_data() {
9090

9191
// yes: test mode.
9292
// no: live,
93-
'test_mode' => $this->gateway->getTestmode() ?? false,
93+
'testMode' => $this->gateway->getTestmode() ?? false,
9494
'accountId' => $this->gateway->getAccountId() ?? false,
9595
'sessionId' => wc()->session !== null ? wc()->session->get_customer_id() : '',
9696
);

src/Gateways/Blocks/MoneiPaypalBlocksSupport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function get_payment_method_data() {
9797

9898
// yes: test mode.
9999
// no: live,
100-
'test_mode' => $this->gateway->getTestmode() ?? false,
100+
'testMode' => $this->gateway->getTestmode() ?? false,
101101
'accountId' => $this->gateway->getAccountId() ?? false,
102102
'sessionId' => wc()->session !== null ? wc()->session->get_customer_id() : '',
103103
'paypalStyle' => json_decode( $paypal_style ),

0 commit comments

Comments
 (0)