src/Payum/Paypal/ProHosted/Nvp/Action/CaptureAction.php
public function execute($request)
    {
        /** @var $request Capture */
        RequestNotSupportedException::assertSupports($this, $request);
        $model = ArrayObject::ensureArrayObject($request->getModel());

        $this->gateway->execute($httpRequest = new GetHttpRequest());
        $response = ArrayObject::ensureArrayObject($httpRequest->request);

        if (isset($httpRequest->query['cancelled'])) {
            $newResponse['CANCELLED'] = true;
            $model->replace($newResponse);

            return;
        }

        if ($response['txn_id'] != null) {
            $response->validateNotEmpty([
                'payment_status',
                'business',
                'invoice',
                'txn_id',
                'mc_gross',
            ]);

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

            $model->replace($response);
        } else {
            if ($model['cancel_return']) {
                $cancelUri = HttpUri::createFromString($model['cancel_return']);
                $modifier  = new MergeQuery('cancelled=1');
                $cancelUri = $modifier->process($cancelUri);

                $model['cancel_return'] = (string) $cancelUri;
            }

            $this->gateway->execute(new CreateButtonPayment($model));
        }
    }
public function execute($request)
    {
        /** @var $request Capture */
        RequestNotSupportedException::assertSupports($this, $request);
        $model = ArrayObject::ensureArrayObject($request->getModel());

        $this->gateway->execute($httpRequest = new GetHttpRequest());
        $response = ArrayObject::ensureArrayObject($httpRequest->request);

        if (isset($httpRequest->query['cancelled'])) {
            $newResponse['CANCELLED'] = true;
            $model->replace($newResponse);

            return;
        }

        if ($response['txn_id'] != null) {
            $response->validateNotEmpty([
                'payment_status',
                'business',
                'invoice',
                'txn_id',
                'mc_gross',
            ]);

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

            $model->replace($response);
        } else {
            if ($model['cancel_return']) {
                $cancelUri = HttpUri::createFromString($model['cancel_return']);
                $modifier  = new MergeQuery('cancelled=1');
                $cancelUri = $modifier->process($cancelUri);

                $model['cancel_return'] = (string) $cancelUri;
            }

            $this->gateway->execute(new CreateButtonPayment($model));
        }
    }
{@inheritDoc}

@param Capture $request