From e1b9ca9836b7670b0ab85ac88e911b22f9fc1991 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 | 5 +++-- src/Controller/StoreApi/Config/Response/ConfigResponse.php | 4 +++- tests/Cypress/cypress/e2e/store-api/config.cy.js | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Controller/StoreApi/Config/ConfigControllerBase.php b/src/Controller/StoreApi/Config/ConfigControllerBase.php index d7335c766..ffa2be304 100644 --- a/src/Controller/StoreApi/Config/ConfigControllerBase.php +++ b/src/Controller/StoreApi/Config/ConfigControllerBase.php @@ -53,8 +53,8 @@ public function __construct(SettingsService $settingsService, ConfigService $con * @Route("/store-api/mollie/config", name="store-api.mollie.config", methods={"GET"}) * * @param SalesChannelContext $context - * @throws \Exception * @return StoreApiResponse + * @throws \Exception */ public function getConfig(SalesChannelContext $context): StoreApiResponse { @@ -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', ''); }); })