This commit is contained in:
2025-10-28 21:59:12 +05:00
parent 3409849fa3
commit 5edcde1e4c
3 changed files with 26 additions and 9 deletions

View File

@@ -18,8 +18,8 @@ class CardBalanceRepository
{ {
/** @var \App\Modules\CardBalance\Types\CardBalanceResponse */ /** @var \App\Modules\CardBalance\Types\CardBalanceResponse */
$data = $this->fetchCardBalance( $data = $this->fetchCardBalance(
passport_serie: user()->getOption('passport_serie') ?? 'I', passport_serie: user()->passport_serie(),
passport_id: user()->getOption('passport_id') ?? '909090', passport_id: user()->passport_id(),
card_masked: Str::mask($record->number, '*', 6, 6), card_masked: Str::mask($record->number, '*', 6, 6),
card_expire_date: $record->month.'/'.substr($record->year, 2), card_expire_date: $record->month.'/'.substr($record->year, 2),
); );

View File

@@ -20,16 +20,16 @@ class CardTransactionRepository
/** /**
* Download card transaction * Download card transaction
* *
* @param array{start_date: string, end_date: string} $data * @param array<inst, string>|array{start_date: string, end_date: string} $data
*/ */
public function downloadCardTransaction(array $data, Card $record, Component $livewire) public function downloadCardTransaction(array $data, Card $record, Component $livewire): null
{ {
$start_date = Carbon::create($data['start_date']); $start_date = new Carbon($data['start_date']);
$end_date = Carbon::create($data['end_date']); $end_date = new Carbon($data['end_date']);
$apiResponse = $this->fetchApi( $apiResponse = $this->fetchApi(
passport_serie: user()->getOption('passport_serie') ?? 'I', passport_serie: user()->passport_serie(),
passport_id: user()->getOption('passport_id') ?? '909090', passport_id: user()->passport_id(),
card_number_masked: Str::mask($record->number, '*', 6, 6), card_number_masked: Str::mask($record->number, '*', 6, 6),
card_expire_date: $record->month.'/'.substr($record->year, 2), card_expire_date: $record->month.'/'.substr($record->year, 2),
start_date: $start_date->format('d.m.Y'), start_date: $start_date->format('d.m.Y'),
@@ -47,7 +47,7 @@ class CardTransactionRepository
->title($response->message) ->title($response->message)
->send(); ->send();
return; return null;
} }
$url = $this->generateFileUrl($record, $response); $url = $this->generateFileUrl($record, $response);
@@ -55,6 +55,7 @@ class CardTransactionRepository
// Tell Livewire to open it in a new tab // Tell Livewire to open it in a new tab
$livewire->js("window.open('{$url}', '_blank')"); $livewire->js("window.open('{$url}', '_blank')");
return null;
} }
/** /**

View File

@@ -40,4 +40,20 @@ trait UserAdjustments
{ {
return $this->options && array_key_exists($option, $this->options) ? $this->options[$option] : ''; return $this->options && array_key_exists($option, $this->options) ? $this->options[$option] : '';
} }
/**
* Passport serie
*/
public function passport_serie(): string
{
return (string) $this->getOption('passport_serie');
}
/**
* Passport id
*/
public function passport_id(): string
{
return (string) $this->getOption('passport_id');
}
} }