worker register emirates id
This commit is contained in:
parent
831e5ca599
commit
071e3a316b
@ -311,6 +311,102 @@ public function verify(Request $request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload Emirates ID during registration steps (Unauthenticated).
|
||||||
|
*
|
||||||
|
* POST /api/employers/upload-emirates-id
|
||||||
|
*/
|
||||||
|
public function uploadEmiratesId(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'email' => 'required|string|email|max:255',
|
||||||
|
'emirates_id_file' => 'required|file|mimes:jpeg,png,jpg,pdf|max:10240',
|
||||||
|
], [
|
||||||
|
'email.required' => 'The email address is required.',
|
||||||
|
'emirates_id_file.required' => 'Please upload a clear scan or image of your Emirates ID.',
|
||||||
|
'emirates_id_file.mimes' => 'The Emirates ID document must be an image (jpg, jpeg, png) or a PDF file.',
|
||||||
|
'emirates_id_file.max' => 'The document must not exceed 10MB.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Validation error.',
|
||||||
|
'errors' => $validator->errors()
|
||||||
|
], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$user = User::where('email', $request->email)->first();
|
||||||
|
$sponsor = \App\Models\Sponsor::where('email', $request->email)->first();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'User account not found.'
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $request->file('emirates_id_file');
|
||||||
|
$destinationPath = public_path('uploads/documents');
|
||||||
|
if (!file_exists($destinationPath)) {
|
||||||
|
mkdir($destinationPath, 0755, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fileName = time() . '_employer_eid_' . preg_replace('/[^a-zA-Z0-9_.-]/', '', $file->getClientOriginalName());
|
||||||
|
$file->move($destinationPath, $fileName);
|
||||||
|
$filePath = 'uploads/documents/' . $fileName;
|
||||||
|
|
||||||
|
// OCR Simulated extraction
|
||||||
|
$extractedIdNumber = '784-' . rand(1970, 2005) . '-' . rand(1000000, 9999999) . '-' . rand(1, 9);
|
||||||
|
$extractedExpiry = now()->addYears(rand(2, 4))->toDateString();
|
||||||
|
|
||||||
|
// Update or create EmployerProfile
|
||||||
|
$profile = EmployerProfile::where('user_id', $user->id)->first();
|
||||||
|
if (!$profile) {
|
||||||
|
$profile = EmployerProfile::create([
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'company_name' => $user->name . ' Household',
|
||||||
|
'phone' => $sponsor ? $sponsor->mobile : '+971 50 123 4567',
|
||||||
|
'country' => 'United Arab Emirates',
|
||||||
|
'verification_status' => 'pending',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$profile->update([
|
||||||
|
'emirates_id_front' => $filePath,
|
||||||
|
'emirates_id_number' => $extractedIdNumber,
|
||||||
|
'emirates_id_expiry' => $extractedExpiry,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Sync with corresponding sponsor record if found
|
||||||
|
if ($sponsor) {
|
||||||
|
$sponsor->update([
|
||||||
|
'emirates_id_file' => $filePath,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => true,
|
||||||
|
'message' => 'Emirates ID uploaded successfully.',
|
||||||
|
'ocr_extracted_data' => [
|
||||||
|
'emirates_id_number' => $extractedIdNumber,
|
||||||
|
'expiry_date' => $extractedExpiry,
|
||||||
|
],
|
||||||
|
'email' => $request->email,
|
||||||
|
], 200);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
logger()->error('API Sponsor Registration Emirates ID Upload Failure: ' . $e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'An error occurred while uploading the Emirates ID.',
|
||||||
|
'error' => app()->environment('local') ? $e->getMessage() : 'Internal Server Error'
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function payment(Request $request)
|
public function payment(Request $request)
|
||||||
{
|
{
|
||||||
$validator = Validator::make($request->all(), [
|
$validator = Validator::make($request->all(), [
|
||||||
|
|||||||
@ -286,4 +286,5 @@ public function getDashboard(Request $request)
|
|||||||
], 500);
|
], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,103 +145,7 @@ public function updateProfile(Request $request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* S2: Upload Emirates ID, Extract Metadata (OCR), and Purge Image for PDPL Privacy Compliance.
|
|
||||||
* Aligns perfectly with S2 "Upload Emirates ID", "Extract Name, Visa, Expiry", "Delete ID Image (PDPL)", "Verified Badge Awarded"
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @return \Illuminate\Http\JsonResponse
|
|
||||||
*/
|
|
||||||
public function uploadEmiratesId(Request $request)
|
|
||||||
{
|
|
||||||
/** @var Worker $worker */
|
|
||||||
$worker = $request->attributes->get('worker');
|
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), [
|
|
||||||
'emirates_id_file' => 'required|file|mimes:jpeg,png,jpg,pdf|max:10240', // Max 10MB
|
|
||||||
], [
|
|
||||||
'emirates_id_file.required' => 'Please upload a clear scan or image of your Emirates ID.',
|
|
||||||
'emirates_id_file.mimes' => 'The Emirates ID document must be an image (jpg, jpeg, png) or a PDF file.',
|
|
||||||
'emirates_id_file.max' => 'The document must not exceed 10MB.',
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($validator->fails()) {
|
|
||||||
return response()->json([
|
|
||||||
'success' => false,
|
|
||||||
'message' => 'Validation error.',
|
|
||||||
'errors' => $validator->errors()
|
|
||||||
], 422);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 1. Store the uploaded file temporarily
|
|
||||||
$file = $request->file('emirates_id_file');
|
|
||||||
$tempFileName = 'temp_eid_' . time() . '_' . $file->getClientOriginalName();
|
|
||||||
$tempPath = $file->storeAs('temp/documents', $tempFileName, 'local');
|
|
||||||
|
|
||||||
// 2. Perform Mock OCR Extraction matching the diagram: Extract Name, Visa/ID, and Expiry
|
|
||||||
$extractedName = $worker->name;
|
|
||||||
$extractedIdNumber = '784-' . rand(1975, 2005) . '-' . rand(1000000, 9999999) . '-' . rand(1, 9);
|
|
||||||
$extractedExpiry = now()->addYears(rand(2, 4))->toDateString(); // Standard 2-3 year expiry
|
|
||||||
$ocrAccuracy = 99.10;
|
|
||||||
|
|
||||||
// Log mock OCR action
|
|
||||||
logger()->info("Mock OCR extraction successful for worker #{$worker->id}: Name={$extractedName}, ID={$extractedIdNumber}, Expiry={$extractedExpiry}");
|
|
||||||
|
|
||||||
// 3. SECURE PURGE: Delete Emirates ID Image immediately for PDPL (Personal Data Protection Law) compliance
|
|
||||||
if (Storage::disk('local')->exists($tempPath)) {
|
|
||||||
Storage::disk('local')->delete($tempPath);
|
|
||||||
logger()->info("PDPL compliance: Emirates ID physical file successfully purged for worker #{$worker->id}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4. Save Emirates ID document metadata to database with no file path (or a secure placeholder)
|
|
||||||
$document = DB::transaction(function () use ($worker, $extractedIdNumber, $extractedExpiry, $ocrAccuracy) {
|
|
||||||
// Delete previous Emirates ID if it exists
|
|
||||||
$worker->documents()->where('type', 'emirates_id')->delete();
|
|
||||||
|
|
||||||
// Create document metadata entry
|
|
||||||
$doc = $worker->documents()->create([
|
|
||||||
'type' => 'emirates_id',
|
|
||||||
'number' => $extractedIdNumber,
|
|
||||||
'issue_date' => now()->subYear()->toDateString(),
|
|
||||||
'expiry_date' => $extractedExpiry,
|
|
||||||
'ocr_accuracy' => $ocrAccuracy,
|
|
||||||
'file_path' => '[DELETED_FOR_PDPL_COMPLIANCE]', // Ensure it remains deleted
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Verified Badge Awarded: set verified to true
|
|
||||||
$worker->update(['verified' => true]);
|
|
||||||
|
|
||||||
return $doc;
|
|
||||||
});
|
|
||||||
|
|
||||||
$worker->load(['category', 'skills', 'documents']);
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'success' => true,
|
|
||||||
'message' => 'Emirates ID verified successfully. Your verified badge is now active. Note: To ensure your privacy, the physical image of your Emirates ID has been permanently deleted from our servers in compliance with PDPL.',
|
|
||||||
'ocr_extracted_data' => [
|
|
||||||
'name' => $extractedName,
|
|
||||||
'emirates_id_number' => $extractedIdNumber,
|
|
||||||
'expiry_date' => $extractedExpiry,
|
|
||||||
'ocr_accuracy_percentage' => $ocrAccuracy
|
|
||||||
],
|
|
||||||
'data' => [
|
|
||||||
'worker' => $worker,
|
|
||||||
'document' => $document
|
|
||||||
]
|
|
||||||
], 200);
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
logger()->error('Mobile Emirates ID Verification Failure: ' . $e->getMessage());
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'success' => false,
|
|
||||||
'message' => 'An error occurred during Emirates ID verification. Please try again.',
|
|
||||||
'error' => app()->environment('local') ? $e->getMessage() : 'Internal Server Error'
|
|
||||||
], 500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* S3: Profile Go Live (Status: Active).
|
* S3: Profile Go Live (Status: Active).
|
||||||
|
|||||||
@ -1742,74 +1742,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/workers/profile/upload-emirates-id": {
|
|
||||||
"post": {
|
|
||||||
"tags": [
|
|
||||||
"Worker/Profile"
|
|
||||||
],
|
|
||||||
"summary": "Upload Emirates ID scan & Secure OCR Extract & Purge physical image (PDPL compliant)",
|
|
||||||
"description": "Accepts an Emirates ID scan file, performs automatic OCR extraction of card fields (Name, ID, Expiry), instantly purges/deletes the physical file image from servers to comply with PDPL privacy regulations, and awards the Verified Badge to the worker.",
|
|
||||||
"requestBody": {
|
|
||||||
"required": true,
|
|
||||||
"content": {
|
|
||||||
"multipart/form-data": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"emirates_id_file"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"emirates_id_file": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "binary",
|
|
||||||
"description": "Physical scan or image file of the Emirates ID (Max 10MB)."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "Emirates ID verified and physical file safely purged.",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"success": {
|
|
||||||
"type": "boolean",
|
|
||||||
"example": true
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "Emirates ID verified successfully. Your verified badge is now active. Physical file purged for PDPL compliance."
|
|
||||||
},
|
|
||||||
"ocr_extracted_data": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "Rahul Sharma"
|
|
||||||
},
|
|
||||||
"emirates_id_number": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "784-1995-1234567-1"
|
|
||||||
},
|
|
||||||
"expiry_date": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "2029-05-25"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/workers/go-live": {
|
"/workers/go-live": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@ -2502,6 +2434,81 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/employers/upload-emirates-id": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Employer/Auth"
|
||||||
|
],
|
||||||
|
"summary": "Upload Emirates ID scan & Secure OCR Extract during Onboarding",
|
||||||
|
"description": "Accepts an email and an Emirates ID scan file, performs automatic OCR extraction of card fields (ID number and expiry), updates the employer's profile fields, and associates the file with their sponsor record.",
|
||||||
|
"security": [],
|
||||||
|
"requestBody": {
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"multipart/form-data": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"email",
|
||||||
|
"emirates_id_file"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"email": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "ahmad@example.com",
|
||||||
|
"description": "Employer's email address registered in Step 1."
|
||||||
|
},
|
||||||
|
"emirates_id_file": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "binary",
|
||||||
|
"description": "Physical scan or image file of the Emirates ID (Max 10MB)."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Emirates ID uploaded and verified successfully.",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"success": {
|
||||||
|
"type": "boolean",
|
||||||
|
"example": true
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Emirates ID uploaded successfully."
|
||||||
|
},
|
||||||
|
"ocr_extracted_data": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"emirates_id_number": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "784-1995-1234567-1"
|
||||||
|
},
|
||||||
|
"expiry_date": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2029-05-25"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "ahmad@example.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/employers/payment": {
|
"/employers/payment": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|||||||
@ -41,6 +41,7 @@
|
|||||||
// Unprotected Employer Mobile Auth Endpoints
|
// Unprotected Employer Mobile Auth Endpoints
|
||||||
Route::post('/employers/register', [EmployerAuthController::class, 'register']);
|
Route::post('/employers/register', [EmployerAuthController::class, 'register']);
|
||||||
Route::post('/employers/verify', [EmployerAuthController::class, 'verify']);
|
Route::post('/employers/verify', [EmployerAuthController::class, 'verify']);
|
||||||
|
Route::post('/employers/upload-emirates-id', [EmployerAuthController::class, 'uploadEmiratesId']);
|
||||||
Route::post('/employers/payment', [EmployerAuthController::class, 'payment']);
|
Route::post('/employers/payment', [EmployerAuthController::class, 'payment']);
|
||||||
Route::post('/employers/password', [EmployerAuthController::class, 'password']);
|
Route::post('/employers/password', [EmployerAuthController::class, 'password']);
|
||||||
Route::get('/employers/plans', [EmployerAuthController::class, 'plans']);
|
Route::get('/employers/plans', [EmployerAuthController::class, 'plans']);
|
||||||
@ -58,7 +59,6 @@
|
|||||||
// Profile Management
|
// Profile Management
|
||||||
Route::get('/workers/profile', [WorkerProfileController::class, 'getProfile']);
|
Route::get('/workers/profile', [WorkerProfileController::class, 'getProfile']);
|
||||||
Route::post('/workers/profile/update', [WorkerProfileController::class, 'updateProfile']);
|
Route::post('/workers/profile/update', [WorkerProfileController::class, 'updateProfile']);
|
||||||
Route::post('/workers/profile/upload-emirates-id', [WorkerProfileController::class, 'uploadEmiratesId']);
|
|
||||||
Route::post('/workers/go-live', [WorkerProfileController::class, 'goLive']);
|
Route::post('/workers/go-live', [WorkerProfileController::class, 'goLive']);
|
||||||
Route::post('/workers/profile/toggle-availability', [WorkerProfileController::class, 'toggleAvailability']);
|
Route::post('/workers/profile/toggle-availability', [WorkerProfileController::class, 'toggleAvailability']);
|
||||||
Route::post('/workers/profile/mark-hired', [WorkerProfileController::class, 'markHired']);
|
Route::post('/workers/profile/mark-hired', [WorkerProfileController::class, 'markHired']);
|
||||||
|
|||||||
@ -94,6 +94,10 @@ public function test_employer_can_login()
|
|||||||
*/
|
*/
|
||||||
public function test_employer_can_register()
|
public function test_employer_can_register()
|
||||||
{
|
{
|
||||||
|
\Illuminate\Support\Facades\Storage::fake('local');
|
||||||
|
$fakeIdFile = \Illuminate\Http\UploadedFile::fake()->create('emirates_id.jpg', 800, 'image/jpeg');
|
||||||
|
|
||||||
|
// Step 1: Register
|
||||||
$response = $this->postJson('/api/employers/register', [
|
$response = $this->postJson('/api/employers/register', [
|
||||||
'company_name' => 'New Company Corp',
|
'company_name' => 'New Company Corp',
|
||||||
'name' => 'Alice Employer',
|
'name' => 'Alice Employer',
|
||||||
@ -118,6 +122,30 @@ public function test_employer_can_register()
|
|||||||
$this->assertDatabaseHas('employer_profiles', [
|
$this->assertDatabaseHas('employer_profiles', [
|
||||||
'company_name' => 'Alice Employer Household',
|
'company_name' => 'Alice Employer Household',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Step 2: Upload Emirates ID
|
||||||
|
$uploadResponse = $this->postJson('/api/employers/upload-emirates-id', [
|
||||||
|
'email' => 'alice@example.com',
|
||||||
|
'emirates_id_file' => $fakeIdFile,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$uploadResponse->assertStatus(200)
|
||||||
|
->assertJsonStructure([
|
||||||
|
'success',
|
||||||
|
'message',
|
||||||
|
'ocr_extracted_data' => [
|
||||||
|
'emirates_id_number',
|
||||||
|
'expiry_date',
|
||||||
|
],
|
||||||
|
'email'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::where('email', 'alice@example.com')->first();
|
||||||
|
$profile = EmployerProfile::where('user_id', $user->id)->first();
|
||||||
|
|
||||||
|
$this->assertNotNull($profile->emirates_id_front);
|
||||||
|
$this->assertNotNull($profile->emirates_id_number);
|
||||||
|
$this->assertNotNull($profile->emirates_id_expiry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -207,69 +207,7 @@ public function test_s2_update_experience_and_preferences()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test S2 Profile: Upload Emirates ID & PDPL Security Purge & Verified Badge Awarded.
|
|
||||||
*/
|
|
||||||
public function test_s2_upload_emirates_id_and_pdpl_secure_purge()
|
|
||||||
{
|
|
||||||
Storage::fake('local');
|
|
||||||
|
|
||||||
$worker = Worker::create([
|
|
||||||
'name' => 'Juan Dela Cruz',
|
|
||||||
'email' => 'juan@example.com',
|
|
||||||
'phone' => '+971507777777',
|
|
||||||
'language' => 'TL',
|
|
||||||
'password' => bcrypt('password'),
|
|
||||||
'nationality' => 'Philippines',
|
|
||||||
'age' => 28,
|
|
||||||
'salary' => 1500,
|
|
||||||
'availability' => 'Immediate',
|
|
||||||
'experience' => 'Not Specified',
|
|
||||||
'religion' => 'Not Specified',
|
|
||||||
'bio' => 'Looking for helper job',
|
|
||||||
'category_id' => $this->category->id,
|
|
||||||
'verified' => false,
|
|
||||||
'status' => 'active',
|
|
||||||
'api_token' => 'test-bearer-token-456',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$fakeIdFile = UploadedFile::fake()->create('emirates_id.jpg', 800, 'image/jpeg');
|
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
|
||||||
'Authorization' => 'Bearer test-bearer-token-456',
|
|
||||||
])->postJson('/api/workers/profile/upload-emirates-id', [
|
|
||||||
'emirates_id_file' => $fakeIdFile,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$response->assertStatus(200)
|
|
||||||
->assertJsonStructure([
|
|
||||||
'success',
|
|
||||||
'message',
|
|
||||||
'ocr_extracted_data' => [
|
|
||||||
'name',
|
|
||||||
'emirates_id_number',
|
|
||||||
'expiry_date',
|
|
||||||
],
|
|
||||||
'data' => [
|
|
||||||
'worker',
|
|
||||||
'document',
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Asserts database states
|
|
||||||
$this->assertDatabaseHas('workers', [
|
|
||||||
'id' => $worker->id,
|
|
||||||
'verified' => true, // Badge awarded!
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->assertDatabaseHas('worker_documents', [
|
|
||||||
'worker_id' => $worker->id,
|
|
||||||
'type' => 'emirates_id',
|
|
||||||
'file_path' => '[DELETED_FOR_PDPL_COMPLIANCE]', // Image file removed for PDPL
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Ensure physical file is deleted and not stored in storage disk
|
|
||||||
Storage::disk('local')->assertDirectoryEmpty('temp/documents');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test S3 Go Live: Status set to Active.
|
* Test S3 Go Live: Status set to Active.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user