From 8b464a8b09d702bd10a4b018c56f0981582bc6fe Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 20 Dec 2023 11:34:20 +0100 Subject: [PATCH] NTR: add one click payments to headless config (#672) --- src/Controller/StoreApi/Config/ConfigControllerBase.php | 3 ++- src/Controller/StoreApi/Config/Response/ConfigResponse.php | 4 +++- tests/Cypress/cypress/e2e/store-api/config.cy.js | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Controller/StoreApi/Config/ConfigControllerBase.php b/src/Controller/StoreApi/Config/ConfigControllerBase.php index d7335c766..b46f70e36 100644 --- a/src/Controller/StoreApi/Config/ConfigControllerBase.php +++ b/src/Controller/StoreApi/Config/ConfigControllerBase.php @@ -78,7 +78,8 @@ public function getConfig(SalesChannelContext $context): StoreApiResponse return new ConfigResponse( $profileId, $settings->isTestMode(), - $locale + $locale, + $settings->isOneClickPaymentsEnabled() ); } catch (\Exception $e) { $this->logger->error( diff --git a/src/Controller/StoreApi/Config/Response/ConfigResponse.php b/src/Controller/StoreApi/Config/Response/ConfigResponse.php index 37565db8a..aff8a3ac7 100644 --- a/src/Controller/StoreApi/Config/Response/ConfigResponse.php +++ b/src/Controller/StoreApi/Config/Response/ConfigResponse.php @@ -17,14 +17,16 @@ class ConfigResponse extends StoreApiResponse * @param string $profileId * @param bool $isTestMode * @param string $defaultLocale + * @param bool $oneClickEnabled */ - public function __construct(string $profileId, bool $isTestMode, string $defaultLocale) + public function __construct(string $profileId, bool $isTestMode, string $defaultLocale, bool $oneClickEnabled) { $this->object = new ArrayStruct( [ 'profileId' => $profileId, 'testMode' => $isTestMode, 'locale' => $defaultLocale, + 'oneClickPayments' => $oneClickEnabled, ], 'mollie_payments_config' ); diff --git a/tests/Cypress/cypress/e2e/store-api/config.cy.js b/tests/Cypress/cypress/e2e/store-api/config.cy.js index ec78ef665..3285db595 100644 --- a/tests/Cypress/cypress/e2e/store-api/config.cy.js +++ b/tests/Cypress/cypress/e2e/store-api/config.cy.js @@ -25,6 +25,9 @@ it('C2040032: Mollie Config can be retrieved using Store-API', () => { cy.wrap(response).its('locale').should('exist'); cy.wrap(response).its('locale').should('not.eql', ''); + + cy.wrap(response).its('oneClickPayments').should('exist'); + cy.wrap(response).its('oneClickPayments').should('not.eql', ''); }); })