wip
This commit is contained in:
@@ -37,7 +37,12 @@ class DownloadCardBalance extends Action
|
||||
$model = $models->first();
|
||||
|
||||
/** @var \App\Nova\Resources\Order\Card\CardTransaction\Actions\ResponseTypes\AzatApiClientInfoAllResponse */
|
||||
$data = $this->fetchApi($model);
|
||||
$data = $this->fetchApi(
|
||||
passport_serie: $model->passport_serie,
|
||||
passport_id: $model->passport_id,
|
||||
card_masked: Str::mask($model->card_number, '*', 6, 6),
|
||||
card_expire_date: $model->card_month.'/'.substr($model->card_year, 2),
|
||||
);
|
||||
|
||||
if ($data->errCode != 0) {
|
||||
return ActionResponse::danger($data->message);
|
||||
@@ -65,42 +70,43 @@ class DownloadCardBalance extends Action
|
||||
|
||||
/**
|
||||
* Fetch api
|
||||
*
|
||||
* @param \App\Models\Order\Card\CardBalance\CardBalance $model
|
||||
*/
|
||||
public function fetchApi($model): object
|
||||
public function fetchApi($passport_serie, $passport_id, $card_masked, $card_expire_date): object
|
||||
{
|
||||
$date = today()->format('d.m.Y');
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => 'http://10.3.158.102:9999/api/clientinfo/all',
|
||||
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", "cardMaskNumber": "%s", "expDate": "%s" }',
|
||||
$model->passport_serie,
|
||||
$model->passport_id,
|
||||
Str::mask($model->card_number, '*', 6, 6),
|
||||
$model->card_month.'/'.substr($model->card_year, 2)
|
||||
),
|
||||
CURLOPT_HTTPHEADER => [
|
||||
'Authorization: Basic dGJ1c2VyOlFBWndzeDEyMw==',
|
||||
'Content-Type: application/json',
|
||||
],
|
||||
]);
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => 'http://10.3.158.102:9999/api/clientcardinfo',
|
||||
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",
|
||||
"cardMaskNumber": "%s",
|
||||
"expDate": "%s"
|
||||
}', $passport_serie, $passport_id, $card_masked, $card_expire_date),
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Basic dGJ1c2VyOlFBWndzeDEyMw==',
|
||||
'Content-Type: application/json'
|
||||
),
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
|
||||
info([
|
||||
'response' => $response,
|
||||
'passport_serie' => $passport_serie,
|
||||
'passport_id' => $passport_id,
|
||||
'card_masked' => $card_masked,
|
||||
'card_expire_date' => $card_expire_date,
|
||||
]);
|
||||
|
||||
return Str::isJson($response)
|
||||
|
||||
Reference in New Issue
Block a user