- Mengubah tampilan informasi pada log command `ExportPeriodStatements`: - Mengganti variabel yang ditampilkan di log dari `jobCount` menjadi `accountNumber`. - Memastikan log lebih relevan dengan konteks data yang diproses. - Perubahan ini bertujuan untuk: - Menyediakan informasi log yang lebih jelas dan sesuai dengan proses yang dijalankan. - Meningkatkan keakuratan komunikasi informasi kepada pengguna command. Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
58 lines
1.8 KiB
PHP
58 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Modules\Webstatement\Console;
|
|
|
|
use Exception;
|
|
use Illuminate\Console\Command;
|
|
use Modules\Webstatement\Http\Controllers\WebstatementController;
|
|
|
|
class ExportPeriodStatements extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'webstatement:export-period-statements
|
|
{--account_number= : Account number to process migration}
|
|
{--period= : Period to process migration format Ym contoh. 202506}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Export period statements for all configured client accounts';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function handle()
|
|
{
|
|
$accountNumber = $this->option('account_number');
|
|
$period = $this->option('period');
|
|
|
|
$this->info('Starting period statement export process...');
|
|
|
|
|
|
try {
|
|
$controller = app(WebstatementController::class);
|
|
$response = $controller->printStatementRekening($accountNumber, $period);
|
|
|
|
$responseData = json_decode($response->getContent(), true);
|
|
$this->info($responseData['message']);
|
|
|
|
// Display summary of jobs queued
|
|
$jobCount = count($responseData['jobs'] ?? []);
|
|
$this->info("Successfully queued {$accountNumber} statement export jobs");
|
|
|
|
return Command::SUCCESS;
|
|
} catch (Exception $e) {
|
|
$this->error('Error exporting statements: ' . $e->getMessage());
|
|
return Command::FAILURE;
|
|
}
|
|
}
|
|
}
|