@param array $response

@return \Generated\Shared\Transfer\ComputopApiAuthorizeResponseTransfer
763556
protected function getResponseTransfer(array $response): ComputopApiAuthorizeResponseTransfer
    {
        $computopApiResponseTransfer = new ComputopApiAuthorizeResponseTransfer();
        $computopApiResponseTransfer->fromArray($response, true);
        $computopApiResponseTransfer->setHeader(
            $this->computopApiService->extractResponseHeader($response, $this->config->getAuthorizeMethodName())
        );
        //optional field
        $computopApiResponseTransfer->setRefNr($this->computopApiService->getResponseValue($response, ComputopApiConfig::REF_NR));

        return $computopApiResponseTransfer;
    }
806212
protected function getAuthorization($response)
    {
        $method = Arr::get($response, 'method');

        if ('card' == $method) {
            return Arr::get($response, 'authorization');
        }

        if ('bank_account' == $method) {
            $payment = Arr::get($response, 'payment_method', []);

            return Arr::get($payment, 'clabe');
        }

        if ('store' == $method) {
            $payment = Arr::get($response, 'payment_method', []);

            return Arr::get($payment, 'barcode_url');
        }
    }
483684
private function captchaResponse($response)
    {
        $errors = ['g-recaptcha-response' => ['Oops, something went wrong']];
        foreach ($response->getErrorCodes() as $k => $code) {
            if ($code == 'missing-input-response') {
                $code = 'Please confirm you are not a robot.';
            }
            $errors['g-recaptcha-response'][$k] = $code;
        }

        return new JsonResponse($errors, 422);
    }
125982
protected function updateResponseTransfer(AdyenApiResponseTransfer $responseTransfer, array $response): AdyenApiResponseTransfer
    {
        $apiResponseTransfer = (new AdyenApiMakePaymentResponseTransfer())->fromArray($response, true);

        return $responseTransfer->setMakePaymentResponse($apiResponseTransfer);
    }
162918
public function performAuthorizationRequest(
        OrderTransfer $orderTransfer,
        ComputopApiHeaderPaymentTransfer $computopApiHeaderPayment
    ): ComputopApiAuthorizeResponseTransfer {
        return $this
            ->getFactory()
            ->createAuthorizationPaymentRequest()
            ->request($orderTransfer, $computopApiHeaderPayment);
    }
1180522
protected function updateResponseTransfer(AdyenApiResponseTransfer $responseTransfer, array $response): AdyenApiResponseTransfer
    {
        $apiResponseTransfer = (new AdyenApiCancelResponseTransfer())->fromArray($response, true);

        return $responseTransfer->setCancelResponse($apiResponseTransfer);
    }
189123
public function getAuthorizationResponseTransfer(AuthorizationResponseContainer $responseContainer)
    {
        $result = new AuthorizationResponseTransfer();
        $clearing = new ClearingTransfer();
        $creditor = new CreditorTransfer();
        $baseResponse = new BaseResponseTransfer();

        // Fill clearing transfer
        $clearing->setBankAccountHolder($responseContainer->getClearingBankaccountholder());
        $clearing->setBankCountry($responseContainer->getClearingBankcountry());
        $clearing->setBankAccount($responseContainer->getClearingBankaccount());
        $clearing->setBankCode($responseContainer->getClearingBankcode());
        $clearing->setBankIban($responseContainer->getClearingBankiban());
        $clearing->setBankBic($responseContainer->getClearingBankbic());
        $clearing->setBankCity($responseContainer->getClearingBankcity());
        $clearing->setBankName($responseContainer->getClearingBankname());
        $clearing->setDate($responseContainer->getClearingDate());
        $clearing->setAmount($responseContainer->getClearingAmount());

        // Fill creditor transfer
        $creditor->setIdentifier($responseContainer->getCreditorIdentifier());
        $creditor->setName($responseContainer->getCreditorName());
        $creditor->setStreet($responseContainer->getCreditorStreet());
        $creditor->setZip($responseContainer->getCreditorZip());
        $creditor->setCity($responseContainer->getCreditorCity());
        $creditor->setCountry($responseContainer->getCreditorCountry());
        $creditor->setEmail($responseContainer->getCreditorEmail());

        // Fill base response transfer
        $baseResponse->setErrorCode($responseContainer->getErrorcode());
        $baseResponse->setErrorMessage($responseContainer->getErrormessage());
        $baseResponse->setCustomerMessage($responseContainer->getCustomermessage());
        $baseResponse->setStatus($responseContainer->getStatus());
        $baseResponse->setRawResponse($responseContainer->getRawResponse());

        // Set plain attributes
        $result->setTxid($responseContainer->getTxid());
        $result->setUserId($responseContainer->getUserid());
        $result->setProtectResultAvs($responseContainer->getProtectResultAvs());
        $result->setRedirectUrl($responseContainer->getMandateIdentification());
        $result->setMandateIdentification($responseContainer->getMandateIdentification());

        // Set aggregated transfers
        $result->setClearing($clearing);
        $result->setCreditor($creditor);
        $result->setBaseResponse($baseResponse);

        return $result;
    }
