@param \Generated\Shared\Transfer\RestCompaniesRequestAttributesTransfer $restCompaniesRequestAttributesTransfer
@param \Generated\Shared\Transfer\CompanyTransfer $companyTransfer

@return \Generated\Shared\Transfer\CompanyTransfer
541839
public function mapToCompany(
        RestCompaniesRequestAttributesTransfer $restCompaniesRequestAttributesTransfer,
        CompanyTransfer $companyTransfer
    ): CompanyTransfer {
        if ($restCompaniesRequestAttributesTransfer->getExternalReference() !== null) {
            $companyTransfer->setExternalReference(
                $restCompaniesRequestAttributesTransfer->getExternalReference()
            );
        }

        if ($restCompaniesRequestAttributesTransfer->getName() !== null) {
            $companyTransfer->setName($restCompaniesRequestAttributesTransfer->getName());
        }

        return $companyTransfer;
    }
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;
    }
377894
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()
            ->getProductQuantityDataImporter()
            ->import($dataImporterConfigurationTransfer);
    }
634255
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createPriceProductMerchantRelationshipDataImport()->import($dataImporterConfigurationTransfer);
    }
459368
public function deleteCompanyBusinessUnitStoreAddress(CompanyBusinessUnitStoreAddressTransfer $companyBusinessUnitStoreAddressTransfer): void
    {
        $this->getFactory()
            ->createFosCompanyBusinessUnitStoreAddressQuery()
            ->findOneByIdCompanyBusinessUnitStoreAddress($companyBusinessUnitStoreAddressTransfer->getIdCompanyBusinessUnitStoreAddress())
            ->delete();
    }
748407
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createCategoryImporter()->import($dataImporterConfigurationTransfer);
    }
183736
public function addExternalReferenceMissingError(RestResponseInterface $restResponse): RestResponseInterface
    {
        $restErrorTransfer = (new RestErrorMessageTransfer())
            ->setCode(CompanyBusinessUnitsRestApiConfig::RESPONSE_CODE_EXTERNAL_REFERENCE_MISSING)
            ->setStatus(Response::HTTP_BAD_REQUEST)
            ->setDetail(CompanyBusinessUnitsRestApiConfig::RESPONSE_DETAILS_EXTERNAL_REFERENCE_MISSING);

        return $restResponse->addError($restErrorTransfer);
    }
950405
public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()->createCompanyUnitAddressLabelDataImport()->import($dataImporterConfigurationTransfer);
    }
781359
protected function createLoadCompanyFailedErrorResponse(
        RestCompaniesResponseTransfer $restCompaniesResponseTransfer
    ): RestResponseInterface {
        $restResponse = $this->restResourceBuilder->createRestResponse();

        foreach ($restCompaniesResponseTransfer->getErrors() as $restCompaniesErrorTransfer) {
            $restResponse->addError((new RestErrorMessageTransfer())
                ->setCode($restCompaniesErrorTransfer->getCode())
                ->setStatus($restCompaniesErrorTransfer->getStatus())
                ->setDetail($restCompaniesErrorTransfer->getDetail()));
        }

        return $restResponse;
    }
6399
public function update(RestCompanyBusinessUnitsRequestTransfer $restCompanyBusinessUnitsRequestTransfer
    ): RestCompanyBusinessUnitsResponseTransfer
    {
        /** @var \Generated\Shared\Transfer\RestCompanyBusinessUnitsResponseTransfer $restCompanyBusinessUnitsResponseTransfer */
        $restCompanyBusinessUnitsResponseTransfer = $this->zedRequestClient->call(
            '/company-business-units-rest-api/gateway/update',
            $restCompanyBusinessUnitsRequestTransfer
        );

        return $restCompanyBusinessUnitsResponseTransfer;
    }
