NASER add jibit verification api and jibit counter

This commit is contained in:
gholak tala
2026-04-26 20:09:21 +00:00
parent 0ce9b191c1
commit 5430e3bd0f
3 changed files with 50 additions and 0 deletions
+13
View File
@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Models\Cnt;
use App\Models\User;
use App\Models\Customer;
use App\Models\Setting;
@@ -179,6 +180,14 @@ class Controller extends BaseController
public static function jibit($method, $p1 = null, $p2 = null, $p3 = null)
{
$counter = Cnt::where('key', 'jibit_counter')->first();
if(empty($counter)){
$counter = new Cnt();
$counter->key = "jibit_counter";
$counter->value = 0;
$counter->save();
}
$apiData['refresh'] = Http::withoutVerifying()->withoutVerifying()->withToken(Storage::get('refreshTokenGibit'))
->post("https://napi.jibit.ir/ide/v1/tokens/generate", ['apiKey' => "J5WxrPxPOg", 'secretKey' => "7dgeE70xQXsQL7r36j3wif6X9",])->json();
Storage::put('accessTokenGibit', $apiData['refresh']['accessToken']);
@@ -196,6 +205,10 @@ class Controller extends BaseController
Storage::put('refreshTokenGibit', $apiData['refresh']['refreshToken']);
$apiData['cartMatching'] = Http::withoutVerifying()->withToken(Storage::get('accessTokenGibit'))->get("https://napi.jibit.ir/ide/v1/services/matching?cardNumber=$p1&nationalCode=$p2&birthDate=$p3")->json();
}
//update jibit counter
$counter->value = (int)$counter->value + 1;
$counter->save();
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;