src/Payum/Klarna/Checkout/Action/AuthorizeRecurringAction.php
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $model = ArrayObject::ensureArrayObject($request->getModel());

        if ($model['reservation']) {
            return;
        }

        $model['activate'] = false;

        $backupConfig = clone $this->api;

        $token = $model['recurring_token'];

        try {
            unset($model['recurring_token']);

            $baseUri = Constants::BASE_URI_LIVE == $backupConfig->baseUri ?
                Constants::BASE_URI_RECURRING_LIVE :
                Constants::BASE_URI_RECURRING_SANDBOX
            ;

            $this->api->contentType = Constants::CONTENT_TYPE_RECURRING_ORDER_V1;
            $this->api->acceptHeader = Constants::ACCEPT_HEADER_RECURRING_ORDER_ACCEPTED_V1;
            $this->api->baseUri = str_replace('{recurring_token}', $token, $baseUri);

            $this->gateway->execute($createOrderRequest = new CreateOrder($model));

            $model->replace($createOrderRequest->getOrder()->marshal());
        } catch (\Exception $e) {
            $this->api->contentType = $backupConfig->contentType;
            $this->api->acceptHeader = $backupConfig->acceptHeader;
            $this->api->baseUri = $backupConfig->baseUri;

            $model['recurring_token'] = $token;

            throw $e;
        }

        $model['recurring_token'] = $token;

        $this->api->contentType = $backupConfig->contentType;
        $this->api->acceptHeader = $backupConfig->acceptHeader;
        $this->api->baseUri = $backupConfig->baseUri;
    }
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $model = ArrayObject::ensureArrayObject($request->getModel());

        if ($model['reservation']) {
            return;
        }

        $model['activate'] = false;

        $backupConfig = clone $this->api;

        $token = $model['recurring_token'];

        try {
            unset($model['recurring_token']);

            $baseUri = Constants::BASE_URI_LIVE == $backupConfig->baseUri ?
                Constants::BASE_URI_RECURRING_LIVE :
                Constants::BASE_URI_RECURRING_SANDBOX
            ;

            $this->api->contentType = Constants::CONTENT_TYPE_RECURRING_ORDER_V1;
            $this->api->acceptHeader = Constants::ACCEPT_HEADER_RECURRING_ORDER_ACCEPTED_V1;
            $this->api->baseUri = str_replace('{recurring_token}', $token, $baseUri);

            $this->gateway->execute($createOrderRequest = new CreateOrder($model));

            $model->replace($createOrderRequest->getOrder()->marshal());
        } catch (\Exception $e) {
            $this->api->contentType = $backupConfig->contentType;
            $this->api->acceptHeader = $backupConfig->acceptHeader;
            $this->api->baseUri = $backupConfig->baseUri;

            $model['recurring_token'] = $token;

            throw $e;
        }

        $model['recurring_token'] = $token;

        $this->api->contentType = $backupConfig->contentType;
        $this->api->acceptHeader = $backupConfig->acceptHeader;
        $this->api->baseUri = $backupConfig->baseUri;
    }
{@inheritDoc}

@param Authorize $request