feat: automatic instant Jibit verification on customer profile update without admin manual approval
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('settings')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Setting::updateOrCreate(
|
||||
['key' => '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
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user