@param \Generated\Shared\Transfer\RestCompaniesResponseTransfer $restCompaniesResponseTransfer

@return \Spryker\Glue\GlueApplication\Rest\JsonApi\RestResponseInterface
186641
protected function createCompanyLoadedResponse(
        RestCompaniesResponseTransfer $restCompaniesResponseTransfer
    ): RestResponseInterface {
        $restCompaniesResponseAttributesTransfer = $restCompaniesResponseTransfer->getRestCompaniesResponseAttributes();

        $restResource = $this->restResourceBuilder->createRestResource(
            CompaniesRestApiConfig::RESOURCE_COMPANIES,
            $restCompaniesResponseAttributesTransfer->getExternalReference(),
            $restCompaniesResponseAttributesTransfer
        );

        return $this->restResourceBuilder
            ->createRestResponse()
            ->addResource($restResource);
    }
1190841
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createMerchantRelationshipDataImport()->import($dataImporterConfigurationTransfer);
    }
801495
public function expandBrandTransferWithProductAbstractRelations(BrandTransfer $brandTransfer): BrandTransfer
    {
        $brandTransfer->setBrandProductAbstractRelation(new BrandProductAbstractRelationTransfer());

        $brandProductAbstractRelationTransfer = $this->brandReader->getProductAbstractCollectionByBrand(
            $brandTransfer
        );

        $this->addProductAbstractRelationsToBrandTransfer($brandTransfer, $brandProductAbstractRelationTransfer);

        return $brandTransfer;
    }
493753
public function add(BrandTransfer $brandTransfer): BrandResponseTransfer
    {
        $brandEntity = $this->createFosBrandEntity($brandTransfer);
        $brandEntity->save();

        $brandTransfer->setIdBrand($brandEntity->getPrimaryKey());

        $brandResponseTransfer = new BrandResponseTransfer();
        $brandResponseTransfer
            ->setIsSuccess(true)
            ->setBrandTransfer($brandTransfer);

        return $brandResponseTransfer;
    }
1351625
public function placeRequest(TransferInterface $transferObject) {
        
        if ($this->gatewayResponseHolder->hasCallbackResponse()) {
            $response = $this->gatewayResponseHolder->getGatewayResponse();

            $this->logger->debug([
                'action'    => 'callback',
                'response'  => $response,
            ]);

            return $response;
        }

        // Prepare the transfert data
        $this->prepareTransfer($transferObject);

        // Update the email field for guest users
        $this->updateGuestEmail($this->body);

        // Prepare some log data
        $log = [
            'request'           => $this->body,
            'request_uri'       => $this->fullUri,
            'request_headers'   => $transferObject->getHeaders(),
            'request_method'    => $this->getMethod(),
        ];

        $result = [];

        $client = $this->clientFactory;
        $client->setConfig($transferObject->getClientConfig());
        
        $client->setMethod($this->getMethod());

        switch($this->getMethod()) {
            case \Zend_Http_Client::GET:
                $client->setRawData( json_encode($this->body) ) ;
                break;
            case \Zend_Http_Client::POST:
                $client->setRawData( json_encode($this->body) ) ;
                break;
            default:
                throw new \LogicException( sprintf('Unsupported HTTP method %s', $transferObject->getMethod()) );
        }

        $client->setHeaders($transferObject->getHeaders());
        $client->setUri($this->fullUri);
        
        try {
            $response           = $client->request();
            
            $result             = json_decode($response->getBody(), true);
            $log['response']    = $result;

            if( array_key_exists('errorCode', $result) ) {
                $exception = new ApiClientException($result['message'], $result['errorCode'], $result['eventId']);

                $this->messageManager->addErrorMessage( $exception->getFullMessage() );

                throw $exception;
            }
        }
        catch (Zend_Http_Client_Exception $e) {
            throw new ClientException(__($e->getMessage()));
        }
        finally {
            $this->logger->debug($log);
        }

        return $result;
    }
537500
public function getCreditCardCheckResponseTransfer(CreditCardCheckResponseContainer $responseContainer)
    {
        $result = new CreditCardCheckResponseTransfer();
        $baseResponse = new BaseResponseTransfer();

        // 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->setPseudoCardPan($responseContainer->getPseudocardpan());
        $result->setTruncatedCardPan($responseContainer->getTruncatedcardpan());

        // Set aggregated transfers
        $result->setBaseResponse($baseResponse);

        return $result;
    }
548465
protected function updateResponseTransfer(AdyenApiResponseTransfer $responseTransfer, array $response): AdyenApiResponseTransfer
    {
        $apiResponseTransfer = (new AdyenApiAuthorize3dResponseTransfer())->fromArray($response, true);

        return $responseTransfer->setAuthorize3dResponse($apiResponseTransfer);
    }
873870
public function getDebitResponseTransfer(DebitResponseContainer $responseContainer)
    {
        $result = new DebitResponseTransfer();
        $baseResponse = new BaseResponseTransfer();

        // 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->setSettleAccount($responseContainer->getSettleaccount());

        // Set aggregated transfers
        $result->setBaseResponse($baseResponse);

        return $result;
    }
1172489
public function importCompanyUserRoles(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createCompanyUserRoleDataImport()->import($dataImporterConfigurationTransfer);
    }
1313244
public function saveProductListCompanyRelation(
        ProductListCompanyRelationTransfer $productListCompanyRelationTransfer
    ): ProductListCompanyRelationTransfer {
        return $this->getTransactionHandler()->handleTransaction(
            function () use ($productListCompanyRelationTransfer) {
                return $this->executeSaveProductListCompanyRelationTransaction($productListCompanyRelationTransfer);
            }
        );
    }
