From e8a5832d3f6fc0555a89d477d182e3d7607abc81 Mon Sep 17 00:00:00 2001 From: Vitalij Mik Date: Thu, 4 Jul 2024 09:34:37 +0200 Subject: [PATCH] NTR: fix settings --- src/Service/SettingsService.php | 12 ++++-------- src/Subscriber/ApplePayDirectSubscriber.php | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Service/SettingsService.php b/src/Service/SettingsService.php index 019947942..daf499775 100644 --- a/src/Service/SettingsService.php +++ b/src/Service/SettingsService.php @@ -11,7 +11,7 @@ class SettingsService implements PluginSettingsServiceInterface { public const SYSTEM_CONFIG_DOMAIN = 'MolliePayments.config'; - private const SYSTEM_CORE_CONFIG_DOMAIN = 'core'; + private const SYSTEM_CORE_LOGIN_REGISTRATION_CONFIG_DOMAIN = 'core.loginRegistration'; private const PHONE_NUMBER_FIELD_REQUIRED = 'phoneNumberFieldRequired'; const LIVE_API_KEY = 'liveApiKey'; @@ -84,13 +84,9 @@ public function getSettings(?string $salesChannelId = null): MollieSettingStruct } /** @var array $coreSettings */ - $coreSettings = $this->systemConfigService->get(self::SYSTEM_CORE_CONFIG_DOMAIN, $salesChannelId); - foreach ($coreSettings as $key => $value) { - if (strpos($key, self::PHONE_NUMBER_FIELD_REQUIRED)) { - $structData[self::PHONE_NUMBER_FIELD_REQUIRED] = $value; - break; - } - } + $coreSettings = $this->systemConfigService->get(self::SYSTEM_CORE_LOGIN_REGISTRATION_CONFIG_DOMAIN, $salesChannelId); + + $structData[self::PHONE_NUMBER_FIELD_REQUIRED] = $coreSettings[self::PHONE_NUMBER_FIELD_REQUIRED]; return (new MollieSettingStruct())->assign($structData); } diff --git a/src/Subscriber/ApplePayDirectSubscriber.php b/src/Subscriber/ApplePayDirectSubscriber.php index 872da8521..609df5311 100644 --- a/src/Subscriber/ApplePayDirectSubscriber.php +++ b/src/Subscriber/ApplePayDirectSubscriber.php @@ -51,7 +51,7 @@ public function onStorefrontRender(StorefrontRenderEvent $event): void $applePayDirectEnabled = $this->applePay->isApplePayDirectEnabled($event->getSalesChannelContext()); - $event->setParameter('mollie_applepaydirect_phonenumber_required', $settings->isPhoneNumberFieldRequired()); + $event->setParameter('mollie_applepaydirect_phonenumber_required', (int)$settings->isPhoneNumberFieldRequired()); $event->setParameter('mollie_applepaydirect_enabled', $applePayDirectEnabled); $event->setParameter('mollie_applepaydirect_restrictions', $settings->getRestrictApplePayDirect()); }