NASER fix jibit checker issues and make new settings editable

This commit is contained in:
gholak tala
2026-04-28 16:37:12 +00:00
parent 79a5d98dce
commit c68f8ec53d
3 changed files with 12 additions and 11 deletions
@@ -266,22 +266,20 @@ class CustomerController extends SuperController
if (empty($request->national_code)) {
throw new UnprocessableEntityHttpException('لطفا شماره ملی وارد کنید.');
}
if(empty($request->birth_date)){
throw new UnprocessableEntityHttpException('لطفا تاریخ تولد وارد کنید.');
if(!empty($request->birth_date)){
$birth_date = Verta::instance(Carbon::parse($request->birth_date))->format('Ymd');
}
$birth_date = Verta::instance(Carbon::parse($request->birth_date))->format('Ymd');
$card_number = preg_replace('/\D/', '', $request->cart_number);
// dd("ok");
$response = $this->jibit("cartMatching", $card_number, $request->national_code, $birth_date);
$response = $this->jibit("cartMatching", $card_number, $request->national_code, $birth_date ?? null);
if(isset($response['refresh'])){
unset($response['refresh']);
}
if(!empty($response)){
if (isset($response['cartData'])) {
unset($response['refresh']);
return response()->json($response);
}elseif(!empty($response['message'])){
if(!empty($response['message'])){
throw new UnprocessableEntityHttpException($response['message']);
}else{
return response()->json($response);
}
}else{
throw new UnprocessableEntityHttpException('ارتباط با سامانه قطع میباشد.');
@@ -31,6 +31,7 @@ class SettingsController extends Controller
$setting->value = $request->value;
$setting->description = $request->description;
$setting->is_active = $request->is_active;
$setting->can_edit = 1;
$setting->save();
}
+2
View File
@@ -212,6 +212,8 @@ class Controller extends BaseController
if (isset( $apiData['cartMatching']['matched']) and $apiData['cartMatching']['matched'] == true) {
$apiData['cartData'] = Http::withoutVerifying()->withToken(Storage::get('accessTokenGibit'))->get("https://napi.jibit.ir/ide/v1/cards?number=$p1&iban=true")->json();
return $apiData;
}elseif(isset( $apiData['cartMatching']['matched']) and $apiData['cartMatching']['matched'] == false){
return $apiData;
} else {
throw new UnprocessableEntityHttpException($apiData['cartMatching']['message']);
}