fix(customers): handle REJECTED verification explicitly

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 <noreply@anthropic.com>
This commit is contained in:
s.esmaeili
2026-10-07 17:37:19 +03:30
co-authored by Claude Opus 5.5
parent 45633b5aa0
commit e020e6a633
3 changed files with 14 additions and 3 deletions
@@ -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
}
}
@@ -111,6 +111,7 @@ const VERIFICATION_LABELS: Record<string, string> = {
STEP_ONE_SUBMITTED: 'مرحله اول ثبت شده',
STEP_TWO_SUBMITTED: 'مرحله دوم ثبت شده',
VERIFIED: 'تایید شده',
REJECTED: 'رد شده',
}
const session = useSessionStore()
@@ -111,6 +111,7 @@ const VERIFICATION_LABELS: Record<string, string> = {
STEP_ONE_SUBMITTED: 'مرحله اول ثبت شده',
STEP_TWO_SUBMITTED: 'مرحله دوم ثبت شده',
VERIFIED: 'تایید شده',
REJECTED: 'رد شده',
}
const session = useSessionStore()