59 lines
1.6 KiB
PHP
59 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
class FetchCardHistoryController extends Controller
|
|
{
|
|
/**
|
|
* Fetch card history
|
|
*
|
|
* @param Request $request
|
|
*/
|
|
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'],
|
|
]);
|
|
|
|
$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->passport_id,
|
|
$request->card_number,
|
|
$request->card_expiry_date,
|
|
),
|
|
CURLOPT_HTTPHEADER => [
|
|
'Accept: application/json',
|
|
'Content-Type: application/json',
|
|
],
|
|
]);
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
}
|
|
}
|