services:
  _defaults:
    public: true

  prestashop.adapter.order.command_handler.duplicate_order_cart_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Order\CommandHandler\DuplicateOrderCartHandler'
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.order.command_handler.add_order_from_back_office_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Order\CommandHandler\AddOrderFromBackOfficeHandler'
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.order.command_handler.add_product_to_order_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\AddProductToOrderHandler
    autoconfigure: true
    arguments:
      - '@translator'
      - '@prestashop.adapter.context_state_manager'
      - '@prestashop.adapter.order.amount.updater'
      - '@prestashop.adapter.order.product_quantity.updater'
      - '@prestashop.adapter.order.order_detail.updater'

  PrestaShop\PrestaShop\Adapter\Order\CommandHandler\UpdateOrderStatusHandler:
    autowire: true
    autoconfigure: true

  prestashop.adapter.order.command_handler.update_product_in_order_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\UpdateProductInOrderHandler
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.order.product_quantity.updater'
      - '@prestashop.adapter.order.order_detail.updater'
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.order.command_handler.change_order_delivery_address_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\ChangeOrderDeliveryAddressHandler
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.order.amount.updater'
      - '@prestashop.adapter.order.order_detail.updater'
      - '@prestashop.adapter.context_state_manager'
      - '@prestashop.adapter.order.product_quantity.updater'

  prestashop.adapter.order.command_handler.change_order_invoice_address_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\ChangeOrderInvoiceAddressHandler
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.order.amount.updater'
      - '@prestashop.adapter.order.order_detail.updater'

  prestashop.adapter.order.command_handler.change_order_currency_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\ChangeOrderCurrencyHandler
    autoconfigure: true

  prestashop.adapter.order.command_handler.add_payment_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\AddPaymentHandler
    autoconfigure: true

  prestashop.adapter.order.command_handler.generate_invoice_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\GenerateInvoiceHandler
    autoconfigure: true

  prestashop.adapter.order.command_handler.update_order_shipping_details_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\UpdateOrderShippingDetailsHandler
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.order.amount.updater'
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.order.command_handler.delete_cart_rule_from_order_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\DeleteCartRuleFromOrderHandler
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.order.amount.updater'
      - '@prestashop.adapter.order.product_quantity.updater'
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.order.command_handler.add_cart_rule_to_order_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\AddCartRuleToOrderHandler
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.order.amount.updater'
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.order.command_handler.update_invoice_note_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\UpdateInvoiceNoteHandler
    autoconfigure: true

  prestashop.adapter.order.command_handler.issue_partial_refund_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\IssuePartialRefundHandler
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.legacy.configuration'
      - '@prestashop.adapter.order.refund.order_refund_calculator'
      - '@prestashop.adapter.order.refund.order_slip_creator'
      - '@prestashop.adapter.order.refund.voucher_generator'
      - '@prestashop.adapter.order.refund.updater'
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.order.command_handler.issue_standard_refund_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\IssueStandardRefundHandler
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.legacy.configuration'
      - '@prestashop.adapter.order.refund.order_refund_calculator'
      - '@prestashop.adapter.order.refund.order_slip_creator'
      - '@prestashop.adapter.order.refund.voucher_generator'
      - '@prestashop.adapter.order.refund.updater'
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.order.command_handler.issue_return_product_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\IssueReturnProductHandler
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.legacy.configuration'
      - '@prestashop.adapter.order.refund.order_refund_calculator'
      - '@prestashop.adapter.order.refund.order_slip_creator'
      - '@prestashop.adapter.order.refund.voucher_generator'
      - '@prestashop.adapter.order.refund.updater'
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.order.refund.order_refund_calculator:
    class: PrestaShop\PrestaShop\Adapter\Order\Refund\OrderRefundCalculator

  prestashop.adapter.order.refund.order_slip_creator:
    class: PrestaShop\PrestaShop\Adapter\Order\Refund\OrderSlipCreator
    arguments:
      - '@prestashop.adapter.legacy.configuration'
      - '@translator'

  prestashop.adapter.order.refund.voucher_generator:
    class: PrestaShop\PrestaShop\Adapter\Order\Refund\VoucherGenerator
    arguments:
      - '@prestashop.core.localization.locale.context_locale'
      - '@translator'

  prestashop.adapter.order.refund.updater:
    class: PrestaShop\PrestaShop\Adapter\Order\Refund\OrderRefundUpdater

  prestashop.adapter.order.product.remover:
    class: PrestaShop\PrestaShop\Adapter\Order\Refund\OrderProductRemover

  prestashop.adapter.order.command_handler.delete_product_from_order_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\DeleteProductFromOrderHandler
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.context_state_manager'
      - '@prestashop.adapter.order.product_quantity.updater'

  prestashop.adapter.order.command_handler.bulk_change_order_status_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Order\CommandHandler\BulkChangeOrderStatusHandler'
    autoconfigure: true

  prestashop.adapter.order.query_handler.get_order_for_viewing_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\QueryHandler\GetOrderForViewingHandler
    autoconfigure: true
    arguments:
      - '@translator'
      - '@=service("prestashop.adapter.legacy.context").getContext().language.id'
      - "@prestashop.core.localization.locale.context_locale"
      - '@=service("prestashop.adapter.legacy.context").getContext()'
      - '@prestashop.adapter.data_provider.customer'
      - '@prestashop.adapter.order.query_handler.get_order_products_for_viewing_handler'
      - '@prestashop.adapter.legacy.configuration'
      - '@prestashop.adapter.address.formatter'

  prestashop.adapter.order.query_handler.get_order_products_for_viewing_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\QueryHandler\GetOrderProductsForViewingHandler
    autoconfigure: true
    arguments:
      - '@prestashop.core.image.parser.image_tag_source_parser'
      - '@=service("prestashop.adapter.legacy.context").getContext().language.id'
      - "@prestashop.core.localization.locale.context_locale"

  prestashop.adapter.order.command_handler.resend_order_email_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\ResendOrderEmailHandler
    autoconfigure: true

  prestashop.adapter.order.query_handler.get_order_preview_handler:
    class: 'PrestaShop\PrestaShop\Adapter\Order\QueryHandler\GetOrderPreviewHandler'
    autoconfigure: true
    arguments:
      - '@prestashop.core.localization.locale.repository'
      - "@=service('prestashop.adapter.legacy.context').getContext().language.getLocale()"
      - '@prestashop.adapter.address.formatter'

  prestashop.adapter.order.command_handler.send_process_order_email_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\SendProcessOrderEmailHandler
    autoconfigure: true
    arguments:
      - '@translator'
      - '@=service("prestashop.adapter.legacy.context").getContext().link'

  prestashop.adapter.order.command_handler.cancel_order_product_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\CancelOrderProductHandler
    autoconfigure: true
    arguments:
      - '@prestashop.adapter.order.product_quantity.updater'
      - '@logger'
      - '@translator'

  prestashop.adapter.order.order_sibling_provider:
    class: PrestaShop\PrestaShop\Adapter\Order\OrderSiblingProvider

  prestashop.adapter.order.amount.updater:
    class: PrestaShop\PrestaShop\Adapter\Order\OrderAmountUpdater
    arguments:
      - '@prestashop.adapter.legacy.configuration'
      - '@prestashop.adapter.context_state_manager'
      - '@prestashop.adapter.order.order_detail.updater'
      - '@prestashop.adapter.order.product.remover'

  prestashop.adapter.order.product_quantity.updater:
    class: PrestaShop\PrestaShop\Adapter\Order\OrderProductQuantityUpdater
    arguments:
      - '@prestashop.adapter.order.amount.updater'
      - '@prestashop.adapter.order.product.remover'
      - '@prestashop.adapter.context_state_manager'

  prestashop.adapter.order.order_detail.updater:
    class: PrestaShop\PrestaShop\Adapter\Order\OrderDetailUpdater
    arguments:
      - '@prestashop.adapter.context_state_manager'
      - '@prestashop.adapter.legacy.configuration'

  prestashop.adapter.order.command_handler.set_internal_order_note_handler:
    class: PrestaShop\PrestaShop\Adapter\Order\CommandHandler\SetInternalOrderNoteHandler
    autoconfigure: true

  prestashop.adapter.order.repository.order_repository:
    alias: PrestaShop\PrestaShop\Adapter\Order\Repository\OrderRepository
    deprecated:
      package: PrestaShop\PrestaShop
      version: 9.0

  PrestaShop\PrestaShop\Adapter\Order\Repository\OrderRepository:
    arguments:
      - '@doctrine.dbal.default_connection'
      - '%database_prefix%'
