57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Str;
|
|
|
|
class FetchCardHistoryController extends Controller
|
|
{
|
|
public function index(Request $request)
|
|
{
|
|
$request->validate([
|
|
'passport_serie' => ['required', 'string', 'max:255'],
|
|
'passport_id' => ['required', 'string', 'max:255'],
|
|
'card_number' => ['required', 'string', 'max:255'],
|
|
'card_expiry_date' => ['required', 'string', 'max:255'],
|
|
]);
|
|
|
|
return $request->all();
|
|
|
|
$curl = curl_init();
|
|
|
|
curl_setopt_array($curl, [
|
|
CURLOPT_URL => 'http://10.3.158.102:9999/api/clientinfo',
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_ENCODING => '',
|
|
CURLOPT_MAXREDIRS => 10,
|
|
CURLOPT_TIMEOUT => 0,
|
|
CURLOPT_FOLLOWLOCATION => true,
|
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
CURLOPT_CUSTOMREQUEST => 'POST',
|
|
CURLOPT_POSTFIELDS => sprintf('{
|
|
"idSeria": "%s",
|
|
"idNo": "%s",
|
|
"clientType": "recipient",
|
|
"cardMaskNumber": "%s",
|
|
"expDate": "%s"
|
|
}',
|
|
$request->passport_serie,
|
|
$request->idNo,
|
|
Str::mask('9934032100858088', '*', 6, 6),
|
|
$request->card_expiry_date,
|
|
),
|
|
CURLOPT_HTTPHEADER => [
|
|
'Accept: application/json',
|
|
'Content-Type: application/json',
|
|
],
|
|
]);
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
}
|
|
}
|