1335383
public function convertToResponseTransfer(ResponseInterface $response, $isSuccess = true): AdyenApiResponseTransfer
    {
        $responseBody = $this->encodingService->decodeJson($response->getBody(), true);
        $responseTransfer = new AdyenApiResponseTransfer();
        $responseTransfer->setIsSuccess($isSuccess);

        if ($isSuccess) {
            return $this->updateResponseTransfer($responseTransfer, $responseBody);
        }

        $error = (new AdyenApiErrorResponseTransfer())->fromArray($responseBody, true);
        $responseTransfer->setError($error);

        return $responseTransfer;
    }
904696
public function create(
        RestCompanyBusinessUnitsRequestAttributesTransfer $restCompanyBusinessUnitsRequestAttributesTransfer
    ): RestCompanyBusinessUnitsResponseTransfer {
        $companyBusinessUnitTransfer = new CompanyBusinessUnitTransfer();

        foreach ($this->companyBusinessUnitMapperPlugins as $companyBusinessUnitMapperPlugin) {
            $companyBusinessUnitTransfer = $companyBusinessUnitMapperPlugin->map(
                $restCompanyBusinessUnitsRequestAttributesTransfer,
                $companyBusinessUnitTransfer
            );
        }

        try {
            $companyBusinessUnitResponseTransfer = $this->companyBusinessUnitFacade->create($companyBusinessUnitTransfer);
        } catch (PropelException $e) {
            return $this->createCompanyBusinessUnitDataInvalidErrorResponse();
        }

        if (!$companyBusinessUnitResponseTransfer->getIsSuccessful()) {
            return $this->createCompanyBusinessUnitDataInvalidErrorResponse();
        }

        return $this->createCompanyBusinessUnitResponseTransfer(
            $companyBusinessUnitResponseTransfer->getCompanyBusinessUnitTransfer()
        );
    }
596589
public function update(RestCompaniesRequestTransfer $restCompaniesRequestTransfer): RestCompaniesResponseTransfer
    {
        $companyTransfer = $this->companiesRestApiRepository
            ->findCompanyByExternalReference($restCompaniesRequestTransfer->getId());

        if ($companyTransfer === null) {
            return $this->createCompanyFailedToLoadErrorResponseTransfer();
        }

        foreach ($this->companyMapperPlugins as $companyMapperPlugin) {
            $companyTransfer = $companyMapperPlugin->map(
                $restCompaniesRequestTransfer->getRestCompaniesRequestAttributes(),
                $companyTransfer
            );
        }

        try {
            $companyResponseTransfer = $this->companyFacade->update($companyTransfer);
        } catch (PropelException $e) {
            return $this->createCompanyDataInvalidErrorResponse();
        }

        if (!$companyResponseTransfer->getIsSuccessful()) {
            return $this->createCompanyDataInvalidErrorResponse();
        }

        return $this->createCompanyResponseTransfer(
            $companyResponseTransfer->getCompanyTransfer()
        );
    }
218438
protected function createCompanyResponseTransfer(CompanyTransfer $companyTransfer): RestCompaniesResponseTransfer
    {
        $restCompaniesResponseAttributesTransfer = new RestCompaniesResponseAttributesTransfer();

        $restCompaniesResponseAttributesTransfer->fromArray(
            $companyTransfer->toArray(),
            true
        );

        $restCompaniesResponseTransfer = new RestCompaniesResponseTransfer();

        $restCompaniesResponseTransfer->setIsSuccess(true)
            ->setRestCompaniesResponseAttributes($restCompaniesResponseAttributesTransfer);

        return $restCompaniesResponseTransfer;
    }
1271551
public function importCompanyRolePermissions(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createCompanyRolePermissionDataImport()->import($dataImporterConfigurationTransfer);
    }
457182
public function findCompanyBusinessUnitByExternalReference(
        RestCompanyBusinessUnitsRequestAttributesTransfer $restCompanyBusinessUnitsRequestAttributesTransfer
    ): RestCompanyBusinessUnitsResponseTransfer {
        /** @var \Generated\Shared\Transfer\RestCompanyBusinessUnitsResponseTransfer $restCompanyBusinessUnitsResponseTransfer */
        $restCompanyBusinessUnitsResponseTransfer = $this->zedRequestClient->call(
            '/company-business-units-rest-api/gateway/find-company-business-unit-by-external-reference',
            $restCompanyBusinessUnitsRequestAttributesTransfer
        );

        return $restCompanyBusinessUnitsResponseTransfer;
    }
683621
public function findCompanyBusinessUnitByExternalReference(RestRequestInterface $restRequest): RestResponseInterface
    {
        $restResponse = $this->restResourceBuilder->createRestResponse();

        if (!$restRequest->getResource()->getId()) {
            return $this->restApiError->addExternalReferenceMissingError($restResponse);
        }

        $restCompanyBusinessUnitsRequestAttributesTransfer = new RestCompanyBusinessUnitsRequestAttributesTransfer();
        $restCompanyBusinessUnitsRequestAttributesTransfer->setExternalReference($restRequest->getResource()->getId());

        $restCompanyBusinessUnitsResponseTransfer = $this->companyBusinessUnitsRestApiClient
            ->findCompanyBusinessUnitByExternalReference($restCompanyBusinessUnitsRequestAttributesTransfer);

        if (!$restCompanyBusinessUnitsResponseTransfer->getIsSuccess()) {
            return $this->createLoadCompanyBusinessUnitFailedErrorResponse($restCompanyBusinessUnitsResponseTransfer);
        }

        return $this->createCompanyBusinessUnitLoadedResponse($restCompanyBusinessUnitsResponseTransfer);
    }