<?xml version="1.0" encoding="utf-8" ?>
<!--
  @copyright  Vertex. All rights reserved.  https://www.vertexinc.com/
  @author     Mediotype                     https://www.mediotype.com/
  -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Customer\Api\Data\CustomerInterface">
        <attribute code="vertex_customer_code" type="string"/>
        <attribute code="vertex_customer_country" type="string"/>
    </extension_attributes>
    <extension_attributes for="Magento\Tax\Api\Data\QuoteDetailsItemInterface">
        <!-- @api For all QuoteDetailsItemInterface extension attributes -->
        <attribute code="vertex_product_code" type="string"/>
        <attribute code="vertex_is_configurable" type="bool"/>
        <attribute code="is_virtual" type="bool"/>
        <attribute code="store_id" type="string"/>
        <attribute code="quote_id" type="string"/>
        <attribute code="product_id" type="string"/>
        <attribute code="quote_item_id" type="string"/>
        <attribute code="customer_id" type="string"/>
        <attribute code="vertex_commodity_code" type="Vertex\Tax\Model\Data\CommodityCodeProduct"/>
    </extension_attributes>
    <extension_attributes for="Magento\Sales\Api\Data\OrderAddressInterface">
        <attribute code="vertex_vat_country_code" type="string"/>
    </extension_attributes>
    <extension_attributes for="Magento\Sales\Api\Data\OrderItemInterface">
        <attribute code="vertex_tax_codes" type="string[]"/>
        <attribute code="invoice_text_codes" type="string[]"/>
        <attribute code="tax_codes" type="string[]"/>
    </extension_attributes>
    <extension_attributes for="Magento\Sales\Api\Data\CreditmemoItemInterface">
        <attribute code="vertex_tax_codes" type="string[]"/>
        <attribute code="invoice_text_codes" type="string[]"/>
        <attribute code="tax_codes" type="string[]"/>
    </extension_attributes>
    <extension_attributes for="Magento\Sales\Api\Data\InvoiceItemInterface">
        <attribute code="vertex_tax_codes" type="string[]"/>
        <attribute code="invoice_text_codes" type="string[]"/>
        <attribute code="tax_codes" type="string[]"/>
    </extension_attributes>
    <extension_attributes for="Magento\Quote\Api\Data\TotalSegmentInterface">
        <attribute code="vertex_tax_calculation_messages" type="string[]"/>
    </extension_attributes>

    <extension_attributes for="Magento\Catalog\Api\Data\ProductCustomOptionInterface">
        <attribute code="vertex_flex_field" type="string"/>
    </extension_attributes>

    <extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
        <attribute code="vertex_commodity_code" type="Vertex\Tax\Api\Data\CommodityCodeInterface"/>
    </extension_attributes>

    <extension_attributes for="Magento\Sales\Api\Data\OrderItemInterface">
        <attribute code="vertex_commodity_code" type="Vertex\Tax\Api\Data\CommodityCodeInterface"/>
    </extension_attributes>

    <!-- Passes data to InvoiceProcessors during invoice save event -->
    <extension_attributes for="Magento\Sales\Api\Data\InvoiceInterface">
        <attribute code="vertex_tax_calculation_shipping_address" type="Magento\Sales\Api\Data\OrderAddressInterface"/>
        <attribute code="vertex_tax_calculation_billing_address" type="Magento\Sales\Api\Data\OrderAddressInterface"/>
        <attribute code="vertex_tax_calculation_order" type="Magento\Sales\Api\Data\OrderInterface"/>
    </extension_attributes>

    <!-- For compatibility with Magento 2.1 -->
    <extension_attributes for="Magento\Sales\Api\Data\InvoiceInterface">
        <attribute code="gw_base_price" type="string"/>
        <attribute code="gw_price" type="string"/>
        <attribute code="gw_items_base_price" type="string"/>
        <attribute code="gw_items_price" type="string"/>
        <attribute code="gw_card_base_price" type="string"/>
        <attribute code="gw_card_price" type="string"/>
        <attribute code="gw_base_tax_amount" type="string"/>
        <attribute code="gw_tax_amount" type="string"/>
        <attribute code="gw_items_base_tax_amount" type="string"/>
        <attribute code="gw_items_tax_amount" type="string"/>
        <attribute code="gw_card_base_tax_amount" type="string"/>
        <attribute code="gw_card_tax_amount" type="string"/>
    </extension_attributes>
    <extension_attributes for="Magento\Sales\Api\Data\CreditmemoInterface">
        <attribute code="gw_base_price" type="string"/>
        <attribute code="gw_price" type="string"/>
        <attribute code="gw_items_base_price" type="string"/>
        <attribute code="gw_items_price" type="string"/>
        <attribute code="gw_card_base_price" type="string"/>
        <attribute code="gw_card_price" type="string"/>
        <attribute code="gw_base_tax_amount" type="string"/>
        <attribute code="gw_tax_amount" type="string"/>
        <attribute code="gw_items_base_tax_amount" type="string"/>
        <attribute code="gw_items_tax_amount" type="string"/>
        <attribute code="gw_card_base_tax_amount" type="string"/>
        <attribute code="gw_card_tax_amount" type="string"/>
    </extension_attributes>
    <!-- End Compatibility -->
</config>
