mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Prevent user from uploading excel file as payment proof for manual transfer
This commit is contained in:
+15
@@ -3,6 +3,7 @@
|
||||
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
||||
|
||||
use App\Classes\Exceptions\CriteriaNotFulfilledException;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Bookings\DataTransferObjects\CreatePaymentVerificationDocumentDTO;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
@@ -21,6 +22,7 @@ use App\Models\Company;
|
||||
use App\Models\Document;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CreatePaymentVerificationDocumentLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -93,6 +95,19 @@ class CreatePaymentVerificationDocumentLogic extends AbstractControllerLogic
|
||||
|
||||
$object = new DocumentObject(DocumentType::CUSTOMER_PAYMENT_PROOF, $request->input('files'), '', ApprovalStatus::PENDING_VERIFICATION, 'payments');
|
||||
|
||||
$hasExcel = false;
|
||||
foreach ($object->getFiles() as $file) {
|
||||
$decodedFile = json_decode($file);
|
||||
if (($decodedFile->extension) === 'excel') {
|
||||
$hasExcel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($hasExcel) {
|
||||
throw new MalformedRequestException("Please upload files in PDF, JPEG, or PNG format.");
|
||||
}
|
||||
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($transaction, $object);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user