Skip to content

Commit

Permalink
NTR: fix settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalij Mik committed Jul 4, 2024
1 parent 72be783 commit e8a5832
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions src/Service/SettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -84,13 +84,9 @@ public function getSettings(?string $salesChannelId = null): MollieSettingStruct
}

/** @var array<mixed> $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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Subscriber/ApplePayDirectSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit e8a5832

Please sign in to comment.