Skip to content

Commit c7bd909

Browse files
committed
MAGETWO-91678: Minimum Order amount required in Admin orders
1 parent b58eb36 commit c7bd909

File tree

6 files changed

+143
-1
lines changed

6 files changed

+143
-1
lines changed

app/code/Magento/Quote/etc/adminhtml/di.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<item name="ShippingMethodValidationRule" xsi:type="object">Magento\Quote\Model\ValidationRules\ShippingMethodValidationRule</item>
1515
<item name="BillingAddressValidationRule" xsi:type="object">Magento\Quote\Model\ValidationRules\BillingAddressValidationRule</item>
1616
<item name="PaymentMethodValidationRule" xsi:type="object">Magento\Quote\Model\ValidationRules\PaymentMethodValidationRule</item>
17-
<item name="MinimumAmountValidationRule" xsi:type="object">Magento\Quote\Model\ValidationRules\MinimumAmountValidationRule</item>
1817
</argument>
1918
</arguments>
2019
</type>

app/code/Magento/Quote/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
<item name="ShippingMethodValidationRule" xsi:type="object">Magento\Quote\Model\ValidationRules\ShippingMethodValidationRule</item>
105105
<item name="BillingAddressValidationRule" xsi:type="object">Magento\Quote\Model\ValidationRules\BillingAddressValidationRule</item>
106106
<item name="PaymentMethodValidationRule" xsi:type="object">Magento\Quote\Model\ValidationRules\PaymentMethodValidationRule</item>
107+
<item name="MinimumAmountValidationRule" xsi:type="object">Magento\Quote\Model\ValidationRules\MinimumAmountValidationRule</item>
107108
</argument>
108109
</arguments>
109110
</type>

app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@
2222
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/>
2323
</actionGroup>
2424

