'Company Identification', 'message' => 'You have successfully created a new Company Identification Document' ]; } /** @var FetchesUser */ private $fetchesUser; /** @var FetchesCompany */ private $fetchesCompany; /** @var CreatesDocument */ private $createsDocument; /** @var CreatesFile */ private $createsFile; /** @var UpdatesCompanyStatus */ private $updatesCompanyStatus; /** * UpdateCompanyIdentificationDocumentLogic constructor. * @param FetchesUser $fetchesUser * @param FetchesCompany $fetchesCompany * @param CreatesDocument $createsDocument * @param CreatesFile $createsFile * @param UpdatesCompanyStatus $updatesCompanyStatus */ public function __construct(FetchesUser $fetchesUser, FetchesCompany $fetchesCompany, CreatesDocument $createsDocument, CreatesFile $createsFile, UpdatesCompanyStatus $updatesCompanyStatus) { $this->fetchesUser = $fetchesUser; $this->fetchesCompany = $fetchesCompany; $this->createsDocument = $createsDocument; $this->createsFile = $createsFile; $this->updatesCompanyStatus = $updatesCompanyStatus; } /** * @param Request $request * @return JsonResponse * @throws \App\Classes\Exceptions\MalformedRequestException */ public function logic(Request $request) : JsonResponse { /** @var Company $company */ $company = $this->fetchesCompany->execute(['id' => $request->route('id')]); $object = new DocumentObject($company->type === CompanyTypes::COMPANY_BUSINESS ? DocumentType::SSM_REGISTRATION: DocumentType::IDENTITY_CARD, $request->input('files'), $request->input('reference'), ApprovalStatus::PENDING_VERIFICATION, 'identifications'); /** @var Document $document */ $document = $this->createsDocument->execute($company, $object); $this->createsFile->execute($document, $object); $this->updatesCompanyStatus->execute($company, ApprovalStatus::PENDING_VERIFICATION); return $this->response([]); } }