804984
protected function transformToComposer($response)
    {
        $analyserId = 'Bartlett\CompatInfo\Analyser\CompatibilityAnalyser';
        if (!isset($response[$analyserId])) {
            throw new \RuntimeException('Could not render result to Composer format');
        }
        $compatinfo = $response[$analyserId];

        // include PHP version
        $composer = array(
            'php' => '>= ' . $compatinfo['versions']['php.min']
        );

        // include extensions
        foreach ($compatinfo['extensions'] as $key => $val) {
            if (in_array($key, array('standard', 'Core'))) {
                continue;
            }
            $composer['ext-' . $key] = '*';
        }

        // final result
        $composer = array('require' => $composer);

        return $this->transformToJson($composer);
    }
143469
public static function setHeadersFromBrowserResponse(Response $response,
            MessageInterface $browserResponse)
    {
        $heasers_resp = Utils::getHeadersFromBrowserResponse($browserResponse);
        foreach($heasers_resp as $key => $value)
        {
            if(strtolower($key) !== "transfer-encoding"){
                $response->headers->set($key, $value);
            }
        }
    }
783867
protected function serializeResponse($response)
    {
        /** @var ResponseInterface $response */
        $serialized = serialize([
            $response->getStatusCode(),
            $response->getHeaders(),
            $response->getBody()->getContents(),
        ]);

        //subsequent calls need to access the stream from the beginning
        $response->getBody()->rewind();

        return $serialized;
    }
1055374
public function transform($response)
    {
        $binding = $this->getBinding($response);

        return $this->adapter->transform($response, $binding->resolveTransformer(), $binding, $this->getRequest());
    }
272357
public function getResponseArray($response)
    {
        $return = [];

        if (!($response instanceof Response)) {
            $this->errors[] = [
                // this error is coming from us, not the Chargify API response
                'source'    => 'client',
                'attribute' => null,
                'kind'      => 'networking',
                'message'   => 'no response'
            ];

            return $return;
        }

        /**
         * add error for bad status codes
         */
        $code       = $response->getStatusCode();
        $errorCodes = [404, 401, 500];
        if (in_array($code, $errorCodes)) {
            $this->errors[] = [
                // this error is coming from us, not the Chargify API response
                'source'    => 'client',
                'attribute' => null,
                'kind'      => 'status_code',
                'message'   => 'Bad status code: ' . $code
            ];
        }

        $body = $response->getBody();
        $body = trim((string)$body);

        /**
         * Return early if we have an empty body, which we can't turn into an array
         * anyway. This happens in cases where the API returns a 404, and possibly
         * other status codes.
         */
        if (empty($body)) {
            return $return;
        }

        $return = json_decode($body, true);

        // set errors, if any
        if (!empty($return['result']['errors'])) {
            foreach ($return['result']['errors'] as $error) {
                $this->errors[] = $error;
            }
        }

        /**
         * NOTE: There is also, maybe, an errors array nested in $return['meta']['errors']
         *       Why is this API so inconsistent???!!!!!
         */

        return $return;
    }
