diff --git a/app/Classes/Modules/Documents/ControllersLogic/UpdateDocumentReferenceLogic.php b/app/Classes/Modules/Documents/ControllersLogic/UpdateDocumentReferenceLogic.php new file mode 100644 index 00000000..e5d59101 --- /dev/null +++ b/app/Classes/Modules/Documents/ControllersLogic/UpdateDocumentReferenceLogic.php @@ -0,0 +1,68 @@ + 'Update Document Reference', + 'message' => 'You have successfully updated the Document Reference' + ]; + } + + /** @var CanUpdateDocumentReference*/ + private $canUpdateDocumentReference; + + /** @var UpdatesDocumentReference */ + private $updatesDocumentReference; + + /** @var FetchesDocument */ + private $fetchesDocument; + + + /** + * RejectDocumentLogic constructor. + * @param CanApproveDocument $canApproveDocument + * @param ApprovesDocument $approvesDocument + * @param FetchesDocument $fetchesDocument + */ + public function __construct(CanUpdateDocumentReference $canUpdateDocumentReference, UpdatesDocumentReference $updatesDocumentReference, FetchesDocument $fetchesDocument) + { + $this->canUpdateDocumentReference = $canUpdateDocumentReference; + $this->updatesDocumentReference = $updatesDocumentReference; + $this->fetchesDocument = $fetchesDocument; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + $document = $this->fetchesDocument->execute(['id' => $request->route('id')]); + + $this->canUpdateDocumentReference->passes(); + + $document_query = $this->updatesDocumentReference->execute($document, $request->input('identification_number')); + + return $this->resourceResponse(new DocumentResource($document_query)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Documents/Services/UpdatesDocumentReference.php b/app/Classes/Modules/Documents/Services/UpdatesDocumentReference.php new file mode 100644 index 00000000..23a16e02 --- /dev/null +++ b/app/Classes/Modules/Documents/Services/UpdatesDocumentReference.php @@ -0,0 +1,20 @@ +reference = $reference; + return $this->handler($model); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Documents/Standards/Rules/CanUpdateDocumentReference.php b/app/Classes/Modules/Documents/Standards/Rules/CanUpdateDocumentReference.php new file mode 100644 index 00000000..e6a29785 --- /dev/null +++ b/app/Classes/Modules/Documents/Standards/Rules/CanUpdateDocumentReference.php @@ -0,0 +1,39 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue b/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue index c5c26590..1c14a0fe 100644 --- a/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue +++ b/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue @@ -77,9 +77,21 @@