wip
This commit is contained in:
@@ -37,7 +37,12 @@ class DownloadCardBalance extends Action
|
|||||||
$model = $models->first();
|
$model = $models->first();
|
||||||
|
|
||||||
/** @var \App\Nova\Resources\Order\Card\CardTransaction\Actions\ResponseTypes\AzatApiClientInfoAllResponse */
|
/** @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) {
|
if ($data->errCode != 0) {
|
||||||
return ActionResponse::danger($data->message);
|
return ActionResponse::danger($data->message);
|
||||||
@@ -65,42 +70,43 @@ class DownloadCardBalance extends Action
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch api
|
* 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 = curl_init();
|
||||||
curl_setopt_array($curl, [
|
|
||||||
CURLOPT_URL => 'http://10.3.158.102:9999/api/clientinfo/all',
|
curl_setopt_array($curl, array(
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_URL => 'http://10.3.158.102:9999/api/clientcardinfo',
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_TIMEOUT => 0,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
CURLOPT_FOLLOWLOCATION => true,
|
CURLOPT_TIMEOUT => 0,
|
||||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
CURLOPT_POSTFIELDS => sprintf(
|
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||||
'{ "idSeria": "%s", "idNo": "%s", "cardMaskNumber": "%s", "expDate": "%s" }',
|
CURLOPT_POSTFIELDS => sprintf('{
|
||||||
$model->passport_serie,
|
"idSeria": "%s",
|
||||||
$model->passport_id,
|
"idNo": "%s",
|
||||||
Str::mask($model->card_number, '*', 6, 6),
|
"cardMaskNumber": "%s",
|
||||||
$model->card_month.'/'.substr($model->card_year, 2)
|
"expDate": "%s"
|
||||||
),
|
}', $passport_serie, $passport_id, $card_masked, $card_expire_date),
|
||||||
CURLOPT_HTTPHEADER => [
|
CURLOPT_HTTPHEADER => array(
|
||||||
'Authorization: Basic dGJ1c2VyOlFBWndzeDEyMw==',
|
'Authorization: Basic dGJ1c2VyOlFBWndzeDEyMw==',
|
||||||
'Content-Type: application/json',
|
'Content-Type: application/json'
|
||||||
],
|
),
|
||||||
]);
|
));
|
||||||
|
|
||||||
$response = curl_exec($curl);
|
$response = curl_exec($curl);
|
||||||
|
|
||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
|
|
||||||
|
|
||||||
info([
|
info([
|
||||||
'response' => $response,
|
'response' => $response,
|
||||||
|
'passport_serie' => $passport_serie,
|
||||||
|
'passport_id' => $passport_id,
|
||||||
|
'card_masked' => $card_masked,
|
||||||
|
'card_expire_date' => $card_expire_date,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return Str::isJson($response)
|
return Str::isJson($response)
|
||||||
|
|||||||
Reference in New Issue
Block a user