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 c4bd673
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Controller/StoreApi/Config/ConfigControllerBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 c4bd673

Please sign in to comment.