# Internal Server Error notification returned while trying to decorate a SWAG plugin service

**URL:** <https://forum.shopware.com/t/internal-server-error-notification-returned-while-trying-to-decorate-a-swag-plugin-service/90443>\
**Category:** Shopware 6 (English)\
**Tags:** general, programming\
**Created:** [20. September 2021 um 21:05 UTC](https://forum.shopware.com/t/internal-server-error-notification-returned-while-trying-to-decorate-a-swag-plugin-service/90443 "2021-09-20T21:05:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anitchec.dev](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@anitchec.dev](https://forum.shopware.com/u/anitchec.dev)\
**Post date:** [20. September 2021 um 21:05 UTC](https://forum.shopware.com/t/internal-server-error-notification-returned-while-trying-to-decorate-a-swag-plugin-service/90443/1 "2021-09-20T21:05:07Z")

</div>

Trying to decorate a PayPal service:

```auto
<service id="TestPlugin\Service\Client\PayPalClientFactory" decorates="Swag\PayPal\RestApi\Client\PayPalClientFactory">
    <argument type="service" id="Swag\PayPal\RestApi\Client\CredentialsClientFactory.inner" />
</service>

```

but i get the following error notification when installing the TestPlugin:

```auto
The service "TestPlugin\Service\Client\PayPalClientFactory" has a dependency on a non-existent service "Swag\PayPal\RestApi\Client\CredentialsClientFactory.inner". 
Did you mean one of these: 
"Swag\PayPal\RestApi\Client\CredentialsClientFactory", "Swag\PayPal\RestApi\Client\TokenClientFactory"

```

Below is the decorating class:

```auto
<?php

namespace TestPlugin\Service\Client;

use Swag\PayPal\RestApi\Client\PayPalClientFactoryInterface;
use Swag\PayPal\RestApi\Client\PayPalClientInterface;
use Swag\PayPal\RestApi\PartnerAttributionId;

class PayPalClientFactory implements PayPalClientFactoryInterface
{
    /**
     * @var PayPalClientFactoryInterface
     */
    private PayPalClientFactoryInterface $decoratedService;

    /**
     * @param PayPalClientFactoryInterface $decoratedService
     */
    public function __construct(PayPalClientFactoryInterface $decoratedService)
    {
        $this->decoratedService = $decoratedService;
    }

    public function getDecorated(): PayPalClientFactoryInterface
    {
        return $this->decoratedService;
    }

    public function getPayPalClient(?string $salesChannelId, string $partnerAttributionId = PartnerAttributionId::PAYPAL_CLASSIC): PayPalClientInterface
    {
        return $this->getDecorated()->getPayPalClient($salesChannelId, $partnerAttributionId);
    }

    //...
}

```

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [11. Oktober 2021 um 17:48 UTC](https://forum.shopware.com/t/internal-server-error-notification-returned-while-trying-to-decorate-a-swag-plugin-service/90443/2 "2021-10-11T17:48:15Z")

</div>

Not sure, but I think that you only can use the .inner on the same Class that is decorated.

Swag\PayPal\RestApi\Client\PayPalClientFactory.inner
