# yaml-language-server: $schema=https://raw.githubusercontent.com/symfony/dependency-injection/7.4/Loader/schema/services.schema.json
parameters:
    sellops.paypal.classes:
        order: Shopware\PayPalSDK\Struct\V2\Order
        paymentSource: Shopware\PayPalSDK\Struct\V2\Order\PaymentSource
        paypalSource: Shopware\PayPalSDK\Struct\V2\Order\PaymentSource\Paypal
        cardSource: Shopware\PayPalSDK\Struct\V2\Order\PaymentSource\Card
        attributes: Shopware\PayPalSDK\Struct\V2\Order\PaymentSource\Common\Attributes
        paymentCustomer: Shopware\PayPalSDK\Struct\V2\Order\PaymentSource\Common\Attributes\Customer
        purchaseUnit: Shopware\PayPalSDK\Struct\V2\Order\PurchaseUnit
        amount: Shopware\PayPalSDK\Struct\V2\Order\PurchaseUnit\Amount
        purchaseUnitCollection: Shopware\PayPalSDK\Struct\V2\Order\PurchaseUnitCollection
    sellops.paypal.constants:
        intentCapture: Shopware\PayPalSDK\Struct\ConstantsV2::INTENT_CAPTURE
        statusCompleted: Shopware\PayPalSDK\Struct\ConstantsV2::ORDER_CAPTURE_COMPLETED
        partnerId: Swag\PayPal\RestApi\PartnerAttributionId::PAYPAL_CLASSIC
        cfPaypalOrderId: Swag\PayPal\SwagPayPal::ORDER_TRANSACTION_CUSTOM_FIELDS_PAYPAL_ORDER_ID
        cfPaypalResourceId: Swag\PayPal\SwagPayPal::ORDER_TRANSACTION_CUSTOM_FIELDS_PAYPAL_RESOURCE_ID
        cfPaypalPartnerAttribution: Swag\PayPal\SwagPayPal::ORDER_TRANSACTION_CUSTOM_FIELDS_PAYPAL_PARTNER_ATTRIBUTION_ID
        cfPaypalIsSandbox: Swag\PayPal\SwagPayPal::ORDER_TRANSACTION_CUSTOM_FIELDS_PAYPAL_IS_SANDBOX

