From 0016d802b0b5b5426a33de16cd3d61cbbf5cf863 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Wed, 2 Jul 2025 18:39:24 +0800 Subject: [PATCH 1/3] E-Invoice - Allow SSM Registration / Identification Card number to be updated without a document upload mainly for old customer --- .../UpdateCompanyDetailsLogic.php | 45 ++++++++++++++++-- .../assets/images/ssm_ic_placeholder.png | Bin 0 -> 3733 bytes ...ngeCustomerCompanyDetailsFormComponent.vue | 4 +- 3 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 resources/assets/images/ssm_ic_placeholder.png diff --git a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php index dea2b21c..001ae1c6 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php @@ -2,7 +2,6 @@ namespace App\Classes\Modules\Companies\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; -use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject; use App\Classes\Modules\Companies\Services\FetchesCompany; use App\Classes\Modules\Companies\Services\UpdatesCompany; use App\Classes\Modules\Companies\Services\UpdatesCompanyDebtor; @@ -11,11 +10,18 @@ use App\Classes\Modules\Addresses\Services\FetchesDistrict; use App\Classes\Modules\Addresses\Services\UpdatesAddressMetadata; use App\Classes\Modules\Documents\Services\FetchesDocument; use App\Classes\Modules\Documents\Services\UpdatesDocumentReference; -use App\Classes\Modules\Addresses\Standards\Rules\CanCreateAddress; -use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject; use App\Classes\Modules\Companies\Services\UpdatesCompanyEInvoiceInfo; +use App\Classes\Modules\Documents\Services\CreatesDocument; +use App\Classes\Modules\Documents\Services\CreatesFiles; use App\Classes\Modules\Companies\Standards\Rules\CanUpdateCompany; +use App\Classes\Modules\Addresses\Standards\Rules\CanCreateAddress; +use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject; +use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject; use App\Classes\Modules\Companies\DataTransferObjects\UpdateCompanyDetailsDTO; +use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject; +use App\Classes\ValueObjects\Constants\ApprovalStatus; +use App\Classes\ValueObjects\Constants\CompanyType; +use App\Classes\ValueObjects\Constants\DocumentType; use App\Http\Resources\CompanyResource; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -65,6 +71,12 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic /** @var UpdatesDocumentReference */ private $updatesDocumentReference; + /** @var CreatesDocument */ + private $createsDocument; + + /** @var CreatesFiles */ + private $createsFile; + /** * UpdateCompanyDetailsLogic constructor. @@ -80,7 +92,8 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic * @param UpdatesAddressMetadata $updatesAddressMetadata * @param FetchesDocument $fetchesDocument * @param UpdatesDocumentReference $updatesDocumentReference - * + * @param CreatesDocument $createsDocument + * @param CreatesFiles $createsFile */ public function __construct( CanUpdateCompany $canUpdateCompany, @@ -93,7 +106,9 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic UpdatesCompanyEInvoiceInfo $updatesCompanyEInvoiceInfo, UpdatesAddressMetadata $updatesAddressMetadata, FetchesDocument $fetchesDocument, - UpdatesDocumentReference $updatesDocumentReference + UpdatesDocumentReference $updatesDocumentReference, + CreatesDocument $createsDocument, + CreatesFiles $createsFile ) { $this->canUpdateCompany = $canUpdateCompany; @@ -108,6 +123,8 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic $this->updatesAddressMetadata = $updatesAddressMetadata; $this->fetchesDocument = $fetchesDocument; $this->updatesDocumentReference = $updatesDocumentReference; + $this->createsDocument = $createsDocument; + $this->createsFile = $createsFile; } /** @@ -146,6 +163,24 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic $document = $this->fetchesDocument->execute(['id' => $dto->identificationId]); $this->updatesDocumentReference->execute($document, $dto->identificationReference); } + else{ + $pathToFile = base_path('resources/assets/images/ssm_ic_placeholder.png'); + $mimeType = mime_content_type($pathToFile); + $fileContents = file_get_contents($pathToFile); + $base64 = base64_encode($fileContents); + $base64File = "data:$mimeType;base64,$base64"; + $files = [$base64File]; + + /** @var Document $document */ + $company = $this->fetchesCompany->execute(['id' => $dto->id]); + + $object = new DocumentObject($company->type === CompanyType::COMPANY_BUSINESS ? + DocumentType::SSM_REGISTRATION : DocumentType::IDENTITY_CARD, $files, + $dto->identificationReference, ApprovalStatus::PENDING_VERIFICATION, 'identifications'); + + $document = $this->createsDocument->execute($company, $object); + $this->createsFile->execute($document, $object); + } return $this->resourceResponse(new CompanyResource($company)); } diff --git a/resources/assets/images/ssm_ic_placeholder.png b/resources/assets/images/ssm_ic_placeholder.png new file mode 100644 index 0000000000000000000000000000000000000000..f4b2eef5f726171125d0e8ee4b0bdd6d94cfe290 GIT binary patch literal 3733 zcmV;G4r=jPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D4k}4RK~#8N?VSaz zB*hkn8((~JmH>YkpSd#AbeCx7mpnVy=-{Bus7I_FeP5)ly*5fKp)5fKp)5fKs5H5h-MB$=e! zY2N3A_U%Trh4YhS$e1KKtJ^s!Nj7M_<%o9hRFbTtBvDHoZ#@6~9pn;8a$@5xN3??) z34TK3El0G2r;}ua?*k4pT6iZho#8NtOB#Yn4Y@t^uUlnMBf4tW zf5Hi^z*9^i%{Zep^UTr=Gf0z9Ztv&uHoZb05`1FA8JoC<;ctfb81}N@6HFjYJ+(CF zoYG>8Nh_}`ZL*29`R39F8`#_2Ki6E+lvB24@qIXGTguRU1j)ySCpG@>1;Mf0>8F<# zS;UIF>#ow#M@u6|O6Q#?opFYA)KT_+9$#o7dp*zdjhVwfWZ^DS!Qr2VzZjMmyj0MJ zrOq^yG<>+U@4nK-7fbitBfao~^yZt=TW?9Pziw}H|3w!``|KmFwwirj3HKf?{C`${ zm|+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#o%uW&J<|2s`z#%>qR9Krcujhd; z1e+EEOEOr{!h52{DP=3icGYAKheXcDA78A$tqeH9iE3LQV1tg}Ra(>S!tVXa@{#}1n<^4yyj7QO01kbHyiq~@*?N8gpgV{zi3E*TVOes zvgU%<%)%kHZkil8&xK`I+21`uY+?b96Cv3`KYNZlhXn=ibYFTieRKHVAWBb(D6}H) zzPoKrD*NjQcn2zDuL!w8TQkYLk%-|;7rIQAx`aoyQ5% zXr`e0#`fYC_o6w1N0dd&g0o(xipI%{v@Y?3vurEoh;3JRteP(bCp|s!ge`#*l?P61 z%Aygxc^w{67A*@7Q_<-%<%i+vH>Wd(V2=Db5jaH@>fl86v^!H~rO}b+6`Z%587;gb zv^0mOWSK@Q6WfK>Si|lp;g=IGyUeyWvtGaPM(Og)ZJwOXhO|0yT5@v>R11uPSAZ6p=f7##pl9t~ql1po65n_m;Na+V;88jY`{dPWm*&D0oFE<rPIrsN#7*D9mn6`@kWA&;f>JzkPg z@QP5m;2mNVydty}wDllk&{h$mh4(Ssm?Xo0N|MifA95ypSnzj~?csdsy&2ljOR|^AFUCD2kCu@{ch|@=&*Ot|ZyH@m3?Mz`!KwzgUtC?N;_n zlGz(?H6kJ+A|fIpA|fIpA|fIpA|j% -
+
- +
From c07e54f3949d70789354d7734afca4a9d2a5f972 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Wed, 2 Jul 2025 18:55:03 +0800 Subject: [PATCH 2/3] E-Invoice - Allow SSM Registration / Identification Card number to be updated without a document upload mainly for old customer --- .../forms/ChangeCustomerCompanyDetailsFormComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue b/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue index 2c180053..96d3abbe 100644 --- a/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue +++ b/resources/assets/vue/components/companies/forms/ChangeCustomerCompanyDetailsFormComponent.vue @@ -189,7 +189,7 @@ district_id: isEInvoiceEnabled ? { required } : {}, state_id: isEInvoiceEnabled ? { required } : {}, post_code: isEInvoiceEnabled ? { notZero, fiveDigits } : {}, - identification_reference: this.data.identification ? { required } : {}, + identification_reference: {}, } } }, From 84246658233f2f5186d92d704a2862c82f14061c Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Wed, 2 Jul 2025 19:02:03 +0800 Subject: [PATCH 3/3] E-Invoice - Allow SSM Registration / Identification Card number to be updated without a document upload mainly for old customer --- .../UpdateCompanyDetailsLogic.php | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php index 001ae1c6..3eeac355 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyDetailsLogic.php @@ -164,22 +164,24 @@ class UpdateCompanyDetailsLogic extends AbstractControllerLogic $this->updatesDocumentReference->execute($document, $dto->identificationReference); } else{ - $pathToFile = base_path('resources/assets/images/ssm_ic_placeholder.png'); - $mimeType = mime_content_type($pathToFile); - $fileContents = file_get_contents($pathToFile); - $base64 = base64_encode($fileContents); - $base64File = "data:$mimeType;base64,$base64"; - $files = [$base64File]; + if($dto->identificationReference){ + $pathToFile = base_path('resources/assets/images/ssm_ic_placeholder.png'); + $mimeType = mime_content_type($pathToFile); + $fileContents = file_get_contents($pathToFile); + $base64 = base64_encode($fileContents); + $base64File = "data:$mimeType;base64,$base64"; + $files = [$base64File]; - /** @var Document $document */ - $company = $this->fetchesCompany->execute(['id' => $dto->id]); + /** @var Document $document */ + $company = $this->fetchesCompany->execute(['id' => $dto->id]); - $object = new DocumentObject($company->type === CompanyType::COMPANY_BUSINESS ? - DocumentType::SSM_REGISTRATION : DocumentType::IDENTITY_CARD, $files, - $dto->identificationReference, ApprovalStatus::PENDING_VERIFICATION, 'identifications'); + $object = new DocumentObject($company->type === CompanyType::COMPANY_BUSINESS ? + DocumentType::SSM_REGISTRATION : DocumentType::IDENTITY_CARD, $files, + $dto->identificationReference, ApprovalStatus::PENDING_VERIFICATION, 'identifications'); - $document = $this->createsDocument->execute($company, $object); - $this->createsFile->execute($document, $object); + $document = $this->createsDocument->execute($company, $object); + $this->createsFile->execute($document, $object); + } } return $this->resourceResponse(new CompanyResource($company));