From c4bd673ca7c9bea9da06524c7f5486819b80b7d0 Mon Sep 17 00:00:00 2001 From: Christian Dangl Date: Wed, 20 Dec 2023 11:07:34 +0100 Subject: [PATCH] NTR: add one click payments to headless config --- 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', ''); }); })