services:
    _defaults:
        autowire: true
        autoconfigure: true
        public: false

    SellopsPostPurchaseUpsell\Entity\UpsellRule\UpsellRuleDefinition:
        tags:
            - shopware.entity.definition

    SellopsPostPurchaseUpsell\Entity\UpsellAnalytics\UpsellAnalyticsDefinition:
        tags:
            - shopware.entity.definition

    SellopsPostPurchaseUpsell\Entity\UpsellOneClick\UpsellOneClickDefinition:
        tags:
            - shopware.entity.definition

    SellopsPostPurchaseUpsell\Service\UpsellConfig:
        arguments:
            - '@Shopware\Core\System\SystemConfig\SystemConfigService'

    SellopsPostPurchaseUpsell\Service\UpsellCsrfProtection:
        arguments:
            - '%kernel.secret%'
            - '@request_stack'

    SellopsPostPurchaseUpsell\Twig\UpsellCsrfExtension:
        arguments:
            - '@SellopsPostPurchaseUpsell\Service\UpsellCsrfProtection'
        tags:
            - twig.extension

    SellopsPostPurchaseUpsell\Service\UpsellProductProvider:
        arguments:
            - '@SellopsPostPurchaseUpsell\Service\UpsellConfig'
            - '@sales_channel.product.repository'
            - '@Shopware\Core\Content\ProductStream\Service\ProductStreamBuilder'

    SellopsPostPurchaseUpsell\Service\UpsellDiscountCartProcessor:
        arguments:
            - '@Shopware\Core\Checkout\Cart\Price\PercentagePriceCalculator'
            - '@SellopsPostPurchaseUpsell\Service\UpsellCsrfProtection'
        tags:
            - {name: shopware.cart.processor, priority: 4500}
            - {name: shopware.cart.collector, priority: 4500}

    SellopsPostPurchaseUpsell\Service\PaymentMethodSupportChecker:
        public: true
        arguments:
            - '@Doctrine\DBAL\Connection'
            - '@SellopsPostPurchaseUpsell\Service\PayPalVaultTokenLookup'

    SellopsPostPurchaseUpsell\Subscriber\CheckoutFinishInterceptSubscriber:
        arguments:
            - '@SellopsPostPurchaseUpsell\Service\UpsellConfig'
            - '@request_stack'
            - '@router'
            - '@logger'
            - '@SellopsPostPurchaseUpsell\Service\PaymentMethodSupportChecker'
        tags:
            - kernel.event_subscriber

    SellopsPostPurchaseUpsell\Controller\UpsellInterceptController:
        public: true
        arguments:
            - '@SellopsPostPurchaseUpsell\Service\UpsellConfig'
            - '@SellopsPostPurchaseUpsell\Service\UpsellProductProvider'
            - '@SellopsPostPurchaseUpsell\Service\UpsellRuleEngine'
            - '@SellopsPostPurchaseUpsell\Service\PayPalVaultTokenLookup'
            - '@order.repository'
            - '@SellopsPostPurchaseUpsell\Service\PaymentMethodSupportChecker'
            - '@sellops_upsell_one_click.repository'
        calls:
            - [setContainer, ['@service_container']]

    SellopsPostPurchaseUpsell\Subscriber\CheckoutCartUpsellSubscriber:
        tags:
            - kernel.event_subscriber

    SellopsPostPurchaseUpsell\Subscriber\CheckoutConfirmUpsellSubscriber:
        tags:
            - kernel.event_subscriber

    SellopsPostPurchaseUpsell\Subscriber\ProductDetailUpsellSubscriber:
        tags:
            - kernel.event_subscriber

    SellopsPostPurchaseUpsell\Controller\UpsellDeclineController:
        public: true
        calls:
            - [setContainer, ['@service_container']]

    SellopsPostPurchaseUpsell\Service\UpsellAnalyticsService:
        arguments:
            - '@sellops_upsell_analytics.repository'
            - '@logger'

    SellopsPostPurchaseUpsell\Subscriber\UpsellAnalyticsSubscriber:
        arguments:
            - '@SellopsPostPurchaseUpsell\Service\UpsellAnalyticsService'
        tags:
            - kernel.event_subscriber

    SellopsPostPurchaseUpsell\Subscriber\SystemConfigSubscriber:
        tags:
            - kernel.event_subscriber

    SellopsPostPurchaseUpsell\Controller\Admin\UpsellAnalyticsAdminController:
        public: true
        arguments:
            - '@Doctrine\DBAL\Connection'
        calls:
            - [setContainer, ['@service_container']]

    SellopsPostPurchaseUpsell\Controller\Admin\PaymentMethodsAdminController:
        public: true
        arguments:
            - '@Doctrine\DBAL\Connection'
        calls:
            - [setContainer, ['@service_container']]

    SellopsPostPurchaseUpsell\Service\FrequentlyBoughtTogetherService:
        arguments:
            - '@Doctrine\DBAL\Connection'

    SellopsPostPurchaseUpsell\Service\UpsellRuleEngine:
        arguments:
            - '@Doctrine\DBAL\Connection'
            - '@sales_channel.product.repository'
            - '@SellopsPostPurchaseUpsell\Service\FrequentlyBoughtTogetherService'
            - '@SellopsPostPurchaseUpsell\Service\UpsellProductProvider'
            - '@logger'
            - '@sellops_upsell_rule.repository'

    SellopsPostPurchaseUpsell\Controller\Admin\UpsellRulesAdminController:
        public: true
        arguments:
            - '@Doctrine\DBAL\Connection'
            - '@sellops_upsell_rule.repository'
        calls:
            - [setContainer, ['@service_container']]

    SellopsPostPurchaseUpsell\Service\PayPalVaultTokenLookup:
        arguments:
            - '@Doctrine\DBAL\Connection'

    SellopsPostPurchaseUpsell\Service\FreeShippingDetectorService:
        arguments:
            - '@shipping_method.repository'
            - '@Shopware\Core\Checkout\Cart\Price\QuantityPriceCalculator'
            - '@logger'

    SellopsPostPurchaseUpsell\Service\ShippingThresholdCreditService:
        arguments:
            - '@SellopsPostPurchaseUpsell\Service\UpsellConfig'
            - '@Doctrine\DBAL\Connection'
            - '@SellopsPostPurchaseUpsell\Service\FreeShippingDetectorService'
            - '@logger'

    SellopsPostPurchaseUpsell\Service\OrderPriceSnapshotRecalculator:
        arguments:
            - '@Doctrine\DBAL\Connection'
            - '@logger'

    SellopsPostPurchaseUpsell\PayPal\SwagPayPalOrderClient:
        arguments:
            - '@?Swag\PayPal\RestApi\V2\Resource\OrderResource'
            - '@logger'
            - '%sellops.paypal.classes%'
            - '%sellops.paypal.constants%'

    SellopsPostPurchaseUpsell\PayPal\NullPayPalOrderClient: ~

    SellopsPostPurchaseUpsell\Service\PayPalOneClickService:
        arguments:
            - '@SellopsPostPurchaseUpsell\PayPal\PayPalOrderClientInterface'
            - '@Shopware\Core\Checkout\Cart\SalesChannel\CartService'
            - '@Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStateHandler'
            - '@Doctrine\DBAL\Connection'
            - '@logger'
            - '@SellopsPostPurchaseUpsell\Service\OrderPriceSnapshotRecalculator'
            - '@sellops_upsell_one_click.repository'
            - '@translator'
            - '@SellopsPostPurchaseUpsell\Service\UpsellCsrfProtection'
            - '@SellopsPostPurchaseUpsell\Service\ShippingThresholdCreditService'

    SellopsPostPurchaseUpsell\Service\CodOneClickService:
        arguments:
            - '@Shopware\Core\Checkout\Cart\SalesChannel\CartService'
            - '@Doctrine\DBAL\Connection'
            - '@logger'
            - '@Shopware\Core\System\SalesChannel\Context\SalesChannelContextFactory'
            - '@SellopsPostPurchaseUpsell\Service\OrderPriceSnapshotRecalculator'
            - '@sellops_upsell_one_click.repository'
            - '@translator'
            - '@SellopsPostPurchaseUpsell\Service\UpsellCsrfProtection'
            - '@SellopsPostPurchaseUpsell\Service\ShippingThresholdCreditService'

    SellopsPostPurchaseUpsell\Controller\UpsellAcceptCodController:
        public: true
        arguments:
            - '@SellopsPostPurchaseUpsell\Service\CodOneClickService'
            - '@Doctrine\DBAL\Connection'
            - '@sellops_upsell_one_click.repository'
            - '@SellopsPostPurchaseUpsell\Service\UpsellCsrfProtection'
            - '@translator'
        calls:
            - [setContainer, ['@service_container']]

    SellopsPostPurchaseUpsell\Controller\UpsellAcceptController:
        public: true
        arguments:
            - '@SellopsPostPurchaseUpsell\Service\PayPalVaultTokenLookup'
            - '@SellopsPostPurchaseUpsell\Service\PayPalOneClickService'
            - '@Doctrine\DBAL\Connection'
            - '@sellops_upsell_one_click.repository'
            - '@SellopsPostPurchaseUpsell\Service\UpsellCsrfProtection'
            - '@translator'
        calls:
            - [setContainer, ['@service_container']]
