<?xml version="1.0" encoding="UTF-8"?>
<!--
 /**
  * @copyright  Vertex. All rights reserved.  https://www.vertexinc.com/
  * @author     Mediotype                     https://www.mediotype.com/
  */
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
    <test name="VertexAsRegisteredCustomerInCanadaWithBillToAndShipToTheSameCheckPhysicalProductTaxInAdminPostCreateOrderTest">
        <annotations>
            <features value="Vertex"/>
            <group value="Vertex"/>

            <stories value="As a store owner, I must have accurate taxes calculated for a registered customer"/>
            <title value="Validate Taxes during Admin Order Create, Registered User, Physical Product, Bill-To=Ship-To, VAT Canada"/>
            <description value="Validate that a registered customer with a bill-to and a ship-to that are the same and in Canada receives properly calculated taxes after admin order create"/>

            <severity value="CRITICAL"/>
        </annotations>
        <before>
            <actionGroup ref="VertexCreateGroupedProductActionGroup" stepKey="createGroupedProduct">
                <argument name="basePrice" value="{{Vertex_Grouped_Product_Values.price}}"/>
                <argument name="firstPrice" value="{{Vertex_Grouped_First_Values.price}}"/>
                <argument name="secondPrice" value="{{Vertex_Grouped_Second_Values.price}}"/>
                <argument name="thirdPrice" value="{{Vertex_Grouped_Third_Values.price}}"/>
            </actionGroup>
            <createData entity="VertexCustomerClass_GvtK" stepKey="createTaxClass"/>
            <createData entity="Vertex_CustomerGroup_BlanKetException" stepKey="createCustomerGroup">
                <field key="tax_class_id">$$createTaxClass.return$$</field>
            </createData>
            <createData entity="Vertex_Customer_JohnLucCarre" stepKey="createCustomer">
                <field key="group_id">$$createCustomerGroup.id$$</field>
            </createData>

            <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
        </before>
        <after>
            <deleteData stepKey="deleteFirst" createDataKey="createFirstCreateGroupedProduct"/>
            <deleteData stepKey="deleteSecond" createDataKey="createSecondCreateGroupedProduct"/>
            <deleteData stepKey="deleteThird" createDataKey="createThirdCreateGroupedProduct"/>
            <deleteData stepKey="deleteGroup" createDataKey="createGroupCreateGroupedProduct"/>
            <deleteData stepKey="deleteCategory" createDataKey="createCategoryCreateGroupedProduct"/>
            <deleteData stepKey="deleteCustomerGroup" createDataKey="createCustomerGroup"/>
            <deleteData stepKey="deleteTaxClass" createDataKey="createTaxClass"/>
            <deleteData stepKey="deleteCustomer" createDataKey="createCustomer"/>
            <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
        </after>

        <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="startNewOrder">
            <argument name="customer" value="$$createCustomer$$"/>
        </actionGroup>

        <actionGroup ref="AdminOrderCreateBeginAddingGroupedProductActionGroup" stepKey="startGroupedProduct">
            <argument name="product" value="$$createGroupCreateGroupedProduct$$"/>
            <argument name="exampleOption" value="$$createFirstCreateGroupedProduct$$"/>
        </actionGroup>
        <actionGroup ref="AdminOrderCreateSelectGroupedProductOptionActionGroup" stepKey="addFirstToOrder">
            <argument name="option" value="$$createFirstCreateGroupedProduct$$"/>
        </actionGroup>
        <actionGroup ref="AdminOrderCreateSelectGroupedProductOptionActionGroup" stepKey="addSecondToOrder">
            <argument name="option" value="$$createSecondCreateGroupedProduct$$"/>
        </actionGroup>
        <actionGroup ref="AdminOrderCreateSelectGroupedProductOptionActionGroup" stepKey="addThirdToOrder">
            <argument name="option" value="$$createThirdCreateGroupedProduct$$"/>
        </actionGroup>
        <actionGroup ref="AdminOrderCreateFinishAddingGroupedProductActionGroup" stepKey="finishGroupedProduct"/>

        <actionGroup ref="AdminOrderCreateSelectShippingBillingSameAddressActionGroup" stepKey="selectShippingAddress">
            <argument name="addressId" value="$$createCustomer.addresses[1][id]$$"/>
        </actionGroup>

        <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectShipping"/>

        <actionGroup ref="SelectCheckMoneyPaymentMethodActionGroup" stepKey="selectPayment"/>

        <click stepKey="submitOrder" selector="{{AdminOrderFormActionSection.submitOrder}}"/>
        <actionGroup ref="VertexCheckProductPricingInAdminOrderViewActionGroup" stepKey="checkFirstPricing">
            <argument name="product" value="$$createFirstCreateGroupedProduct$$"/>
            <argument name="priceExclTax" value="{{Vertex_Grouped_CAN_First_Values.price}}"/>
            <argument name="priceInclTax" value="{{Vertex_Grouped_CAN_First_Values.priceInclTax}}"/>
            <argument name="subtotalExclTax" value="{{Vertex_Grouped_CAN_First_Values.subtotal}}"/>
            <argument name="subtotalInclTax" value="{{Vertex_Grouped_CAN_First_Values.subtotalInclTax}}"/>
            <argument name="tax" value="{{Vertex_Grouped_CAN_First_Values.tax}}"/>
            <argument name="taxPercent" value="{{Vertex_Grouped_CAN_First_Values.taxPercent}}"/>
            <argument name="rowTotal" value="{{Vertex_Grouped_CAN_First_Values.subtotalInclTax}}"/>
        </actionGroup>
        <actionGroup ref="VertexCheckProductPricingInAdminOrderViewActionGroup" stepKey="checkSecondPricing">
            <argument name="product" value="$$createSecondCreateGroupedProduct$$"/>
            <argument name="priceExclTax" value="{{Vertex_Grouped_CAN_Second_Values.price}}"/>
            <argument name="priceInclTax" value="{{Vertex_Grouped_CAN_Second_Values.priceInclTax}}"/>
            <argument name="subtotalExclTax" value="{{Vertex_Grouped_CAN_Second_Values.subtotal}}"/>
            <argument name="subtotalInclTax" value="{{Vertex_Grouped_CAN_Second_Values.subtotalInclTax}}"/>
            <argument name="tax" value="{{Vertex_Grouped_CAN_Second_Values.tax}}"/>
            <argument name="taxPercent" value="{{Vertex_Grouped_CAN_Second_Values.taxPercent}}"/>
            <argument name="rowTotal" value="{{Vertex_Grouped_CAN_Second_Values.subtotalInclTax}}"/>
        </actionGroup>
        <actionGroup ref="VertexCheckProductPricingInAdminOrderViewActionGroup" stepKey="checkThirdPricing">
            <argument name="product" value="$$createThirdCreateGroupedProduct$$"/>
            <argument name="priceExclTax" value="{{Vertex_Grouped_CAN_Third_Values.price}}"/>
            <argument name="priceInclTax" value="{{Vertex_Grouped_CAN_Third_Values.priceInclTax}}"/>
            <argument name="subtotalExclTax" value="{{Vertex_Grouped_CAN_Third_Values.subtotal}}"/>
            <argument name="subtotalInclTax" value="{{Vertex_Grouped_CAN_Third_Values.subtotalInclTax}}"/>
            <argument name="tax" value="{{Vertex_Grouped_CAN_Third_Values.tax}}"/>
            <argument name="taxPercent" value="{{Vertex_Grouped_CAN_Third_Values.taxPercent}}"/>
            <argument name="rowTotal" value="{{Vertex_Grouped_CAN_Third_Values.subtotalInclTax}}"/>
        </actionGroup>
        <actionGroup ref="VertexCheckTotalsInAdminOrderViewActionGroup" stepKey="checkTotals">
            <argument name="subtotalExclTax" value="{{Vertex_Grouped_CAN_Product_Totals.subtotal}}"/>
            <argument name="subtotalInclTax" value="{{Vertex_Grouped_CAN_Product_Totals.subtotalInclTax}}"/>
            <argument name="shippingExclTax" value="{{Vertex_Grouped_CAN_Product_Totals.shipping}}"/>
            <argument name="shippingInclTax" value="{{Vertex_Grouped_CAN_Product_Totals.shippingInclTax}}"/>
            <argument name="tax" value="{{Vertex_Grouped_CAN_Product_Totals.tax}}"/>
            <argument name="totalExclTax" value="{{Vertex_Grouped_CAN_Product_Totals.total}}"/>
            <argument name="totalInclTax" value="{{Vertex_Grouped_CAN_Product_Totals.totalInclTax}}"/>
        </actionGroup>
    </test>
</tests>
