Skip to content

Commit 1844ae8

Browse files
committed
LYNX-753: Deliver Terms & Conditions configuration in StoreConfig
1 parent 2b17d9b commit 1844ae8

File tree

3 files changed

+42
-38
lines changed

3 files changed

+42
-38
lines changed

app/code/Magento/QuoteGraphQl/etc/graphql/di.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
@@ -72,6 +72,7 @@
7272
<item name="cart_expires_in_days" xsi:type="string">checkout/cart/delete_quote_after</item>
7373
<item name="grouped_product_image" xsi:type="string">checkout/cart/grouped_product_image</item>
7474
<item name="configurable_product_image" xsi:type="string">checkout/cart/configurable_product_image</item>
75+
<item name="is_checkout_agreements_enabled" xsi:type="string">checkout/options/enable_agreements</item>
7576
</argument>
7677
</arguments>
7778
</type>

app/code/Magento/QuoteGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ type StoreConfig {
533533
cart_expires_in_days: Int @doc(description: "checkout/cart/delete_quote_after: quote lifetime in days.")
534534
grouped_product_image: ProductImageThumbnail! @doc(description: "checkout/cart/grouped_product_image: which image to use for grouped products.") @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\StoreConfig")
535535
configurable_product_image: ProductImageThumbnail! @doc(description: "checkout/cart/configurable_product_image: which image to use for configurable products.") @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\StoreConfig")
536+
is_checkout_agreements_enabled: Boolean! @doc(description: "Configuration data from checkout/options/enable_agreements")
536537
}
537538

538539
enum ProductImageThumbnail {
Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -41,47 +41,49 @@ class StoreConfigResolverTest extends GraphQlAbstract
4141
'default'
4242
),
4343
ConfigFixture('checkout/cart/grouped_product_image', 'parent', ScopeInterface::SCOPE_STORE, 'default'),
44-
ConfigFixture('checkout/cart/configurable_product_image', 'itself', ScopeInterface::SCOPE_STORE, 'default')
44+
ConfigFixture('checkout/cart/configurable_product_image', 'itself', ScopeInterface::SCOPE_STORE, 'default'),
45+
ConfigFixture('checkout/options/enable_agreements', true, ScopeInterface::SCOPE_STORE, 'default')
4546
]
4647
public function testGetStoreConfig(): void
4748
{
48-
$query
49-
= <<<QUERY
50-
{
51-
storeConfig {
52-
is_guest_checkout_enabled,
53-
is_one_page_checkout_enabled,
54-
max_items_in_order_summary,
55-
cart_summary_display_quantity,
56-
minicart_display,
57-
minicart_max_items,
58-
cart_expires_in_days,
59-
grouped_product_image,
60-
configurable_product_image
61-
}
62-
}
63-
QUERY;
64-
$response = $this->graphQlQuery($query);
65-
$this->assertArrayHasKey('storeConfig', $response);
66-
$this->validateStoreConfig($response['storeConfig']);
49+
$this->assertEquals([
50+
'storeConfig' => [
51+
'is_guest_checkout_enabled' => true,
52+
'is_one_page_checkout_enabled' => true,
53+
'max_items_in_order_summary' => self::MAX_ITEMS_TO_DISPLAY,
54+
'cart_summary_display_quantity' => self::CART_SUMMARY_DISPLAY_TOTAL,
55+
'minicart_display' => true,
56+
'minicart_max_items' => self::MINICART_MAX_ITEMS,
57+
'cart_expires_in_days' => self::CART_EXPIRES_IN_DAYS,
58+
'grouped_product_image' => 'PARENT',
59+
'configurable_product_image' => 'ITSELF',
60+
'is_checkout_agreements_enabled' => true
61+
]
62+
], $this->graphQlQuery($this->getStoreConfigQuery()));
6763
}
6864

6965
/**
70-
* Validate Store Config Data
66+
* Generates storeConfig query
7167
*
72-
* @param array $responseConfig
68+
* @return string
7369
*/
74-
private function validateStoreConfig(
75-
array $responseConfig,
76-
): void {
77-
$this->assertTrue($responseConfig['is_guest_checkout_enabled']);
78-
$this->assertTrue($responseConfig['is_one_page_checkout_enabled']);
79-
$this->assertEquals(self::MAX_ITEMS_TO_DISPLAY, $responseConfig['max_items_in_order_summary']);
80-
$this->assertEquals(self::CART_SUMMARY_DISPLAY_TOTAL, $responseConfig['cart_summary_display_quantity']);
81-
$this->assertTrue($responseConfig['minicart_display']);
82-
$this->assertEquals(self::MINICART_MAX_ITEMS, $responseConfig['minicart_max_items']);
83-
$this->assertEquals(self::CART_EXPIRES_IN_DAYS, $responseConfig['cart_expires_in_days']);
84-
$this->assertEquals('PARENT', $responseConfig['grouped_product_image']);
85-
$this->assertEquals('ITSELF', $responseConfig['configurable_product_image']);
70+
private function getStoreConfigQuery(): string
71+
{
72+
return <<<QUERY
73+
{
74+
storeConfig {
75+
is_guest_checkout_enabled
76+
is_one_page_checkout_enabled
77+
max_items_in_order_summary
78+
cart_summary_display_quantity
79+
minicart_display
80+
minicart_max_items
81+
cart_expires_in_days
82+
grouped_product_image
83+
configurable_product_image
84+
is_checkout_agreements_enabled
85+
}
86+
}
87+
QUERY;
8688
}
8789
}

0 commit comments

Comments
 (0)