NASER add jibit instead of identify verification
This commit is contained in:
@@ -146,16 +146,31 @@ class CustomerController extends Controller
|
||||
// $tah = new TahesabController();
|
||||
// $tah->store(["customer_id" => $customer->id]);
|
||||
if (!$customer->is_legal) {
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'Authorization' => 'Bearer mob83EBzqU7GWBmnc-6gXIp6r2G57P_94',
|
||||
'Content-Type' => 'application/json',
|
||||
])->post('http://185.97.116.24:20205/check_user', [
|
||||
'number' => $customer->mobile,
|
||||
'national' => $customer->n_code,
|
||||
'host' => $_SERVER['HTTP_HOST'],
|
||||
]);
|
||||
|
||||
$nationalCode = $customer->n_code;
|
||||
$mobileNumber = $customer->mobile;
|
||||
// Storage::put('accessTokenGibit', ['accessToken']);
|
||||
// Storage::put('refreshTokenGibit', ['refreshToken']);
|
||||
$response = Http::withoutVerifying()->withToken(Storage::get('accessTokenGibit'))
|
||||
->get("https://napi.jibit.ir/ide/v1/services/matching?nationalCode=".$nationalCode."&mobileNumber=".$mobileNumber)->json();
|
||||
if (isset($response['code']) && $response['code']== "forbidden"){
|
||||
$response = Http::withoutVerifying()->withToken(Storage::get('refreshTokenGibit'))
|
||||
->post("https://napi.jibit.ir/ide/v1/tokens/generate",[
|
||||
'apiKey' => "J5WxrPxPOg",
|
||||
'secretKey' => "7dgeE70xQXsQL7r36j3wif6X9",
|
||||
])->json();
|
||||
Storage::put('accessTokenGibit', $response['accessToken']);
|
||||
Storage::put('refreshTokenGibit', $response['refreshToken']);
|
||||
$response = Http::withoutVerifying()->withToken(Storage::get('accessTokenGibit'))
|
||||
->get("https://napi.jibit.ir/ide/v1/services/matching?nationalCode=".$nationalCode."&mobileNumber=".$mobileNumber)->json();
|
||||
}
|
||||
// $response = Http::withHeaders([
|
||||
// 'Authorization' => 'Bearer mob83EBzqU7GWBmnc-6gXIp6r2G57P_94',
|
||||
// 'Content-Type' => 'application/json',
|
||||
// ])->post('http://185.97.116.24:20205/check_user', [
|
||||
// 'number' => $customer->mobile,
|
||||
// 'national' => $customer->n_code,
|
||||
// 'host' => $_SERVER['HTTP_HOST'],
|
||||
// ]);
|
||||
|
||||
if (isset($response['matched']) and $response['matched'] == true) {
|
||||
$customer->is_legal = 1;
|
||||
|
||||
Reference in New Issue
Block a user