diff --git a/resources/js/mollieBlockIndex.js b/resources/js/mollieBlockIndex.js
index 3109b690..d6146439 100644
--- a/resources/js/mollieBlockIndex.js
+++ b/resources/js/mollieBlockIndex.js
@@ -49,13 +49,17 @@ import ApplePayButtonComponent from './blocks/ApplePayButtonComponent'
gatewayData.forEach(item => {
let register = () => registerPaymentMethod(molliePaymentMethod(useEffect, ajaxUrl, filters, gatewayData, availableGateways, item, jQuery, requiredFields, isCompanyFieldVisible, isPhoneFieldVisible));
if (item.name === 'mollie_wc_gateway_applepay' && !isBlockEditor) {
+ const isExpressEnabled = item.isExpressEnabled;
if ((isAppleSession && window.ApplePaySession.canMakePayments())) {
register();
+ if (isExpressEnabled !== true) {
+ return;
+ }
const {registerExpressPaymentMethod} = wc.wcBlocksRegistry;
registerExpressPaymentMethod({
name: 'mollie_wc_gateway_applepay_express',
- content: ,
- edit: ,
+ content: < ApplePayButtonComponent />,
+ edit: < ApplePayButtonComponent />,
ariaLabel: 'Apple Pay',
canMakePayment: () => true,
paymentMethodId: 'mollie_wc_gateway_applepay',
@@ -63,7 +67,6 @@ import ApplePayButtonComponent from './blocks/ApplePayButtonComponent'
features: ['products'],
},
})
-
}
return;
}
diff --git a/src/Assets/MollieCheckoutBlocksSupport.php b/src/Assets/MollieCheckoutBlocksSupport.php
index 33ace20d..16d2d748 100644
--- a/src/Assets/MollieCheckoutBlocksSupport.php
+++ b/src/Assets/MollieCheckoutBlocksSupport.php
@@ -113,26 +113,26 @@ public static function gatewayDataForWCBlocks(Data $dataService, array $gatewayI
$isSepaEnabled = isset($gatewayInstances['mollie_wc_gateway_directdebit']) && $gatewayInstances['mollie_wc_gateway_directdebit']->enabled === 'yes';
/** @var MolliePaymentGateway $gateway */
foreach ($gatewayInstances as $gatewayKey => $gateway) {
- $gatewayId = is_string($gateway->paymentMethod()->getProperty('id')) ? $gateway->paymentMethod(
- )->getProperty('id') : "";
+ $method = $gateway->paymentMethod();
+ $gatewayId = is_string($method->getProperty('id')) ? $method->getProperty('id') : "";
if ($gateway->enabled !== 'yes' || ($gatewayId === 'directdebit' && !is_admin())) {
continue;
}
- $content = $gateway->paymentMethod()->getProcessedDescriptionForBlock();
+ $content = $method->getProcessedDescriptionForBlock();
$issuers = false;
- if ($gateway->paymentMethod()->getProperty('paymentFields') === true) {
- $paymentFieldsService = $gateway->paymentMethod()->paymentFieldsService();
- $paymentFieldsService->setStrategy($gateway->paymentMethod());
- $issuers = $gateway->paymentMethod()->paymentFieldsService()->getStrategyMarkup($gateway);
+ if ($method->getProperty('paymentFields') === true) {
+ $paymentFieldsService = $method->paymentFieldsService();
+ $paymentFieldsService->setStrategy($method);
+ $issuers = $method->paymentFieldsService()->getStrategyMarkup($gateway);
}
if ($gatewayId === 'creditcard') {
$content .= $issuers;
$issuers = false;
}
- $title = $gateway->paymentMethod()->title();
+ $title = $method->title();
$labelMarkup = "{$title}{$gateway->icon}";
- $hasSurcharge = $gateway->paymentMethod()->hasSurcharge();
+ $hasSurcharge = $method->hasSurcharge();
$countryCodes = [
'BE' => '+32xxxxxxxxx',
'NL' => '+316xxxxxxxx',
@@ -155,15 +155,16 @@ public static function gatewayDataForWCBlocks(Data $dataService, array $gatewayI
'edit' => $content,
'paymentMethodId' => $gatewayKey,
'allowedCountries' => is_array(
- $gateway->paymentMethod()->getProperty('allowed_countries')
- ) ? $gateway->paymentMethod()->getProperty('allowed_countries') : [],
- 'ariaLabel' => $gateway->paymentMethod()->getProperty('defaultDescription'),
- 'supports' => self::gatewaySupportsFeatures($gateway->paymentMethod(), $isSepaEnabled),
- 'errorMessage' => $gateway->paymentMethod()->getProperty('errorMessage'),
- 'companyPlaceholder' => $gateway->paymentMethod()->getProperty('companyPlaceholder'),
- 'phoneLabel' => $gateway->paymentMethod()->getProperty('phoneLabel'),
+ $method->getProperty('allowed_countries')
+ ) ? $method->getProperty('allowed_countries') : [],
+ 'ariaLabel' => $method->getProperty('defaultDescription'),
+ 'supports' => self::gatewaySupportsFeatures($method, $isSepaEnabled),
+ 'errorMessage' => $method->getProperty('errorMessage'),
+ 'companyPlaceholder' => $method->getProperty('companyPlaceholder'),
+ 'phoneLabel' => $method->getProperty('phoneLabel'),
'phonePlaceholder' => $phonePlaceholder,
- 'birthdatePlaceholder' => $gateway->paymentMethod()->getProperty('birthdatePlaceholder'),
+ 'birthdatePlaceholder' => $method->getProperty('birthdatePlaceholder'),
+ 'isExpressEnabled' => $gatewayId === 'applepay' && $method->getProperty('mollie_apple_pay_button_enabled_express_checkout') === 'yes',
];
}
$dataToScript['gatewayData'] = $gatewayData;