Skip to content

Commit e797820

Browse files
authored
LYNX-174: Add a config to enable / disable cancellation (#137)
1 parent 53ebba8 commit e797820

File tree

10 files changed

+103
-7
lines changed

10 files changed

+103
-7
lines changed

app/code/Magento/OrderCancellationGraphQl/README.md renamed to app/code/Magento/OrderCancellation/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Magento_OrderCancellationGraphQl module
1+
# Magento_OrderCancellation module
22

3-
This module allows to cancel an order and specify the order cancellation reason using GraphQL. Only orders in `RECEIVED`, `PENDING` or `PROCESSING` statuses can be cancelled and if the customer has paid for the order a refund is processed.
3+
This module allows to cancel an order and specify the order cancellation reason. Only orders in `RECEIVED`, `PENDING` or `PROCESSING` statuses can be cancelled and if the customer has paid for the order a refund is processed.
44

55
This functionality is enabled / disabled by a feature flag that is set at storeView level.
66

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
9+
<page name="AdminOrderCancellationConfigPage" url="admin/system_config/edit/section/sales/" area="admin" module="Magento_OrderCancellationGraphQl">
10+
<section name="AdminOrderCancellationConfigSection"/>
11+
</page>
12+
</pages>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
9+
<section name="AdminOrderCancellationConfigSection">
10+
<element name="valueForSalesCancellation" type="select" selector="#sales_cancellation_enabled"/>
11+
<element name="systemValueForSalesCancellation" type="checkbox" selector="#sales_cancellation_enabled_inherit"/>
12+
</section>
13+
</sections>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminOrderCancellationConfigTest">
11+
<annotations>
12+
<features value="Order Cancellation"/>
13+
<stories value="Enable / disable order cancellation feature through the admin."/>
14+
<title value="Enable / disable order cancellation feature through the admin."/>
15+
<description value="Test feature flag to enable / disable order cancellation through the admin."/>
16+
<severity value="AVERAGE"/>
17+
<testCaseId value="LYNX-174"/>
18+
<group value="configuration"/>
19+
<group value="pr_exclude"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
</before>
24+
<after>
25+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
26+
</after>
27+
<amOnPage url="{{AdminOrderCancellationConfigPage.url('#sales_cancellation-head')}}" stepKey="navigateToConfigurationPage"/>
28+
<waitForPageLoad time="30" stepKey="waitForAdminSalesConfigPageLoad"/>
29+
<uncheckOption selector="{{AdminOrderCancellationConfigSection.systemValueForSalesCancellation}}" stepKey="uncheckUseSystemValue"/>
30+
<selectOption selector="{{AdminOrderCancellationConfigSection.valueForSalesCancellation}}" userInput="1" stepKey="valueForSalesCancellation"/>
31+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/>
32+
</test>
33+
</tests>

app/code/Magento/OrderCancellationGraphQl/composer.json renamed to app/code/Magento/OrderCancellation/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "magento/module-order-cancellation-graph-ql",
2+
"name": "magento/module-order-cancellation",
33
"description": "N/A",
44
"config": {
55
"sort-packages": true
@@ -18,7 +18,7 @@
1818
"registration.php"
1919
],
2020
"psr-4": {
21-
"Magento\\OrderCancellationGraphQl\\": ""
21+
"Magento\\OrderCancellation\\": ""
2222
}
2323
}
2424
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
10+
<system>
11+
<section id="sales">
12+
<group id="cancellation" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
13+
<label>Order cancellation</label>
14+
<field id="enabled" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
15+
<label>Order cancellation through GraphQL</label>
16+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
17+
</field>
18+
</group>
19+
</section>
20+
</system>
21+
</config>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
10+
<default>
11+
<sales>
12+
<cancellation>
13+
<enabled>0</enabled>
14+
</cancellation>
15+
</sales>
16+
</default>
17+
</config>

app/code/Magento/OrderCancellationGraphQl/etc/module.xml renamed to app/code/Magento/OrderCancellation/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_OrderCancellationGraphQl"/>
9+
<module name="Magento_OrderCancellation"/>
1010
</config>

app/code/Magento/OrderCancellationGraphQl/registration.php renamed to app/code/Magento/OrderCancellation/registration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
use Magento\Framework\Component\ComponentRegistrar;
1010

11-
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_OrderCancellationGraphQl', __DIR__);
11+
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_OrderCancellation', __DIR__);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
"magento/module-newsletter-graph-ql": "*",
252252
"magento/module-offline-payments": "*",
253253
"magento/module-offline-shipping": "*",
254-
"magento/module-order-cancellation-graph-ql": "*",
254+
"magento/module-order-cancellation": "*",
255255
"magento/module-page-cache": "*",
256256
"magento/module-payment": "*",
257257
"magento/module-payment-graph-ql": "*",

0 commit comments

Comments
 (0)