Return when success

@param $response
@return $this
968238
private function whenSuccess($response, $method)
    {
        $this->makeSession($response, $method);
        return $this->result->setData([
            'success' => true,
            'payload' => [
                'redirect' => sprintf('%s%s', $this->baseUrl(), 'pagseguro/direct/success')
            ]
        ]);
    }
579105
public function onCaptured($response)
    {
        $order = $this->owner->Invoice();

        if ($order->exists()) {
            $payment_amount = MathsHelper::round($this->owner->getAmount(), 2);
            $order_amount = MathsHelper::round($order->Total, 2);

            // If our payment is the value of the order, mark paid
            // else mark part paid
            if (abs(($payment_amount - $order_amount) / $order_amount) < 0.00001) {
                $order->markPaid();
            } else {
                $order->markPartPaid();
            }

            $order->write();
        }
    }
214594
public static function getNextResult(&$response)
    {
        //====================================================================//
        // Extract Next Task From Buffer
        $task = self::getNextTask($response);
        //====================================================================//
        // Analyze SOAP Results
        if (!$task || !isset($task->data)) {
            return false;
        }
        //====================================================================//
        // Return Task Data
        return $task->data;
    }
767988
public function verify($response)
    {
        $result = $this->getVerificationResult($response);

        if ($result['success']) {
            return true;
        }

        if (!empty($result['error-codes'])) {
            $this->errors = $result['error-codes'];
        }

        return false;
    }
764081
private function getResult($response)
    {
        $status = $response->getStatusCode();
        if ($status == 200) {
            return json_decode($response->getBody(), JSON_PRETTY_PRINT);
        } else {
            return [$status => $response->getReasonPhrase()];
        }
    }
1158597
public function mapResponse($success, $response)
    {
        return (new Response())->setRaw($response)->map([
            'isRedirect'    => false,
            'success'       => $success,
            'reference'     => $success ? $response['id'] : null,
            'message'       => $success ? 'Transaction approved' : Arr::get($response, 'message'),
            'test'          => $this->getTest($response),
            'authorization' => $success ? $this->getAuthorization($response) : false,
            'status'        => $success ? $this->getStatus($response) : new Status('failed'),
            'errorCode'     => $success ? null : $this->getErrorCode(Arr::get($response, 'code')),
            'type'          => array_key_exists('type', $response) ? Arr::get($response, 'type') : Arr::get($response, 'object'),
        ]);
    }
502320
private function performResponse($response)
    {
        $data = false;
        if ($response instanceof ResponseInterface) {
            $data = json_decode($response->getBody()->getContents());
            $this->getValidationResponse()->validateResponseData($data);
        }

        return $data;
    }
870282
private function decorateResponse(Response $response)
    {
        if ($response instanceof Http\Response) {
            return $response;
        }

        return new Http\Response($response);
    }
1133182
public function behave(Response $response)
    {
        return new Response(
            json_decode($response->content(), true),
            $response->contentType(),
            $response->error(),
            $response->errorCode(),
            $response->headerLines(),
            $response->statusCode()
        );
    }
1295243
public function populate(MoipResponse $response)
    {
        if (is_array($response)) {
            $this->data = (object) $response;

            return $this;
        }

        $this->data = $response->getResults();

        return $this;
    }
1244449
public function processResponse(\Amp\Artax\Response $response) {
        $instance = $this->api->instantiateResult($response, $this);

        return $instance;
    }
1248642
public function getUserFromTokenResponse($response)
    {
        $user = $this->mapUserToObject($this->getUserByToken(
            $token = $this->parseAccessToken($response)
        ));

        $this->credentialsResponseBody = $response;

        if ($user instanceof User) {
            $user->setAccessTokenResponseBody($this->credentialsResponseBody);
        }

        return $user->setToken($token)
            ->setRefreshToken($this->parseRefreshToken($response))
            ->setExpiresIn($this->parseExpiresIn($response));
    }
1039320
public function mapResponse($success, $response)
    {
        return (new Response())->setRaw($response)->map([
            'isRedirect'    => false,
            'success'       => $success,
            'reference'     => $success ? '12345' : null,
            'message'       => $success ? 'Approved' : 'Error',
            'test'          => false,
            'authorization' => $success ? '123' : '',
            'status'        => $success ? new Status('paid') : new Status('failed'),
            'errorCode'     => $success ? false : new ErrorCode('card_declined'),
            'type'          => 'charge',
        ]);
    }
1111566
public function persist(Response $response)
    {
        $trackingParameters = $this->trackingParameters->all();

        foreach ($trackingParameters as $trackingParameter => $value) {
            if (
                (null !== $value)
                && (true === in_array($trackingParameter, $this->cookiesToSave))
            ) {
                $response->headers->setCookie(new Cookie(
                    $trackingParameter,
                    $value,
                    new \DateTime('+1 year'),
                    '/',
                    null,
                    false,
                    false
                ));
            }
        }

        return $response;
    }
22697
public static function isSuccess(stdClass $response)
    {
        if (is_object($response) && $response->success == true) {
            return HttpCodes::isOk($response->http_code);
        } else {
            return false;
        }
    }
742809
public function SetStrategy(Response &$response)
    {
        if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
            return true;
        }
        $this->AuthClass = $this->provider::Get($this->classes::Instance())->GetLoginData();
        foreach ($this->permission as $val) {
            if (!in_array($val, $this->AuthClass[$this->dataKey])) {
                $this->PermissionDenied($response, $val);
            }
        }

        header('Cache-Control: must-revalidate');
        header('Cache-Control: no-cache');
        return true;
    }
871004
public function applyToResponse($response)
    {
        $headers = $this->generateHeadersFor($response);
        foreach ($headers as $name => $value) {
            if (!$response->getHeader($name)) {
                $response->addHeader($name, $value);
            }
        }
        return $this;
    }