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

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

        $merchant = ArrayObject::ensureArrayObject($model['merchant'] ?: []);

        if (false == $merchant['checkout_uri'] && $this->api->checkoutUri) {
            $merchant['checkout_uri'] = $this->api->checkoutUri;
        }

        if (false == $merchant['terms_uri'] && $this->api->termsUri) {
            $merchant['terms_uri'] = $this->api->termsUri;
        }

        if (false == $merchant['confirmation_uri'] && $request->getToken()) {
            $merchant['confirmation_uri'] = $request->getToken()->getTargetUrl();
        }

        if (empty($merchant['push_uri']) && $request->getToken() && $this->tokenFactory) {
            $notifyToken = $this->tokenFactory->createNotifyToken(
                $request->getToken()->getGatewayName(),
                $request->getToken()->getDetails()
            );

            $merchant['push_uri'] = $notifyToken->getTargetUrl();
        }

        $merchant->validateNotEmpty(['checkout_uri', 'terms_uri', 'confirmation_uri', 'push_uri']);
        $model['merchant'] = (array) $merchant;

        if (false == $model['location']) {
            $createOrderRequest = new CreateOrder($model);
            $this->gateway->execute($createOrderRequest);

            $model->replace($createOrderRequest->getOrder()->marshal());
            $model['location'] = $createOrderRequest->getOrder()->getLocation();
        }

        $this->gateway->execute(new Sync($model));

        if (Constants::STATUS_CHECKOUT_INCOMPLETE == $model['status']) {
            $renderTemplate = new RenderTemplate($this->templateName, array(
                'snippet' => $model['gui']['snippet'],
            ));
            $this->gateway->execute($renderTemplate);

            throw new HttpResponse($renderTemplate->getResult());
        }
    }
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

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

        $merchant = ArrayObject::ensureArrayObject($model['merchant'] ?: []);

        if (false == $merchant['checkout_uri'] && $this->api->checkoutUri) {
            $merchant['checkout_uri'] = $this->api->checkoutUri;
        }

        if (false == $merchant['terms_uri'] && $this->api->termsUri) {
            $merchant['terms_uri'] = $this->api->termsUri;
        }

        if (false == $merchant['confirmation_uri'] && $request->getToken()) {
            $merchant['confirmation_uri'] = $request->getToken()->getTargetUrl();
        }

        if (empty($merchant['push_uri']) && $request->getToken() && $this->tokenFactory) {
            $notifyToken = $this->tokenFactory->createNotifyToken(
                $request->getToken()->getGatewayName(),
                $request->getToken()->getDetails()
            );

            $merchant['push_uri'] = $notifyToken->getTargetUrl();
        }

        $merchant->validateNotEmpty(['checkout_uri', 'terms_uri', 'confirmation_uri', 'push_uri']);
        $model['merchant'] = (array) $merchant;

        if (false == $model['location']) {
            $createOrderRequest = new CreateOrder($model);
            $this->gateway->execute($createOrderRequest);

            $model->replace($createOrderRequest->getOrder()->marshal());
            $model['location'] = $createOrderRequest->getOrder()->getLocation();
        }

        $this->gateway->execute(new Sync($model));

        if (Constants::STATUS_CHECKOUT_INCOMPLETE == $model['status']) {
            $renderTemplate = new RenderTemplate($this->templateName, array(
                'snippet' => $model['gui']['snippet'],
            ));
            $this->gateway->execute($renderTemplate);

            throw new HttpResponse($renderTemplate->getResult());
        }
    }
{@inheritDoc}

@param Authorize $request