NASER add jibit verification api and jibit counter
This commit is contained in:
@@ -4,9 +4,12 @@ namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\DB\Te\TableEngine;
|
||||
use App\Http\Controllers\SuperController;
|
||||
use App\Models\Cnt;
|
||||
use App\Models\Customer;
|
||||
use App\Models\TransactionsAdmin;
|
||||
use App\Models\Withdraw;
|
||||
use Carbon\Carbon;
|
||||
use Hekmatinasser\Verta\Verta;
|
||||
use Illuminate\Http\Request;
|
||||
use Rooyesh\Wallet\interfaces\TransactionInterface;
|
||||
use Rooyesh\Wallet\interfaces\WalletInterface;
|
||||
@@ -254,4 +257,35 @@ class CustomerController extends SuperController
|
||||
|
||||
return response()->json(true);
|
||||
}
|
||||
|
||||
public function cardChecker(Request $request){
|
||||
|
||||
if (strlen($request->cart_number) != 16) {
|
||||
throw new UnprocessableEntityHttpException('شماره کارت اشتباه میباشد.');
|
||||
}
|
||||
if (empty($request->national_code)) {
|
||||
throw new UnprocessableEntityHttpException('لطفا شماره ملی وارد کنید.');
|
||||
}
|
||||
if(empty($request->birth_date)){
|
||||
throw new UnprocessableEntityHttpException('لطفا تاریخ تولد وارد کنید.');
|
||||
}
|
||||
$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);
|
||||
|
||||
if(!empty($response)){
|
||||
if (isset($response['cartData'])) {
|
||||
unset($response['refresh']);
|
||||
return response()->json($response);
|
||||
}elseif(!empty($response['message'])){
|
||||
throw new UnprocessableEntityHttpException($response['message']);
|
||||
}
|
||||
}else{
|
||||
throw new UnprocessableEntityHttpException('ارتباط با سامانه قطع میباشد.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user