From bdf70a4c056bc155da5f2b7da57bf39159f81a31 Mon Sep 17 00:00:00 2001 From: safavimohadeseh78 Date: Tue, 10 Nov 2026 14:33:09 +0330 Subject: [PATCH] feat: automatic instant Jibit verification on customer profile update without admin manual approval --- .../Customer/CustomerController.php | 10 +---- ...01_enable_auto_active_and_jibit_verify.php | 45 +++++++++++++++++++ 2 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 database/migrations/2026_11_10_000001_enable_auto_active_and_jibit_verify.php diff --git a/app/Http/Controllers/Customer/CustomerController.php b/app/Http/Controllers/Customer/CustomerController.php index 9858ed3..4e219ff 100644 --- a/app/Http/Controllers/Customer/CustomerController.php +++ b/app/Http/Controllers/Customer/CustomerController.php @@ -208,7 +208,7 @@ class CustomerController extends Controller // $tah = new TahesabController(); // $tah->store(["customer_id" => $customer->id]); $cfg = app(ConfigService::class); - if (!$wasLegal && $cfg->isRegisterJibitVerifyEnabled()) { + if (!$wasLegal && !empty($customer->n_code)) { $nCodeError = JibitIdentityService::nationalCodeError($customer->n_code); if ($nCodeError !== null) { return response()->json([ @@ -226,7 +226,7 @@ class CustomerController extends Controller ]); return response()->json([ - 'message' => 'ارتباط با سرویس احراز هویت جیبیت برقرار نشد. اطلاعات پروفایل ذخیره شد اما هویت تأیید نشد.', + 'message' => 'ارتباط با سرویس احراز هویت جیبیت برقرار نشد. لطفاً دقایقی دیگر مجدداً تلاش فرمایید.', 'code' => 'jibit_unreachable', ], 422); } @@ -257,12 +257,6 @@ class CustomerController extends Controller 'code' => $jibit['code'], ], 422); } - } elseif (!$customer->is_legal && !$cfg->isRegisterJibitVerifyEnabled()) { - return response()->json([ - 'ok' => true, - 'pending_admin' => true, - 'message' => 'اطلاعات کاربری شما ثبت شد و پس از تایید ادمین فعال سازی خواهد شد', - ]); } return response()->json(true); } catch (QueryException $e) { diff --git a/database/migrations/2026_11_10_000001_enable_auto_active_and_jibit_verify.php b/database/migrations/2026_11_10_000001_enable_auto_active_and_jibit_verify.php new file mode 100644 index 0000000..35553b0 --- /dev/null +++ b/database/migrations/2026_11_10_000001_enable_auto_active_and_jibit_verify.php @@ -0,0 +1,45 @@ + 'auto_active_customer'], + [ + 'value' => 'true', + 'title_fa' => 'فعال‌سازی خودکار کاربر پس از ثبت‌نام', + 'description' => 'روشن: بعد از ثبت‌نام کاربر می‌تواند وارد اپ شود بدون نیاز به تأیید دستی ادمین.', + 'can_edit' => 1, + 'is_active' => 1, + 'type' => 'switch', + ] + ); + + Setting::updateOrCreate( + ['key' => 'register_jibit_verify'], + [ + 'value' => 'true', + 'title_fa' => 'احراز هویت جیبیت در ثبت‌نام و پروفایل', + 'description' => 'روشن: تطبیق کد ملی با شماره همراه از طریق سامانه جیبیت.', + 'can_edit' => 1, + 'is_active' => 1, + 'type' => 'switch', + ] + ); + } + + public function down(): void + { + // No destructive rollback needed + } +}; +