Skip to content

Commit 8e0eec7

Browse files
authored
Merge pull request #332 from deepak-soni1/LYNX-753
LYNX-753: Deliver Terms & Conditions configuration in StoreConfig
2 parents 5148419 + 0f7807b commit 8e0eec7

File tree

3 files changed

+45
-38
lines changed

3 files changed

+45
-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: 41 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,52 @@ 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+
[
51+
'storeConfig' => [
52+
'is_guest_checkout_enabled' => true,
53+
'is_one_page_checkout_enabled' => true,
54+
'max_items_in_order_summary' => self::MAX_ITEMS_TO_DISPLAY,
55+
'cart_summary_display_quantity' => self::CART_SUMMARY_DISPLAY_TOTAL,
56+
'minicart_display' => true,
57+
'minicart_max_items' => self::MINICART_MAX_ITEMS,
58+
'cart_expires_in_days' => self::CART_EXPIRES_IN_DAYS,
59+
'grouped_product_image' => 'PARENT',
60+
'configurable_product_image' => 'ITSELF',
61+
'is_checkout_agreements_enabled' => true,
62+
],
63+
],
64+
$this->graphQlQuery($this->getStoreConfigQuery())
65+
);
6766
}
6867

6968
/**
70-
* Validate Store Config Data
69+
* Generates storeConfig query
7170
*
72-
* @param array $responseConfig
71+
* @return string
7372
*/
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']);
73+
private function getStoreConfigQuery(): string
74+
{
75+
return <<<QUERY
76+
{
77+
storeConfig {
78+
is_guest_checkout_enabled
79+
is_one_page_checkout_enabled
80+
max_items_in_order_summary
81+
cart_summary_display_quantity
82+
minicart_display
83+
minicart_max_items
84+
cart_expires_in_days
85+
grouped_product_image
86+
configurable_product_image
87+
is_checkout_agreements_enabled
88+
}
89+
}
90+
QUERY;
8691
}
8792
}

0 commit comments

Comments
 (0)