wip
This commit is contained in:
@@ -296,3 +296,33 @@ function view_loan_order_permission_id(): int
|
||||
return Permission::query()->where('name', 'ViewLoanOrders')->first(['id', 'name'])->id;
|
||||
});
|
||||
}
|
||||
|
||||
function emptyClass(...$arguments): object
|
||||
{
|
||||
return new class($arguments)
|
||||
{
|
||||
private array $data = [];
|
||||
|
||||
public function __construct(array $props)
|
||||
{
|
||||
foreach ($props as $key => $value) {
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
return $this->data[$key] ?? null;
|
||||
}
|
||||
|
||||
public function __set($key, $value)
|
||||
{
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
|
||||
public function __isset($key): bool
|
||||
{
|
||||
return isset($this->data[$key]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -49,19 +49,14 @@ class DownloadCardTransaction extends Action
|
||||
end_date: $end_date->format('d.m.Y'),
|
||||
);
|
||||
|
||||
$data = json_decode($response);
|
||||
/** @var ResponseTypes\AzatApiClientInfoAllResponse */
|
||||
$data = Str::isJson($response)
|
||||
? json_decode($response)
|
||||
: emptyClass(errCode: 1, message: 'Connection issue to VP');
|
||||
|
||||
// if (! is_array($response)) {
|
||||
// return ActionResponse::danger('Connection issue');
|
||||
// }
|
||||
|
||||
// if ($response['errCode'] != 0) {
|
||||
// return ActionResponse::danger($response['message']);
|
||||
// }
|
||||
|
||||
info([
|
||||
'type' => $data,
|
||||
]);
|
||||
if ($data->errCode != 0) {
|
||||
return ActionResponse::danger($data->message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Resources\Order\Card\CardTransaction\Actions\ResponseTypes;
|
||||
|
||||
class AzatApiClientInfoAllResponse
|
||||
{
|
||||
public string $idSeria;
|
||||
|
||||
public string $idNo;
|
||||
|
||||
public string $cardMaskNumber;
|
||||
|
||||
public string $expDate;
|
||||
|
||||
public string $clientType;
|
||||
|
||||
public string $fromDate;
|
||||
|
||||
public string $toDate;
|
||||
|
||||
public string $clientName;
|
||||
|
||||
public string $depName;
|
||||
|
||||
public string $cardPan;
|
||||
|
||||
public string $cardAccountNumber;
|
||||
|
||||
public string $birthDate;
|
||||
|
||||
public string $mfo;
|
||||
|
||||
public string $passOrg;
|
||||
|
||||
public string $passDate;
|
||||
|
||||
public string $address;
|
||||
|
||||
public string $phone;
|
||||
|
||||
public string $errCode;
|
||||
|
||||
public int $message;
|
||||
|
||||
public string $messageRu;
|
||||
|
||||
public string $messageEn;
|
||||
|
||||
/** array<int, Object{'trandate': string, 'currency': string, 'opersum': float, 'actionName': string, 'opername': string}> */
|
||||
public array $transactions;
|
||||
}
|
||||
Reference in New Issue
Block a user