services:
    oro_tax.form.autocomplete.product_tax_code.search_handler:
        class: Oro\Bundle\TaxBundle\Autocomplete\TaxCodeSearchHandler
        parent: oro_form.autocomplete.search_handler
        arguments:
            - 'Oro\Bundle\TaxBundle\Entity\ProductTaxCode'
            - ['code']
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: oro_product_tax_code }

    oro_tax.form.autocomplete.customer_tax_code.search_handler:
        class: Oro\Bundle\TaxBundle\Autocomplete\TaxCodeSearchHandler
        parent: oro_form.autocomplete.search_handler
        arguments:
            - 'Oro\Bundle\TaxBundle\Entity\CustomerTaxCode'
            - ['code']
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: oro_customer_tax_code }

    oro_tax.event_listener.abstract_form_view:
        public: false
        abstract: true
        arguments:
            - "@oro_entity.doctrine_helper"
            - "@request_stack"

    oro_tax.event_listener.customer_form_view:
        class: Oro\Bundle\TaxBundle\EventListener\CustomerFormViewListener
        arguments:
            - '@request_stack'
            - '@oro_entity.doctrine_helper'
            - '@oro_featuretoggle.checker.feature_checker'
        tags:
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.customer-view, method: onView }
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.customer-edit, method: onEdit }

    oro_tax.event_listener.customer_group_form_view:
        class: Oro\Bundle\TaxBundle\EventListener\CustomerGroupFormViewListener
        arguments:
            - '@request_stack'
            - '@oro_entity.doctrine_helper'
            - '@oro_featuretoggle.checker.feature_checker'
        tags:
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.customer-group-view, method: onView }
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.customer-group-edit, method: onEdit }

    oro_tax.event_listener.product_form_view:
        class: Oro\Bundle\TaxBundle\EventListener\ProductFormViewListener
        arguments:
            - '@request_stack'
            - '@oro_entity.doctrine_helper'
            - '@oro_featuretoggle.checker.feature_checker'
        calls:
            - [setFieldAclHelper, ['@oro_security.form.field_acl_helper']]
        tags:
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.product-view, method: onView }
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.product-edit, method: onEdit }
            - { name: kernel.event_listener, event: oro_ui.scroll_data.before.product-create-step-two, method: onEdit }

    oro_tax.form.autocomplete.tax.search_handler:
        parent: oro_form.autocomplete.search_handler
        arguments:
            - 'Oro\Bundle\TaxBundle\Entity\Tax'
            - ['code']
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: oro_tax_autocomplete, acl_resource: oro_tax_view }

    oro_tax.form.autocomplete.tax_jurisdiction.search_handler:
        parent: oro_form.autocomplete.search_handler
        arguments:
            - 'Oro\Bundle\TaxBundle\Entity\TaxJurisdiction'
            - ['code']
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: oro_tax_jurisdiction_autocomplete, acl_resource: oro_tax_jurisdiction_view }

    oro_tax.event_listener.customer_grid:
        class: Oro\Bundle\TaxBundle\EventListener\TaxCodeGridListener
        arguments:
            - 'Oro\Bundle\TaxBundle\Entity\CustomerTaxCode'
            - '@oro_featuretoggle.checker.feature_checker'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.customer-customers-select-grid, method: onBuildBefore }

    oro_tax.event_listener.customer_grid_groups:
        class: Oro\Bundle\TaxBundle\EventListener\CustomerTaxCodeGridListener
        arguments:
            - 'Oro\Bundle\TaxBundle\Entity\CustomerTaxCode'
            - '@oro_featuretoggle.checker.feature_checker'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.customer-customers-select-grid, method: onBuildBefore }

    oro_tax.event_listener.customer_group_grid:
        class: Oro\Bundle\TaxBundle\EventListener\TaxCodeGridListener
        arguments:
            - 'Oro\Bundle\TaxBundle\Entity\CustomerTaxCode'
            - '@oro_featuretoggle.checker.feature_checker'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.customer-groups-select-grid, method: onBuildBefore }

    oro_tax.event_listener.product_grid:
        class: Oro\Bundle\TaxBundle\EventListener\ProductTaxCodeGridListener
        arguments:
            - 'Oro\Bundle\TaxBundle\Entity\ProductTaxCode'
            - '@oro_featuretoggle.checker.feature_checker'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.products-grid, method: onBuildBefore }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.products-select-grid, method: onBuildBefore }

    oro_tax.event_listener.config.address:
        class: 'Oro\Bundle\TaxBundle\EventListener\Config\AddressEventListener'
        arguments:
            - "@oro_tax.factory.address_model_factory"
        tags:
            - { name: kernel.event_listener, event: oro_config.settings_form_preset, method: formPreSet }
            - { name: kernel.event_listener, event: oro_config.settings_before_save.oro_tax.origin_address, method: beforeSave }

    oro_tax.event_listener.config.digital_products_eu:
        class: 'Oro\Bundle\TaxBundle\EventListener\Config\ProductTaxCodeEventListener'
        arguments:
            - "@oro_entity.doctrine_helper"
            - '@oro_security.acl_helper'
            - 'digital_products_eu'
        tags:
            - { name: kernel.event_listener, event: oro_config.settings_form_preset, method: formPreSet }
            - { name: kernel.event_listener, event: oro_config.settings_before_save.oro_tax.digital_products_eu, method: beforeSave }

    oro_tax.event_listener.config.digital_products_us:
        class: 'Oro\Bundle\TaxBundle\EventListener\Config\ProductTaxCodeEventListener'
        arguments:
            - "@oro_entity.doctrine_helper"
            - '@oro_security.acl_helper'
            - 'digital_products_us'
        tags:
            - { name: kernel.event_listener, event: oro_config.settings_form_preset, method: formPreSet }
            - { name: kernel.event_listener, event: oro_config.settings_before_save.oro_tax.digital_products_us, method: beforeSave }

    oro_tax.event_listener.config.shipping_tax_code:
        class: 'Oro\Bundle\TaxBundle\EventListener\Config\ProductTaxCodeEventListener'
        arguments:
            - "@oro_entity.doctrine_helper"
            - '@oro_security.acl_helper'
            - 'shipping_tax_code'
        tags:
            - { name: kernel.event_listener, event: oro_config.settings_form_preset, method: formPreSet }
            - { name: kernel.event_listener, event: oro_config.settings_before_save.oro_tax.shipping_tax_code, method: beforeSave }

    oro_tax.event_listener.grid.order_line_item:
        class: 'Oro\Bundle\TaxBundle\EventListener\Order\OrderLineItemGridListener'
        arguments:
            - '@oro_tax.provider.taxation_settings_provider'
            - 'Oro\Bundle\TaxBundle\Entity\TaxValue'
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.order-line-items-grid, method: onBuildBefore }
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.order-line-items-grid-frontend, method: onBuildBefore }

    oro_tax.event_listener.order.taxes:
        class: 'Oro\Bundle\TaxBundle\EventListener\Order\OrderTaxesListener'
        arguments:
            - '@oro_tax.provider.tax_provider_registry'
            - '@oro_tax.provider.taxation_settings_provider'
            - '@oro_order.pricing.price_matcher'
        tags:
            - { name: kernel.event_listener, event: oro_order.order, method: onOrderEvent, priority: -128 }

    oro_tax.provider.tax_provider_registry:
        class: 'Oro\Bundle\TaxBundle\Provider\TaxProviderRegistry'
        arguments:
            - [] # provider names
            - ~ # service locator
            - '@oro_config.manager'

    oro_tax.provider.built_in_tax_provider:
        class: 'Oro\Bundle\TaxBundle\Provider\BuiltInTaxProvider'
        public: false
        arguments:
            - '@oro_tax.manager.tax_manager'
        tags:
            - { name: oro_tax.tax_provider, alias: built_in, priority: 255 }

    oro_tax.transformer.tax_value:
        class: 'Oro\Bundle\TaxBundle\Transformer\TaxValueToResultTransformer'
        public: false
        arguments:
            - "@oro_tax.manager.tax_value_manager"

    oro_tax.event.tax_event_dispatcher:
        class: 'Oro\Bundle\TaxBundle\Event\TaxEventDispatcher'
        public: false
        arguments:
            - "@event_dispatcher"

    oro_tax.event.context_event_dispatcher:
        class: 'Oro\Bundle\TaxBundle\Event\ContextEventDispatcher'
        public: false
        arguments:
            - "@event_dispatcher"

    oro_tax.manager.tax_manager:
        class: 'Oro\Bundle\TaxBundle\Manager\TaxManager'
        arguments:
            - '@oro_tax.factory.tax'
            - '@oro_tax.event.tax_event_dispatcher'
            - '@oro_tax.manager.tax_value_manager'
            - '@oro_tax.provider.taxation_settings_provider'
            - '@oro_tax.taxation_provider.cache'
            - '@oro.cache.generator.object_cache_key'
        calls:
            - [addTransformer, ['Oro\Bundle\OrderBundle\Entity\Order', "@oro_tax.transformer.tax_value"]]
            - [addTransformer, ['Oro\Bundle\OrderBundle\Entity\OrderLineItem', "@oro_tax.transformer.tax_value"]]

    oro_tax.manager.tax_value_manager:
        class: 'Oro\Bundle\TaxBundle\Manager\TaxValueManager'
        public: false
        arguments:
            - '@oro_entity.doctrine_helper'
            - '@oro_entity.event_listener.doctrine_flush_progress_listener'
            - 'Oro\Bundle\TaxBundle\Entity\TaxValue'
            - 'Oro\Bundle\TaxBundle\Entity\Tax'

    oro_tax.factory.tax:
        class: 'Oro\Bundle\TaxBundle\Factory\TaxFactory'
        public: false
        arguments:
            - ~ # service locator

    oro_tax.factory.tax_base_exclusion:
        class: 'Oro\Bundle\TaxBundle\Factory\TaxBaseExclusionFactory'
        public: false
        arguments:
            - "@oro_entity.doctrine_helper"

    oro_tax.factory.address_model_factory:
        class: 'Oro\Bundle\TaxBundle\Factory\AddressModelFactory'
        public: false
        arguments:
            - "@oro_entity.doctrine_helper"

    oro_tax.order_tax.mapper.order_mapper:
        class: 'Oro\Bundle\TaxBundle\OrderTax\Mapper\OrderMapper'
        arguments:
            - '@oro_tax.event.context_event_dispatcher'
            - '@oro_tax.provider.taxation_address_provider'
            - '@oro_tax.order_tax.mapper.order_line_item_mapper'
            - '@oro_entity.manager.preloading_manager'
        tags:
            - { name: oro_tax.tax_mapper, class: 'Oro\Bundle\OrderBundle\Entity\Order' }

    oro_tax.order_tax.mapper.order_line_item_mapper:
        class: 'Oro\Bundle\TaxBundle\OrderTax\Mapper\OrderLineItemMapper'
        public: false
        arguments:
            - '@oro_tax.event.context_event_dispatcher'
            - '@oro_tax.provider.taxation_address_provider'
        tags:
            - { name: oro_tax.tax_mapper, class: 'Oro\Bundle\OrderBundle\Entity\OrderLineItem' }

    oro_tax.order_tax.context_handler.order_line_item_handler:
        class: 'Oro\Bundle\TaxBundle\OrderTax\ContextHandler\OrderLineItemHandler'
        arguments:
            - "@oro_tax.provider.taxation_address_provider"
            - "@oro_tax.provider.tax_code"
            - 'Oro\Bundle\OrderBundle\Entity\OrderLineItem'
        tags:
            - { name: kernel.event_listener, event: oro_tax.mapper.context, method: onContextEvent }

    oro_tax.order_tax.context_handler.order_handler:
        class: 'Oro\Bundle\TaxBundle\OrderTax\ContextHandler\OrderHandler'
        arguments:
            - '@oro_tax.provider.tax_code'
        tags:
            - { name: kernel.event_listener, event: oro_tax.mapper.context, method: onContextEvent }

    oro_tax.provider.taxation_settings_provider:
        class: 'Oro\Bundle\TaxBundle\Provider\TaxationSettingsProvider'
        public: true
        arguments:
            - '@oro_config.manager'
            - '@oro_tax.factory.tax_base_exclusion'
            - '@oro_tax.factory.address_model_factory'
            - '@oro_tax.taxation_provider.cache'

    oro_tax.provider.taxation_address_provider:
        class: 'Oro\Bundle\TaxBundle\Provider\TaxationAddressProvider'
        public: false
        arguments:
            - "@oro_tax.provider.taxation_settings_provider"

    oro_tax.provider.address_resolver_settings_provider:
        class: 'Oro\Bundle\TaxBundle\Provider\AddressResolverSettingsProvider'
        public: false
        arguments:
            - '@oro_config.global'

    oro_tax.matcher.country_matcher:
        class: Oro\Bundle\TaxBundle\Matcher\CountryMatcher
        arguments:
            - '@doctrine'
        tags:
            - { name: oro_tax.address_matcher, type: country }

    oro_tax.matcher.region_matcher:
        class: Oro\Bundle\TaxBundle\Matcher\RegionMatcher
        arguments:
            - '@doctrine'
            - '@oro_tax.matcher.country_matcher'
        tags:
            - { name: oro_tax.address_matcher, type: region }

    oro_tax.matcher.zip_code_matcher:
        class: Oro\Bundle\TaxBundle\Matcher\ZipCodeMatcher
        arguments:
            - '@doctrine'
            - '@oro_tax.matcher.region_matcher'
        tags:
            - { name: oro_tax.address_matcher, type: zip_code}

    oro_tax.matcher.country_and_zip_code_matcher:
        class: Oro\Bundle\TaxBundle\Matcher\CountryZipCodeMatcher
        arguments:
            - '@doctrine'
            - '@oro_tax.matcher.country_matcher'
        tags:
            - { name: oro_tax.address_matcher, type: country_and_zip_code }

    oro_tax.matcher.resolvable_matcher:
        class: Oro\Bundle\TaxBundle\Matcher\ResolvableMatcher
        arguments:
            - '@oro_tax.address_matcher_registry'
            - '@oro_tax.provider.address_resolver_settings_provider'

    oro_tax.calculator:
        class: 'Oro\Bundle\TaxBundle\Calculator\Calculator'
        public: false
        arguments:
            - "@oro_tax.provider.taxation_settings_provider"
            - "@oro_tax.calculator.included_tax"
            - "@oro_tax.calculator.tax"

    oro_tax.calculator.included_tax:
        class: 'Oro\Bundle\TaxBundle\Calculator\IncludedTaxCalculator'
        public: false

    oro_tax.calculator.tax:
        class: 'Oro\Bundle\TaxBundle\Calculator\TaxCalculator'
        public: false

    oro_tax.resolver.unit:
        class: 'Oro\Bundle\TaxBundle\Resolver\UnitResolver'
        public: false
        arguments:
            - "@oro_tax.calculator"

    oro_tax.resolver.row_total:
        class: 'Oro\Bundle\TaxBundle\Resolver\RowTotalResolver'
        public: false
        arguments:
            - '@oro_tax.provider.taxation_settings_provider'
            - '@oro_tax.calculator'
            - '@oro_tax.resolver.rounding'

    oro_tax.resolver.total:
        class: 'Oro\Bundle\TaxBundle\Resolver\TotalResolver'
        public: false
        arguments:
            - "@oro_tax.provider.taxation_settings_provider"
            - "@oro_tax.resolver.rounding"
        tags:
            - { name: oro_tax.resolver, event: oro_tax.resolve_after, priority: -128 }

    oro_tax.resolver.shipping:
        class: 'Oro\Bundle\TaxBundle\Resolver\ShippingResolver'
        public: false
        arguments:
            - "@oro_tax.calculator.included_tax"
            - "@oro_tax.calculator.tax"
            - "@oro_tax.matcher.resolvable_matcher"
            - "@oro_tax.provider.taxation_settings_provider"
        tags:
            - { name: oro_tax.resolver, event: oro_tax.resolve_after, priority: -64 }

    oro_tax.resolver.rounding:
        class: 'Oro\Bundle\TaxBundle\Resolver\RoundingResolver'
        public: false
        tags:
            - { name: oro_tax.resolver, event: oro_tax.resolve_after, priority: -255 }

    oro_tax.resolver.currency:
        class: 'Oro\Bundle\TaxBundle\Resolver\CurrencyResolver'
        public: false
        tags:
            - { name: oro_tax.resolver, event: oro_tax.resolve_after, priority: -255 }

    oro_tax.resolver.customer_address.item:
        class: 'Oro\Bundle\TaxBundle\Resolver\CustomerAddressItemResolver'
        public: false
        arguments:
            - "@oro_tax.resolver.unit"
            - "@oro_tax.resolver.row_total"
            - "@oro_tax.matcher.resolvable_matcher"
        tags:
            - { name: oro_tax.resolver, event: oro_tax.resolve, priority: -32 }

    oro_tax.resolver.customer_address:
        class: 'Oro\Bundle\TaxBundle\Resolver\CustomerAddressResolver'
        public: false
        arguments:
            - "@oro_tax.resolver.customer_address.item"
        tags:
            - { name: oro_tax.resolver, event: oro_tax.resolve, priority: -32 }

    oro_tax.resolver.eu_item_digital:
        class: 'Oro\Bundle\TaxBundle\Resolver\SellerResolver\VatResolver\EUVatResolver\DigitalItemResolver'
        public: false
        arguments:
            - "@oro_tax.resolver.unit"
            - "@oro_tax.resolver.row_total"
            - "@oro_tax.matcher.resolvable_matcher"
        tags:
            - { name: oro_tax.resolver, event: oro_tax.resolve }

    oro_tax.resolver.eu_digital:
        class: 'Oro\Bundle\TaxBundle\Resolver\SellerResolver\VatResolver\EUVatResolver\DigitalResolver'
        public: false
        arguments:
            - "@oro_tax.resolver.eu_item_digital"
        tags:
            - { name: oro_tax.resolver, event: oro_tax.resolve }

    oro_tax.resolver.us_sales_tax_digital.item:
        class: 'Oro\Bundle\TaxBundle\Resolver\SellerResolver\USSalesTaxResolver\DigitalItemResolver'
        public: false
        tags:
            - { name: oro_tax.resolver, event: oro_tax.resolve }

    oro_tax.resolver.us_sales_tax_digital:
        class: 'Oro\Bundle\TaxBundle\Resolver\SellerResolver\USSalesTaxResolver\DigitalResolver'
        public: false
        arguments:
            - "@oro_tax.resolver.us_sales_tax_digital.item"
        tags:
            - { name: oro_tax.resolver, event: oro_tax.resolve }

    oro_tax.order_tax.resolver.skip_order_tax_recalculation:
        class: 'Oro\Bundle\TaxBundle\OrderTax\Resolver\SkipOrderTaxRecalculationResolver'
        public: false
        arguments:
            - '@doctrine'
            - '@oro_tax.manager.tax_manager'
            - '@oro_frontend.request.frontend_helper'
            - '@event_dispatcher'
        tags:
            - { name: oro_tax.resolver, event: oro_tax.resolve_before }

    oro_tax.event_listener.order_tax.abstract_taxable_listener:
        class: 'Oro\Bundle\TaxBundle\EventListener\OrderTax\AbstractTaxableListener'
        abstract:  true
        arguments:
            - '@doctrine'

    oro_tax.event_listener.order_tax.order_taxable_listener:
        class: 'Oro\Bundle\TaxBundle\EventListener\OrderTax\OrderTaxableListener'
        parent: oro_tax.event_listener.order_tax.abstract_taxable_listener
        tags:
            - { name: kernel.event_listener, event: Oro\Bundle\TaxBundle\Event\SkipOrderTaxRecalculationEvent, method: onSkipOrderTaxRecalculation }

    oro_tax.event_listener.order_tax.order_line_item_taxable_listener:
        class: 'Oro\Bundle\TaxBundle\EventListener\OrderTax\OrderLineItemTaxableListener'
        parent: oro_tax.event_listener.order_tax.abstract_taxable_listener
        tags:
            - { name: kernel.event_listener, event: Oro\Bundle\TaxBundle\Event\SkipOrderTaxRecalculationEvent, method: onSkipOrderTaxRecalculation }

    oro_tax.event_listener.tax_value:
        class: 'Oro\Bundle\TaxBundle\EventListener\TaxValueListener'
        public: false
        arguments:
            - '@oro_tax.manager.tax_value_manager'
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\TaxBundle\Entity\TaxValue', event: postRemove }

    # Service helps built-in tax provider to manage TaxValue entities in the DB
    oro_tax.event_listener.builin_entity_tax:
        class: 'Oro\Bundle\TaxBundle\EventListener\BuiltinEntityTaxListener'
        public: false
        arguments:
            - '@oro_tax.provider.tax_provider_registry'
        tags:
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\OrderBundle\Entity\Order', event: prePersist }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\OrderBundle\Entity\Order', event: postPersist }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\OrderBundle\Entity\OrderLineItem', event: prePersist }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\OrderBundle\Entity\OrderLineItem', event: postPersist }

    # Service tracks changes of Order entity and call tax calculation process
    oro_tax.event_listener.order_tax:
        class: 'Oro\Bundle\TaxBundle\EventListener\EntityTaxListener'
        public: false
        arguments:
            - '@oro_tax.provider.tax_provider_registry'
            - 'Oro\Bundle\OrderBundle\Entity\Order'
        tags:
            # For correct generate "Created At" in TaxValue entity this listener must be a called before ModifyCreatedAndUpdatedPropertiesListener
            - { name: doctrine.event_listener, event: onFlush, priority: 200 }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\OrderBundle\Entity\Order', event: preRemove }

    # Service tracks changes of OrderLineItem entity and call tax calculation process
    oro_tax.event_listener.order_line_item_tax:
        class: 'Oro\Bundle\TaxBundle\EventListener\EntityTaxListener'
        public: false
        arguments:
            - '@oro_tax.provider.tax_provider_registry'
            - 'Oro\Bundle\OrderBundle\Entity\OrderLineItem'
        tags:
            # For correct generate "Created At" in TaxValue entity this listener must be a called before ModifyCreatedAndUpdatedPropertiesListener
            - { name: doctrine.event_listener, event: onFlush, priority: 200 }
            - { name: doctrine.orm.entity_listener, entity: 'Oro\Bundle\OrderBundle\Entity\OrderLineItem', event: preRemove }

    oro_tax.layout.data_provider.tax:
        class: 'Oro\Bundle\TaxBundle\Layout\Provider\TaxProvider'
        arguments:
            - '@oro_tax.provider.tax_provider_registry'
        tags:
            - { name: layout.data_provider, alias: tax }

    oro_tax.layout.type.tax:
        parent: oro_layout.block_type.abstract_configurable
        calls:
            - [setOptionsConfig, [{result: {required: true}}]]
            - [setName, ['tax']]
        tags:
             - { name: layout.block_type, alias: tax }

    oro_tax.provider.abstract_tax_subtotal:
        class: 'Oro\Bundle\TaxBundle\Provider\AbstractTaxSubtotalProvider'
        abstract: true
        public: false
        arguments:
            - '@translator'
            - '@oro_tax.provider.tax_provider_registry'
            - '@oro_tax.factory.tax'
            - '@oro_tax.provider.taxation_settings_provider'

    oro_tax.provider.tax_subtotal:
        class: 'Oro\Bundle\TaxBundle\Provider\TaxSubtotalProvider'
        parent: oro_tax.provider.abstract_tax_subtotal
        tags:
            - { name: oro_pricing.subtotal_provider, alias: oro_tax.subtotal_tax, priority: 20 }

    oro_tax.provider.shipping_tax_subtotal:
        class: 'Oro\Bundle\TaxBundle\Provider\ShippingTaxSubtotalProvider'
        parent: oro_tax.provider.abstract_tax_subtotal
        tags:
            - { name: oro_pricing.subtotal_provider, alias: oro_tax.subtotal_shipping_tax, priority: 20 }

    oro_tax.provider.lineitem_tax_subtotal:
        class: 'Oro\Bundle\TaxBundle\Provider\LineItemTaxSubtotalProvider'
        parent: oro_tax.provider.abstract_tax_subtotal
        arguments:
            - '@oro_tax.manager.tax_manager'
        tags:
            - { name: oro_pricing.subtotal_provider, alias: oro_tax.subtotal_lineitem_tax, priority: 20 }

    oro_tax.address_matcher_registry:
        class: 'Oro\Bundle\TaxBundle\Matcher\AddressMatcherRegistry'
        public: false
        arguments:
            - [] # resolvable types
            - ~ # service locator

    oro_tax.repository.product_tax_code:
        alias: Oro\Bundle\TaxBundle\Entity\Repository\ProductTaxCodeRepository

    Oro\Bundle\TaxBundle\Entity\Repository\ProductTaxCodeRepository:
        parent: oro_entity.abstract_repository
        arguments:
            - 'Oro\Bundle\TaxBundle\Entity\ProductTaxCode'
        tags:
            - { name: doctrine.repository_service }

    oro_tax.repository.customer_tax_code:
        alias: Oro\Bundle\TaxBundle\Entity\Repository\CustomerTaxCodeRepository

    Oro\Bundle\TaxBundle\Entity\Repository\CustomerTaxCodeRepository:
        parent: oro_entity.abstract_repository
        arguments:
            - 'Oro\Bundle\TaxBundle\Entity\CustomerTaxCode'
        tags:
            - { name: doctrine.repository_service }

    oro_tax.provider.tax_code:
        class: 'Oro\Bundle\TaxBundle\Provider\TaxCodeProvider'
        arguments:
            - '@oro_tax.repository.product_tax_code'
            - '@oro_tax.repository.customer_tax_code'
            - '@oro_tax.tax_codes.cache'
            - '@oro_entity.doctrine_helper'

    Oro\Bundle\TaxBundle\Entity\Repository\TaxRuleRepository:
        parent: oro_entity.abstract_repository
        arguments:
            - 'Oro\Bundle\TaxBundle\Entity\TaxRule'
            - '@oro_security.acl_helper'
        tags:
            - { name: doctrine.repository_service }

    oro_tax.tax_codes.cache:
        parent: oro.cache.adapter.array
        tags:
            - { name: 'cache.pool', namespace: 'oro_tax_tax_codes' }

    oro_tax.manager.oro.customer_tax_code_manager:
        public: false
        class: 'Oro\Bundle\TaxBundle\Helper\CustomerTaxCodeImportExportHelper'
        arguments:
            - "@oro_entity.doctrine_helper"

    oro_tax.event_listener.import_export_tax_subscriber:
        class: Oro\Bundle\TaxBundle\EventSubscriber\CustomerTaxCodeImportExportSubscriber
        arguments:
            - '@translator'
            - '@oro_tax.manager.oro.customer_tax_code_manager'
            - '@oro_entity.helper.field_helper'
            - 'Oro\Bundle\CustomerBundle\Entity\Customer'
        tags:
            - { name: kernel.event_subscriber }

    oro_tax.taxation_provider.cache:
        parent: oro.cache.adapter.array
        tags:
            - { name: 'cache.pool', namespace: 'oro_taxation_settings_provider' }

    oro_tax.validator.tax_rate:
        class: Oro\Bundle\TaxBundle\Validator\Constraints\TaxRateValidator
        tags:
            - { name: validator.constraint_validator, alias: oro_tax_tax_rate }

    oro_tax.validator.unique_tax_code:
        class: Oro\Bundle\TaxBundle\Validator\Constraints\UniqueTaxCodeValidator
        arguments:
            - '@doctrine'
            - '@oro_security.acl_helper'
        tags:
            - { name: validator.constraint_validator }

    oro_tax.provider.tax_amount:
        class: Oro\Bundle\TaxBundle\Provider\TaxAmountProvider
        public: false
        arguments:
            - '@oro_tax.provider.tax_provider_registry'
        calls:
            - [setTaxationSettingsProvider, ['@oro_tax.provider.taxation_settings_provider']]

    oro_tax.provider.tax_rule_entity_name:
        class: Oro\Bundle\TaxBundle\Provider\TaxRuleEntityNameProvider
        tags:
            - { name: oro_entity.name_provider, priority: 100 }