1039749
public function refundPayment(PayoneRefundTransfer $refundTransfer)
    {
        $payonePaymentTransfer = $refundTransfer->getPayment();

        $paymentEntity = $this->getPaymentEntity($payonePaymentTransfer->getFkSalesOrder());
        $paymentMethodMapper = $this->getPaymentMethodMapper($paymentEntity);
        $requestContainer = $paymentMethodMapper->mapPaymentToRefund($paymentEntity);
        $requestContainer->setAmount(0 - $paymentEntity->getSpyPaymentPayoneDetail()->getAmount());
        $requestContainer = $this->prepareOrderItems($refundTransfer->getOrder(), $requestContainer);
        $requestContainer = $this->prepareOrderShipment($refundTransfer->getOrder(), $requestContainer);
        $requestContainer = $this->prepareOrderDiscount($refundTransfer->getOrder(), $requestContainer);

        $this->setStandardParameter($requestContainer);

        $apiLogEntity = $this->initializeApiLog($paymentEntity, $requestContainer);

        $rawResponse = $this->executionAdapter->sendRequest($requestContainer);
        $responseContainer = new RefundResponseContainer($rawResponse);

        $this->updateApiLogAfterRefund($apiLogEntity, $responseContainer);

        $responseMapper = new RefundResponseMapper();
        $responseTransfer = $responseMapper->getRefundResponseTransfer($responseContainer);

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

        return $restCompanyBusinessUnitsResponseTransfer;
    }
815374
public function getProductAbstractCollectionByBrand(BrandTransfer $brandTransfer): BrandProductAbstractRelationTransfer
    {
        $brandTransfer->requireIdBrand();

        return $this->brandProductRepository->getProductAbstractCollectionByBrandId($brandTransfer->getIdBrand());
    }
1148537
public function getInvoice(PayoneGetInvoiceTransfer $getInvoiceTransfer)
    {
        $responseContainer = new GetInvoiceResponseContainer();
        $paymentEntity = $this->findPaymentByInvoiceTitleAndCustomerId(
            $getInvoiceTransfer->getReference(),
            $getInvoiceTransfer->getCustomerId()
        );

        if ($paymentEntity) {
            /** @var \SprykerEco\Zed\Payone\Business\Payment\MethodMapper\Invoice $paymentMethodMapper */
            $paymentMethodMapper = $this->getRegisteredPaymentMethodMapper(PayoneApiConstants::PAYMENT_METHOD_INVOICE);
            $requestContainer = $paymentMethodMapper->mapGetInvoice($getInvoiceTransfer);
            $this->setStandardParameter($requestContainer);
            $rawResponse = $this->executionAdapter->sendRequest($requestContainer);
            $responseContainer->init($rawResponse);
        } else {
            $this->setAccessDeniedError($responseContainer);
        }

        $getInvoiceTransfer->setRawResponse($responseContainer->getRawResponse());
        $getInvoiceTransfer->setStatus($responseContainer->getStatus());
        $getInvoiceTransfer->setErrorCode($responseContainer->getErrorcode());
        $getInvoiceTransfer->setInternalErrorMessage($responseContainer->getErrormessage());

        return $getInvoiceTransfer;
    }
814870
public function preSaveValidation(CompanyResponseTransfer $companyResponseTransfer): CompanyResponseTransfer
    {
        $companyTransfer = $companyResponseTransfer->getCompanyTransfer();

        if (!$companyTransfer) {
            return $companyResponseTransfer;
        }

        $externalReference = $companyTransfer->getExternalReference();

        if (!$externalReference) {
            $companyResponseTransfer->setIsSuccessful(false);
            $companyResponseTransfer->addMessage(
                $this->createResponseMessageTransfer(static::COMPANY_EXTERNAL_REFERENCE_INVALID)
            );

            return $companyResponseTransfer;
        }

        $tempCompanyTransfer = $this->getRepository()->findCompanyByExternalReference($externalReference);

        if ($tempCompanyTransfer === null) {
            return $companyResponseTransfer;
        }

        if ($tempCompanyTransfer && $tempCompanyTransfer->getIdCompany() === $companyTransfer->getIdCompany()) {
            return $companyResponseTransfer;
        }

        $companyResponseTransfer->setIsSuccessful(false);
        $companyResponseTransfer->addMessage(
            $this->createResponseMessageTransfer(static::COMPANY_EXTERNAL_REFERENCE_ALREADY_USED)
        );

        return $companyResponseTransfer;
    }
832179
public function importProductMeasurementSalesUnitStore(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()
            ->getProductMeasurementSalesUnitStoreDataImporter()
            ->import($dataImporterConfigurationTransfer);
    }