/** * Upload missing files to upstream service * * @param $clientDocuments * @param callable $fileDetailCallback * @throws DocumentUploader\Exception\InvalidDetailType */ private function addMissing($clientDocuments, Closure $fileDetailCallback) { // $upstreamDocuments = $this->clientContext->getDocuments(array( // 'referencingApplicationUuId' => $this->application->getReferencingApplicationUuId(), // )); // Look for documents in the upload that aren't in IRIS // These should be added to IRIS. /** @var FormInterface $clientDocument */ foreach ($clientDocuments as $clientDocument) { // Get the uploaded file /** @var UploadedFile $uploadedFile */ $uploadedFileData = $clientDocument->getData(); $uploadedFile = $uploadedFileData['fileItem']; if ($uploadedFile) { // if (!$this->matchUpstreamDocument($uploadedFile->getClientOriginalName(), $upstreamDocuments)) { // File not found in IRIS, add the file $fileDetail = array(); if (null !== $fileDetailCallback) { $fileDetailResponse = $fileDetailCallback(array('uploadedFile' => $uploadedFile, 'application' => $this->application)); if (null !== $fileDetailResponse && !is_array($fileDetailResponse)) { // Invalid response throw new InvalidDetailType(sprintf('Response of type %s is invalid. Expected null or array.', get_class($fileDetailResponse))); } $fileDetail = $fileDetailResponse; } $fileName = !empty($fileDetail['uploadedFile']) && is_string($fileDetail['uploadedFile']) ? $fileDetail['uploadedFile'] : $uploadedFile->getClientOriginalName(); $fileName = rtrim($fileName, $uploadedFile->getClientOriginalExtension()); $fileName = $this->getSlugifier()->slugify($fileName, '_') . '.' . strtolower($uploadedFile->getClientOriginalExtension()); $description = !empty($fileDetail['description']) && is_string($fileDetail['description']) ? $fileDetail['description'] : ''; $this->clientContext->uploadDocument(array('referencingApplicationUuId' => $this->application->getReferencingApplicationUuId(), 'fileName' => $fileName, 'description' => $description, 'file' => $uploadedFile->getPathname(), 'categoryId' => DocumentCategoryOptions::MISCELLANEOUS)); // } } } }
/** * Handles the persistence of a note (persist & update) * * @param array $formStepData * @param \Barbondev\IRISSDK\IndividualApplication\ReferencingApplication\Model\ReferencingApplication $application * @return void */ public function handleNotePersistence(array $formStepData, ReferencingApplication $application) { $additionalInfoNote = $this->getAdditionalInformationHolderFromProgressiveStore(); if (!$additionalInfoNote instanceof AdditionalInformationHolder) { $additionalInfoNote = new AdditionalInformationHolder(); $this->progressiveStore->addPrototype($additionalInfoNote); } $additionalInfoMessage = ''; if (isset($formStepData['step']['additionalInfo'])) { $additionalInfoMessage = $formStepData['step']['additionalInfo']; } if ($additionalInfoMessage) { if ($additionalInfoNote->getNoteId()) { // If we have an existing additional info message, update $this->client->updateReferencingApplicationNote(array('applicationUuId' => $application->getReferencingApplicationUuId(), 'noteId' => $additionalInfoNote->getNoteId(), 'note' => $additionalInfoMessage)); $additionalInfoNote->setMessage($additionalInfoMessage); } else { // If we don't have an existing additional info message, create $note = $this->client->createReferencingApplicationNote(array('applicationUuId' => $application->getReferencingApplicationUuId(), 'note' => $additionalInfoMessage)); $additionalInfoNote->setNoteId($note->getNoteId())->setMessage($additionalInfoMessage); } } }
/** * Get DecisionDetails object from IRIS. * * @param ReferencingApplication $reference * @return \Barbondev\IRISSDK\IndividualApplication\ReferencingApplication\Model\ReferencingDecisionDetails */ public function getDecisionDetails(ReferencingApplication $reference) { return $this->clientRegistry->getAgentContext()->getReferencingApplicationClient()->getReferencingDecisionDetails(array('referencingApplicationUuId' => $reference->getReferencingApplicationUuId())); }