Skip to content

Commit

Permalink
NTR: add one click payments to headless config
Browse files Browse the repository at this point in the history
  • Loading branch information
boxblinkracer committed Dec 20, 2023
1 parent bb26750 commit e1b9ca9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Controller/StoreApi/Config/ConfigControllerBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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(
Expand Down
4 changes: 3 additions & 1 deletion src/Controller/StoreApi/Config/Response/ConfigResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down
3 changes: 3 additions & 0 deletions tests/Cypress/cypress/e2e/store-api/config.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', '');
});
})

0 comments on commit e1b9ca9

Please sign in to comment.