Your IP : 127.0.0.1


Current Path : /home/dev2.destoffenstraat.com/app/code/TIG/PostNL/etc/
Upload File :
Current File : /home/dev2.destoffenstraat.com/app/code/TIG/PostNL/etc/di.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
 *
 *
 *          ..::..
 *     ..::::::::::::..
 *   ::'''''':''::'''''::
 *   ::..  ..:  :  ....::
 *   ::::  :::  :  :   ::
 *   ::::  :::  :  ''' ::
 *   ::::..:::..::.....::
 *     ''::::::::::::''
 *          ''::''
 *
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Creative Commons License.
 * It is available through the world-wide-web at this URL:
 * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
 * If you are unable to obtain it through the world-wide-web, please send an email
 * to servicedesk@tig.nl so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade this module to newer
 * versions in the future. If you wish to customize this module for your
 * needs please contact servicedesk@tig.nl for more information.
 *
 * @copyright   Copyright (c) Total Internet Group B.V. https://tig.nl/copyright
 * @license     http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
 *
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="TIG\PostNL\Api\MatrixrateRepositoryInterface" type="TIG\PostNL\Model\Carrier\MatrixrateRepository" />
    <preference for="TIG\PostNL\Api\OrderRepositoryInterface" type="TIG\PostNL\Model\OrderRepository" />
    <preference for="TIG\PostNL\Api\Data\OrderInterface" type="TIG\PostNL\Model\Order" />
    <preference for="TIG\PostNL\Api\ShipmentRepositoryInterface" type="TIG\PostNL\Model\ShipmentRepository" />
    <preference for="TIG\PostNL\Api\Data\ShipmentInterface" type="TIG\PostNL\Model\Shipment" />
    <preference for="TIG\PostNL\Api\ShipmentBarcodeRepositoryInterface" type="TIG\PostNL\Model\ShipmentBarcodeRepository" />
    <preference for="TIG\PostNL\Api\ShipmentLabelRepositoryInterface" type="TIG\PostNL\Model\ShipmentLabelRepository" />
    <preference for="TIG\PostNL\Api\ShipmentManagementInterface" type="TIG\PostNL\Service\Api\ShipmentManagement" />
    <preference for="TIG\PostNL\Service\Wrapper\QuoteInterface" type="TIG\PostNL\Service\Wrapper\Quote" />
    <preference for="TIG\PostNL\Service\Wrapper\StoreInterface" type="TIG\PostNL\Service\Wrapper\Store" />
    <preference for="TIG\PostNL\Service\Wrapper\CheckoutSessionInterface" type="TIG\PostNL\Service\Wrapper\CheckoutSession" />
    <preference for="\Magento\Framework\Mail\Template\TransportBuilder" type="TIG\PostNL\Model\Mail\Template\TransportBuilder" />

    <type name="\Magento\Sales\Model\Order">
        <plugin name="TIG_PostNL_Order_Shipment" type="TIG\PostNL\Plugin\Order\ShipmentPlugin" sortOrder="1"/>
        <plugin name="TIG_PostNL_Order_Shipping_Address" type="TIG\PostNL\Plugin\Order\ShippingAddress" sortOrder="2"/>
    </type>

    <type name="\Magento\Quote\Model\Quote">
        <plugin name="TIG_PostNL_Quote_RestDeliveryDate" type="\TIG\PostNL\Plugin\Quote\ResetDeliveryDate" sortOrder="1"/>
    </type>

    <type name="\Magento\Shipping\Model\Config\Source\Allmethods">
        <plugin name="TIG_PostNL_Config_Source_Allmethods" type="TIG\PostNL\Plugin\Config\Source\AllMethodsPlugin" sortOrder="1"/>
    </type>

    <type name="\Magento\Quote\Model\Quote\Address\RateRequest">
        <plugin name="TIG_PostNL_Address_RateRequest" type="TIG\PostNL\Plugin\Quote\Address\RateRequestPlugin" sortOrder="1"/>
    </type>

   <type name="Magento\Quote\Model\ShippingAddressManagement">
        <plugin name="postnlShippingAddressManagement" type="TIG\PostNL\Plugin\Postcodecheck\Management\Shipping"/>
    </type>

    <type name="Magento\Quote\Model\BillingAddressManagement">
        <plugin name="postnlBillingAddressManagement" type="TIG\PostNL\Plugin\Postcodecheck\Management\Billing"/>
    </type>

    <type name="Magento\Checkout\Model\GuestPaymentInformationManagement">
        <plugin name="postcodeGuestPaymentInformationManagement" type="TIG\PostNL\Plugin\Postcodecheck\Management\GuestPayment"/>
    </type>

    <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="postcodePaymentInformationManagement" type="TIG\PostNL\Plugin\Postcodecheck\Management\Payment" />
    </type>

    <type name="Magento\Customer\Model\Metadata\Form">
        <plugin name="postcodeCustomerForm" type="TIG\PostNL\Plugin\Postcodecheck\Management\CustomerForm" />
    </type>

    <type name="TIG\PostNL\Logging\Log">
        <arguments>
            <argument name="name" xsi:type="string">postnl_logging</argument>
            <argument name="handlers"  xsi:type="array">
                <item name="exception" xsi:type="object">TIG\PostNL\Logging\CriticalHandler</item>
                <item name="debug" xsi:type="object">TIG\PostNL\Logging\DebugHandler</item>
            </argument>
        </arguments>
    </type>

    <type name="TIG\PostNL\Setup\InstallSchema">
        <arguments>
            <argument name="installSchemaObjects" xsi:type="array">
                <item name="v1.1.0" xsi:type="array">
                    <item name="InstallShipmentTable" xsi:type="object">TIG\PostNL\Setup\V110\Schema\InstallShipmentTable</item>
                    <item name="InstallOrderTable" xsi:type="object">TIG\PostNL\Setup\V110\Schema\InstallOrderTable</item>
                    <item name="InstallShipmentLabelTable" xsi:type="object">TIG\PostNL\Setup\V110\Schema\InstallShipmentLabelTable</item>
                    <item name="InstallShipmentBarcodeTable" xsi:type="object">TIG\PostNL\Setup\V110\Schema\InstallShipmentBarcodeTable</item>
                    <item name="InstallTablerateTable" xsi:type="object">TIG\PostNL\Setup\V110\Schema\InstallTablerateTable</item>
                    <item name="SalesShipmentGridColumns" xsi:type="object">TIG\PostNL\Setup\V110\Schema\SalesShipmentGridColumns</item>
                    <item name="SalesOrderGridColumns" xsi:type="object">TIG\PostNL\Setup\V110\Schema\SalesOrderGridColumns</item>
                </item>
            </argument>
        </arguments>
    </type>

    <type name="TIG\PostNL\Setup\UpgradeSchema">
        <arguments>
            <argument name="upgradeSchemaObjects" xsi:type="array">
                <item name="v1.9.1" xsi:type="array">
                    <item name="InstallStatedAddressOnly" xsi:type="object">TIG\PostNL\Setup\V191\Schema\InstallStatedAddressOnly</item>
                </item>
                <item name="v1.9.0" xsi:type="array">
                    <item name="InstallReturnBarcode" xsi:type="object">TIG\PostNL\Setup\V190\Schema\InstallReturnBarcode</item>
                    <item name="InstallReturnLabel" xsi:type="object">TIG\PostNL\Setup\V190\Schema\InstallReturnLabel</item>
                </item>
                <item name="v1.8.2" xsi:type="array">
                    <item name="ModifyConditionNameColumn" xsi:type="object">TIG\PostNL\Setup\V182\Schema\ModifyConditionNameColumn</item>
                </item>
                <item name="v1.8.0" xsi:type="array">
                    <item name="InstallPriorityAttribute" xsi:type="object">TIG\PostNL\Setup\V180\Schema\InstallPriorityAttribute</item>
                </item>
                <item name="v1.7.4" xsi:type="array">
                    <item name="InstallDownpartnerAttributes" xsi:type="object">TIG\PostNL\Setup\V174\Schema\InstallDownpartnerAttributes</item>
                </item>
                <item name="v1.6.1" xsi:type="array">
                    <item name="UpgradeShipmentLabelTable" xsi:type="object">TIG\PostNL\Setup\V161\Schema\UpgradeShipmentLabelTable</item>
                </item>
                <item name="v1.5.3" xsi:type="array">
                    <item name="SalesShipmentGridColumns" xsi:type="object">TIG\PostNL\Setup\V153\Schema\SalesShipmentGridColumns</item>
                </item>
                <item name="v1.5.2" xsi:type="array">
                    <item name="SalesShipmentGridColumns" xsi:type="object">TIG\PostNL\Setup\V152\Schema\SalesShipmentGridColumns</item>
                    <item name="SalesOrderGridColumns" xsi:type="object">TIG\PostNL\Setup\V152\Schema\SalesOrderGridColumns</item>
                    <item name="UpgradeOrderTable" xsi:type="object">TIG\PostNL\Setup\V152\Schema\UpgradeOrderTable</item>
                    <item name="UpgradeShipmentTable" xsi:type="object">TIG\PostNL\Setup\V152\Schema\UpgradeShipmentTable</item>
                </item>
                <item name="v1.4.1" xsi:type="array">
                    <item name="UpgradeOrderTable" xsi:type="object">TIG\PostNL\Setup\V141\Schema\UpgradeOrderTable</item>
                </item>
                <item name="v1.4.0" xsi:type="array">
                    <item name="UpgradeShippingLabelType" xsi:type="object">TIG\PostNL\Setup\V140\Schema\UpgradeShippingLabelType</item>
                </item>
                <item name="v1.3.1" xsi:type="array">
                    <item name="UpgradeOrderTable" xsi:type="object">TIG\PostNL\Setup\V131\Schema\UpgradeOrderTable</item>
                    <item name="UpgradeShipmentTable" xsi:type="object">TIG\PostNL\Setup\V131\Schema\UpgradeShipmentTable</item>
                </item>
                <item name="v1.3.0" xsi:type="array">
                    <item name="UpgradeOrderTable" xsi:type="object">TIG\PostNL\Setup\V130\Schema\UpgradeForeignKeysOrderTable</item>
                </item>
                <item name="v1.2.0" xsi:type="array">
                    <item name="SalesShipmentGridColumns" xsi:type="object">TIG\PostNL\Setup\V120\Schema\SalesShipmentGridColumns</item>
                    <item name="SalesOrderGridColumns" xsi:type="object">TIG\PostNL\Setup\V120\Schema\SalesOrderGridColumns</item>
                    <item name="UpgradeOrderTable" xsi:type="object">TIG\PostNL\Setup\V120\Schema\UpgradeOrderTable</item>
                    <item name="InstallMatrixRateTable" xsi:type="object">TIG\PostNL\Setup\V120\Schema\InstallMatrixRateTable</item>
                </item>
                <item name="v1.12.5" xsi:type="array">
                    <item name="InstallSmartReturnBarcode" xsi:type="object">TIG\PostNL\Setup\V1125\Schema\InstallSmartReturnBarcode</item>
                    <item name="InstallSmartReturnLabel" xsi:type="object">TIG\PostNL\Setup\V1125\Schema\InstallSmartReturnLabel</item>
                    <item name="InstallIsSmartReturn" xsi:type="object">TIG\PostNL\Setup\V1125\Schema\InstallIsSmartReturn</item>
                    <item name="InstallSmartReturnEmailSent" xsi:type="object">TIG\PostNL\Setup\V1125\Schema\InstallSmartReturnEmailSent</item>
                </item>
            </argument>
        </arguments>
    </type>

    <type name="TIG\PostNL\Setup\InstallData">
        <arguments>
            <argument name="installDataObjects" xsi:type="array">
                <item name="v1.2.0" xsi:type="array">
                    <item name="InstallCustomProductAttributes" xsi:type="object">TIG\PostNL\Setup\V120\Data\CustomProductAttributes</item>
                </item>
                <item name="v1.4.1" xsi:type="array">
                    <item name="InstallShippingDurationAttribute" xsi:type="object">TIG\PostNL\Setup\V141\Data\ShippingDurationAttribute</item>
                </item>
                <item name="v1.6.0" xsi:type="array">
                    <item name="ConfigurationData" xsi:type="object">TIG\PostNL\Setup\V160\Data\ConfigurationData</item>
                </item>
            </argument>
        </arguments>
    </type>

    <type name="TIG\PostNL\Setup\UpgradeData">
        <arguments>
            <argument name="upgradeDataObjects" xsi:type="array">
                <item name="v1.2.0" xsi:type="array">
                    <item name="InstallCustomProductAttributes" xsi:type="object">TIG\PostNL\Setup\V120\Data\CustomProductAttributes</item>
                </item>
                <item name="v1.4.1" xsi:type="array">
                    <item name="InstallShippingDurationAttribute" xsi:type="object">TIG\PostNL\Setup\V141\Data\ShippingDurationAttribute</item>
                </item>
                <item name="v1.6.0" xsi:type="array">
                    <item name="ConfigurationData" xsi:type="object">TIG\PostNL\Setup\V160\Data\ConfigurationData</item>
                </item>
                <item name="v1.7.2" xsi:type="array">
                    <item name="UpdateCustomProductAttributes" xsi:type="object">TIG\PostNL\Setup\V172\Data\UpdateCustomProductAttributes</item>
                </item>
                <item name="v1.8.1" xsi:type="array">
                    <item name="UpdateConfigData" xsi:type="object">TIG\PostNL\Setup\V181\Data\UpdateConfigData</item>
                </item>
                <item name="v1.9.1" xsi:type="array">
                    <item name="InstallDisableDeliveryDaysAttribute" xsi:type="object">TIG\PostNL\Setup\V191\Data\InstallDisableDeliveryDaysAttribute</item>
                </item>
                <item name="v1.9.4" xsi:type="array">
                    <item name="InstallMaximumQuantityLetterboxPackage" xsi:type="object">TIG\PostNL\Setup\V194\Data\InstallMaximumQuantityLetterboxPackage</item>
                </item>
            </argument>
        </arguments>
    </type>

    <type name="Magento\Framework\Console\CommandList">
        <arguments>
            <argument name="commands" xsi:type="array">
                <item name="postnlSyncGrids" xsi:type="object">TIG\PostNL\Console\Sync\Grids</item>
            </argument>
        </arguments>
    </type>

    <virtualType name="PostNLShipmentGridAggregator" type="Magento\Sales\Model\ResourceModel\Grid">
        <arguments>
            <argument name="mainTableName" xsi:type="string">sales_shipment</argument>
            <argument name="gridTableName" xsi:type="string">sales_shipment_grid</argument>
            <argument name="orderIdField" xsi:type="string">sales_shipment.order_id</argument>
            <argument name="joins" xsi:type="array">
                <item name="tig_postnl_shipment" xsi:type="array">
                    <item name="table" xsi:type="string">tig_postnl_shipment</item>
                    <item name="origin_column" xsi:type="string">entity_id</item>
                    <item name="target_column" xsi:type="string">shipment_id</item>
                </item>
            </argument>
            <argument name="columns" xsi:type="array">
                <item name="entity_id" xsi:type="string">sales_shipment.entity_id</item>
                <item name="tig_postnl_ship_at" xsi:type="string">tig_postnl_shipment.ship_at</item>
                <item name="tig_postnl_product_code" xsi:type="string">tig_postnl_shipment.product_code</item>
                <item name="tig_postnl_confirmed_at" xsi:type="string">tig_postnl_shipment.confirmed_at</item>
                <item name="tig_postnl_confirmed" xsi:type="string">tig_postnl_shipment.confirmed</item>
                <item name="tig_postnl_barcode" xsi:type="string">tig_postnl_shipment.main_barcode</item>
            </argument>
        </arguments>
    </virtualType>

    <!-- Update the shipment grid -->
    <type name="TIG\PostNL\Observer\TIGPostNLShipmentSaveAfter\UpdateOrderShipmentGrid">
        <arguments>
            <argument name="shipmentGrid" xsi:type="object">PostNLShipmentGridAggregator</argument>
        </arguments>
    </type>

    <type name="TIG\PostNL\Observer\TIGPostNLShipmentSaveAfter\UpdateOrderGrid">
        <arguments>
            <argument name="orderGrid" xsi:type="object">PostNLOrderGridAggregator</argument>
        </arguments>
    </type>

    <type name="TIG\PostNL\Observer\SalesOrderSaveAfter\UpdateOrderGrid">
        <arguments>
            <argument name="orderGrid" xsi:type="object">PostNLOrderGridAggregator</argument>
        </arguments>
    </type>

    <virtualType name="PostNLOrderGridAggregator" type="Magento\Sales\Model\ResourceModel\Grid">
        <arguments>
            <argument name="mainTableName" xsi:type="string">sales_order</argument>
            <argument name="gridTableName" xsi:type="string">sales_order_grid</argument>
            <argument name="orderIdField" xsi:type="string">sales_order.entity_id</argument>
            <argument name="joins" xsi:type="array">
                <item name="tig_postnl_order" xsi:type="array">
                    <item name="table" xsi:type="string">tig_postnl_order</item>
                    <item name="origin_column" xsi:type="string">entity_id</item>
                    <item name="target_column" xsi:type="string">order_id</item>
                </item>
            </argument>
            <argument name="columns" xsi:type="array">
                <item name="entity_id" xsi:type="string">sales_order.entity_id</item>
                <item name="tig_postnl_ship_at" xsi:type="string">tig_postnl_order.ship_at</item>
                <item name="tig_postnl_product_code" xsi:type="string">tig_postnl_order.product_code</item>
                <item name="tig_postnl_confirmed" xsi:type="string">tig_postnl_order.confirmed</item>
            </argument>
        </arguments>
    </virtualType>

    <!-- Add the PostNL fee to the shipping total -->
    <type name="\Magento\Quote\Model\Quote\Address\Total\Shipping">
        <plugin name="TIG_PostNL_QuoteAddressTotalShipping" type="\TIG\PostNL\Plugin\Quote\Address\Total\Shipping" sortOrder="1"/>
    </type>

    <type name="TIG\PostNL\Service\Validation\Factory">
        <arguments>
            <argument name="validators" xsi:type="array">
                <item name="decimal" xsi:type="object">\TIG\PostNL\Service\Validation\Decimal</item>
                <item name="parcelType" xsi:type="object">\TIG\PostNL\Service\Validation\ParcelType</item>
                <item name="country" xsi:type="object">\TIG\PostNL\Service\Validation\Country</item>
                <item name="region" xsi:type="object">\TIG\PostNL\Service\Validation\Region</item>
                <item name="duplicateImport" xsi:type="object">\TIG\PostNL\Service\Validation\DuplicateImport</item>
            </argument>
        </arguments>
    </type>

    <type name="TIG\PostNL\Plugin\Postcodecheck\Fields\Factory">
        <arguments>
            <argument name="fields" xsi:type="array">
                <item name="housenumber" xsi:type="object">\TIG\PostNL\Plugin\Postcodecheck\Fields\Housenumber</item>
                <item name="addition" xsi:type="object">\TIG\PostNL\Plugin\Postcodecheck\Fields\HousenumberAddition</item>
            </argument>
        </arguments>
    </type>

    <type name="\Mageplaza\Osc\Api\CheckoutManagementInterface">
        <plugin name="postcodeMageplazaCheckoutInformation" type="TIG\PostNL\Plugin\Postcodecheck\Mageplaza\CheckoutManagement" />
    </type>

    <type name="\Mageplaza\Osc\Block\Checkout\LayoutProcessor">
        <plugin name="postcodeMageplazaLayoutProcessor" type="\TIG\PostNL\Plugin\Postcodecheck\Mageplaza\LayoutProcessor" sortOrder="1"/>
    </type>

    <type name="Magento\Sales\Model\ResourceModel\Grid">
        <plugin name="TIG_PostNL_OrderPlace" type="TIG\PostNL\Plugin\Order\AsyncPlugin" sortOrder="1" />
        <plugin name="TIG_PostNL_ShipmentPlace" type="TIG\PostNL\Plugin\Shipment\AsyncPlugin" sortOrder="1" />
    </type>

    <type name="TIG\PostNL\Plugin\Order\AsyncPlugin">
        <arguments>
            <argument name="mainTableName" xsi:type="string">sales_order</argument>
            <argument name="gridTableName" xsi:type="string">sales_order_grid</argument>
            <argument name="orderIdField" xsi:type="string">sales_order_grid.entity_id</argument>
            <argument name="notSyncedDataProvider" xsi:type="object">Magento\Sales\Model\ResourceModel\Provider\NotSyncedOrderDataProvider</argument>
        </arguments>
    </type>

    <type name="TIG\PostNL\Plugin\Shipment\AsyncPlugin">
        <arguments>
            <argument name="mainTableName" xsi:type="string">sales_shipment</argument>
            <argument name="gridTableName" xsi:type="string">sales_shipment_grid</argument>
            <argument name="orderIdField" xsi:type="string">sales_shipment_grid.entity_id</argument>
            <argument name="notSyncedDataProvider" xsi:type="object">Magento\Sales\Model\ResourceModel\Provider\NotSyncedOrderDataProvider</argument>
        </arguments>
    </type>


    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="postnl_matrix_index_data_source" xsi:type="string">TIG\PostNL\Model\Carrier\ResourceModelMatrixrateCollection</item>
            </argument>
        </arguments>
    </type>
    <virtualType name="TIG\PostNL\Model\Carrier\ResourceModelMatrixrateCollection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">tig_postnl_matrixrate</argument>
            <argument name="resourceModel" xsi:type="string">TIG\PostNL\Model\Carrier\ResourceModel\Matrixrate</argument>
        </arguments>
    </virtualType>



</config>