From e020e6a633f9fc638b267aec834eeaed0bb0f6c4 Mon Sep 17 00:00:00 2001 From: "s.esmaeili" Date: Wed, 7 Oct 2026 17:37:19 +0330 Subject: [PATCH] fix(customers): handle REJECTED verification explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit verifyStepOne() sent REJECTED to `default`, which returns 2 ("accepted"). The admin list unlocks the order/account switches when step one is 2, so a rejected customer would have had them unlocked. REJECTED now maps to 3, matching legacy, where a step-one reject also set active = -1. Both switches are now exhaustive with no `default`, so a future enum value fails the build instead of falling through silently. Both user apps' ProfileView label it «رد شده». Before this they showed the raw English value. Co-Authored-By: Claude Opus 5.5 --- .../admin-customers/admin-customers.service.ts | 15 ++++++++++++--- apps/user-app-v2/src/views/user/ProfileView.vue | 1 + apps/user-app/src/views/user/ProfileView.vue | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/api/src/modules/admin-customers/admin-customers.service.ts b/apps/api/src/modules/admin-customers/admin-customers.service.ts index 322302f..ce786ab 100644 --- a/apps/api/src/modules/admin-customers/admin-customers.service.ts +++ b/apps/api/src/modules/admin-customers/admin-customers.service.ts @@ -73,8 +73,15 @@ function verifyStepOne(step: VerificationStep): number { return 3; // rejected / not yet submitted case VerificationStep.STEP_ONE_SUBMITTED: return 1; // pending review - default: - // STEP_TWO_SUBMITTED and VERIFIED both imply step one was accepted + case VerificationStep.REJECTED: + // Must be explicit: falling into `default` would report 2 (accepted), + // and the view unlocks the order/account switches on step one === 2. + // Rejected customers keep them locked — legacy's step-one reject also + // set active = -1 (MajorCustomerController.php:116-117). + return 3; + case VerificationStep.STEP_TWO_SUBMITTED: + case VerificationStep.VERIFIED: + // both imply step one was accepted return 2; } } @@ -85,7 +92,9 @@ function verifyStepTwo(step: VerificationStep): number { return 1; // pending review case VerificationStep.VERIFIED: return 2; // accepted - default: + case VerificationStep.UNVERIFIED: + case VerificationStep.STEP_ONE_SUBMITTED: + case VerificationStep.REJECTED: return 3; // rejected / not reached } } diff --git a/apps/user-app-v2/src/views/user/ProfileView.vue b/apps/user-app-v2/src/views/user/ProfileView.vue index 6664bdd..859733a 100644 --- a/apps/user-app-v2/src/views/user/ProfileView.vue +++ b/apps/user-app-v2/src/views/user/ProfileView.vue @@ -111,6 +111,7 @@ const VERIFICATION_LABELS: Record = { STEP_ONE_SUBMITTED: 'مرحله اول ثبت شده', STEP_TWO_SUBMITTED: 'مرحله دوم ثبت شده', VERIFIED: 'تایید شده', + REJECTED: 'رد شده', } const session = useSessionStore() diff --git a/apps/user-app/src/views/user/ProfileView.vue b/apps/user-app/src/views/user/ProfileView.vue index 66497ca..0eeb527 100644 --- a/apps/user-app/src/views/user/ProfileView.vue +++ b/apps/user-app/src/views/user/ProfileView.vue @@ -111,6 +111,7 @@ const VERIFICATION_LABELS: Record = { STEP_ONE_SUBMITTED: 'مرحله اول ثبت شده', STEP_TWO_SUBMITTED: 'مرحله دوم ثبت شده', VERIFIED: 'تایید شده', + REJECTED: 'رد شده', } const session = useSessionStore()