25+
<!--Navigate to create order page (New Order -> Create New Customer)-->
26+
<actionGroup name="navigateToNewOrderPageNewCustomerSingleStore">
27+
<arguments>
28+
<argument name="storeView" defaultValue="_defaultStore"/>
29+
</arguments>
30+
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/>
31+
<waitForPageLoad stepKey="waitForIndexPageLoad"/>
32+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/>
33+
<click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/>
34+
<click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/>
35+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/>
36+
</actionGroup>
37+
2538
<!--Navigate to create order page (New Order -> Select Customer)-->
2639
<actionGroup name="navigateToNewOrderPageExistingCustomer">
2740
<arguments>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
10+
<entity name="EnabledMinimumOrderAmount" type="sales_minimum_order">
11+
<requiredEntity type="active">EnableMinimumOrderCheck</requiredEntity>
12+
<requiredEntity type="amount">MinimumOrderAmount</requiredEntity>
13+
</entity>
14+
<entity name="EnableMinimumOrderCheck" type="active">
15+
<data key="value">1</data>
16+
</entity>
17+
<entity name="MinimumOrderAmount" type="amount">
18+
<data key="value">500</data>
19+
</entity>
20+
21+
<entity name="DisabledMinimumOrderAmount" type="sales_minimum_order">
22+
<requiredEntity type="active">DisableMinimumOrderCheck</requiredEntity>
23+
</entity>
24+
<entity name="DisableMinimumOrderCheck" type="active">
25+
<data key="value">0</data>
26+
</entity>
27+
</entities>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
9+
<operation name="SetSalesMinimumOrder" dataType="sales_minimum_order" type="create" auth="adminFormKey" url="/admin/system_config/save/section/sales/" method="POST">
10+
<object key="groups" dataType="sales_minimum_order">
11+
<object key="minimum_order" dataType="sales_minimum_order">
12+
<object key="fields" dataType="sales_minimum_order">
13+
<object key="active" dataType="active">
14+
<field key="value">string</field>
15+
</object>
16+
<object key="amount" dataType="amount">
17+
<field key="value">string</field>
18+
</object>
19+
</object>
20+
</object>
21+
</object>
22+
</operation>
23+
</operations>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateOrderWithMinimumAmountEnabledTest">
11+
<annotations>
12+
<features value="Sales"/>
13+
<stories value="Admin create order"/>
14+
<title value="Admin order is not restricted by 'Minimum Order Amount' configuration."/>
15+
<description value="Admin should be able to create an order regardless of the minimum order amount."/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-92925"/>
18+
<group value="sales"/>
19+
</annotations>
20+
<before>
21+
<createData entity="EnabledMinimumOrderAmount" stepKey="enableMinimumOrderAmount"/>
22+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
23+
<createData entity="SimpleProduct" stepKey="createProduct">
24+
<requiredEntity createDataKey="createCategory"/>
25+
</createData>
26+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
27+
<actionGroup ref="ClearCacheActionGroup" stepKey="clearCacheBefore"/>
28+
</before>
29+
<after>
30+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
31+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
32+
<createData entity="DisabledMinimumOrderAmount" stepKey="disableMinimumOrderAmount"/>
33+
<actionGroup ref="ClearCacheActionGroup" stepKey="clearCacheAfter"/>
34+
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
35+
</after>
36+
37+
<!--Admin creates order-->
38+
<comment userInput="Admin creates order" stepKey="adminCreateOrder"/>
39+
<actionGroup ref="navigateToNewOrderPageNewCustomerSingleStore" stepKey="navigateToNewOrderPage"/>
40+
41+
<actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder">
42+
<argument name="product" value="SimpleProduct"/>
43+
</actionGroup>
44+
45+
<!--Fill customer group information-->
46+
<selectOption selector="{{AdminOrderFormAccountSection.group}}" userInput="{{GeneralCustomerGroup.code}}" stepKey="selectGroup"/>
47+
<fillField selector="{{AdminOrderFormAccountSection.email}}" userInput="{{Simple_US_Customer.email}}" stepKey="fillEmail"/>
48+
49+
<!--Fill customer address information-->
50+
<actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress">
51+
<argument name="customer" value="Simple_US_Customer"/>
52+
<argument name="address" value="US_Address_TX"/>
53+
</actionGroup>
54+
55+
<actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping"/>
56+
57+
<!--Verify totals on Order page-->
58+
<see selector="{{AdminOrderFormTotalSection.total('Subtotal')}}" userInput="${{AdminOrderSimpleProduct.subtotal}}" stepKey="seeOrderSubTotal"/>
59+
<see selector="{{AdminOrderFormTotalSection.total('Shipping')}}" userInput="${{AdminOrderSimpleProduct.shipping}}" stepKey="seeOrderShipping"/>
60+
<see selector="{{AdminOrderFormTotalSection.grandTotal}}" userInput="${{AdminOrderSimpleProduct.grandTotal}}" stepKey="seeCorrectGrandTotal"/>
61+
62+
<!--Submit Order and verify information-->
63+
<click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="clickSubmitOrder"/>
64+
<seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPage"/>
65+
66+
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage"/>
67+
<see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeOrderPendingStatus"/>
68+
<grabTextFrom selector="|Order # (\d+)|" stepKey="orderId"/>
69+
<assertNotEmpty actual="$orderId" stepKey="assertOrderIdIsNotEmpty"/>
70+
<actionGroup ref="verifyBasicOrderInformation" stepKey="verifyOrderInformation">
71+
<argument name="customer" value="Simple_US_Customer"/>
72+
<argument name="shippingAddress" value="US_Address_TX"/>
73+
<argument name="billingAddress" value="US_Address_TX"/>
74+
</actionGroup>
75+
<actionGroup ref="seeProductInItemsOrdered" stepKey="seeSimpleProductInItemsOrdered">
76+
<argument name="product" value="SimpleProduct"/>
77+
</actionGroup>
78+
</test>
79+
</tests>

0 commit comments

Comments
 (0)