266561
public function import(Response $response)
    {
        $this->clear();
        foreach ($response->toArray() as $key => $value) {
            $this->offsetSet($key, $value);
        }

        return $this;
    }
50690
public function handleResponse($response)
    {
        // recursion for batch
        if (is_array($response)) {
            $response_arr = array();
            foreach ($response as $res) {
                $response_arr[$res->id] = $this->handleResponse($res);
            }
            return $response_arr;
        }

        // return error response
        if (property_exists($response, 'error')) {
            return new Response(null, $response->id, $response->error->code, $response->error->message);
        }

        // return successful response
        return new Response($response->result, $response->id);
    }
572920
public function vaultCard( array $response ){
        if (isset($response['card'])) {
            // Get the card token
            $cardToken = $response['card']['id'];
            
            // Prepare the card data
            $cardData = [];
            $cardData['expiryMonth']   = $response['card']['expiryMonth'];
            $cardData['expiryYear']    = $response['card']['expiryYear'];
            $cardData['last4']         = $response['card']['last4'];
            $cardData['paymentMethod'] = $response['card']['paymentMethod'];

            // Get the payment token
            $paymentToken = $this->vaultTokenFactory->create($cardData, $this->customerSession->getCustomer()->getId());
            
            try {
                // Check if the payment token exists
                $foundPaymentToken = $this->paymentTokenManagement->getByPublicHash( $paymentToken->getPublicHash(), $paymentToken->getCustomerId());

                // If the token exists activate it, otherwise create it
                if ($foundPaymentToken) {
                    $foundPaymentToken->setIsVisible(true);
                    $foundPaymentToken->setIsActive(true);
                    $this->paymentTokenRepository->save($foundPaymentToken);
                }
                else {
                    $paymentToken->setGatewayToken($cardToken);
                    $paymentToken->setIsVisible(true);
                    $this->paymentTokenRepository->save($paymentToken);
                } 

                $this->messageManager->addSuccessMessage( __('The payment card has been stored successfully') );
            }    
            catch (\Exception $ex) {
                $this->messageManager->addErrorMessage( $ex->getMessage() );
            }
        }
        else {
            $this->messageManager->addErrorMessage( __('Invalid gateway response. Please contact the site administrator.') );
        }
    }
737208
private function _createPreauthorization($response)
    {
        $model = new Preauthorization();
        $model->setId($response['id']);
        $model->setAmount($response['amount']);
        $model->setCurrency($response['currency']);
        $model->setStatus($response['status']);
        $model->setLivemode($response['livemode']);
        $model->setCreatedAt($response['created_at']);
        $model->setUpdatedAt($response['updated_at']);
        $model->setPayment($this->_convertResponseToModel($response['payment'], "payment"));
        $model->setClient($this->_convertResponseToModel($response['client'], "client"));
        $model->setTransaction(isset($response['transaction']) ? $this->_convertResponseToModel($response['transaction'], 'transaction') : null);
        $model->setAppId($response['app_id']);
        $model->setDescription($response['description']);
        return $model;
    }
868275
public function selfFromResponse(array $response)
    {
        $this->fill($response);

        foreach ($this->getSingleNestedEntities() as $key => $value) {
            if (isset($response[$key])) {
                $entityName = $value;
                $this->$key = new $entityName($this->connection, $response[$key]);
            }
        }

        foreach ($this->getMultipleNestedEntities() as $key => $value) {
            if (isset($response[$key])) {
                $entityName = $value['entity'];
                /** @var self $instantiatedEntity */
                $instantiatedEntity = new $entityName($this->connection);
                $this->$key = $instantiatedEntity->collectionFromResult($response[$key]);
            }
        }

        return $this;
    }