wip
This commit is contained in:
@@ -315,7 +315,7 @@ function view_loan_order_permission_id(): int
|
||||
*/
|
||||
function vp_fetch_ClientInfoAll($model, $start_date, $end_date)
|
||||
{
|
||||
$response = DownloadCardTransaction::make()->fetchApi(
|
||||
return fetchCardTransactionFromAzat(
|
||||
passport_serie: $model->passport_serie,
|
||||
passport_id: $model->passport_id,
|
||||
card_number_masked: Str::mask($model->card_number, '*', 6, 6),
|
||||
@@ -323,6 +323,11 @@ function vp_fetch_ClientInfoAll($model, $start_date, $end_date)
|
||||
start_date: $start_date,
|
||||
end_date: $end_date,
|
||||
);
|
||||
}
|
||||
|
||||
function fetchCardTransactionFromAzat($passport_serie, $passport_id, $card_number_masked, $card_expire_date, $start_date, $end_date)
|
||||
{
|
||||
$response = DownloadCardTransaction::make()->fetchApi($passport_serie, $passport_id, $card_number_masked, $card_expire_date, $start_date, $end_date);
|
||||
|
||||
return Str::isJson($response)
|
||||
? json_decode($response)
|
||||
|
||||
@@ -12,11 +12,69 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
#[Group('Sargytlar - Kart - Kart hereketleri')]
|
||||
class CardTransactionsController extends Controller
|
||||
{
|
||||
public function quick(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'start_date' => ['required', 'string', 'date'],
|
||||
'end_date' => ['required', 'string', 'date', 'after:start_date'],
|
||||
]);
|
||||
|
||||
$user = auth()->user();
|
||||
|
||||
$start_date = Carbon::create($data['start_date'])->format('d.m.Y');
|
||||
$end_date = Carbon::create($data['end_date'])->format('d.m.Y');
|
||||
$passport_serie = $this->getOption('passport_serie');
|
||||
$passport_id = $this->getOption('passport_id');
|
||||
$card_number = $this->getOption('card_number');
|
||||
$card_month = $this->getOption('card_month');
|
||||
$card_year = $this->getOption('card_year');
|
||||
|
||||
if (
|
||||
is_null($passport_serie) || $passport_serie === '' ||
|
||||
is_null($passport_id) || $passport_id === '' ||
|
||||
is_null($card_number) || $card_number === '' ||
|
||||
is_null($card_month) || $card_month === '' ||
|
||||
is_null($card_year) || $card_year === ''
|
||||
) {
|
||||
return response()->rest([
|
||||
'status' => false,
|
||||
'message' => 'Profile data needed',
|
||||
'data' => '',
|
||||
]);
|
||||
}
|
||||
|
||||
$response = fetchCardTransactionFromAzat(
|
||||
passport_serie: $passport_serie,
|
||||
passport_id: $passport_id,
|
||||
card_number_masked: Str::mask($card_number, '*', 6, 6),
|
||||
card_expire_date: $card_month.'/'.substr($card_year, 2),
|
||||
start_date: $start_date,
|
||||
end_date: $end_date,
|
||||
);
|
||||
|
||||
if ($response->errCode != 0) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => $response->message,
|
||||
'data' => [],
|
||||
]);
|
||||
}
|
||||
|
||||
info(['re' => $response]);
|
||||
|
||||
return response()->rest([
|
||||
'status' => true,
|
||||
'message' => 'a',
|
||||
'data' => [],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* LIST*
|
||||
*/
|
||||
|
||||
@@ -108,6 +108,7 @@ Route::middleware(['auth:sanctum', 'not_banned'])->group(function () {
|
||||
Route::delete('card-order/{cardOrder}', [CardOrderController::class, 'destroy']);
|
||||
|
||||
// Card transactions... [tested fully]
|
||||
Route::get('card-transactions-quick', [CardTransactionsController::class, 'quick']);
|
||||
Route::get('card-transactions', [CardTransactionsController::class, 'index']);
|
||||
Route::get('card-transactions/{order}', [CardTransactionsController::class, 'show']);
|
||||
Route::get('card-transactions-download/{order}', [CardTransactionsController::class, 'download']);
|
||||
|
||||
Reference in New Issue
Block a user