feat(refund): implement backfill command for historical ticket refunds reconciliation
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
use App\Domains\Auth\Services\AdminCredentialVerifier;
|
||||
use App\Domains\Catalog\Services\ExpireStockReservationsService;
|
||||
use App\Domains\Purchase\Services\TenantTransactionResetService;
|
||||
use App\Domains\Ticket\Services\BackfillRefundedUnitsService;
|
||||
use App\Domains\Ticket\Services\LoadTestTicketDatasetService;
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
@@ -13,6 +14,27 @@ Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
|
||||
Artisan::command('tickets:backfill-refunded-units', function (BackfillRefundedUnitsService $service): int {
|
||||
try {
|
||||
$summary = $service->run();
|
||||
} catch (Throwable $exception) {
|
||||
$this->error($exception->getMessage());
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$this->info(sprintf(
|
||||
'Refund backfill: %d applied, %d bundles skipped, %d inventories updated, +%d refunded_units, +%d real_stock',
|
||||
$summary['refunds_applied'],
|
||||
$summary['bundles_skipped'],
|
||||
$summary['inventories_updated'],
|
||||
$summary['refunded_units_added'],
|
||||
$summary['real_stock_added'],
|
||||
));
|
||||
|
||||
return self::SUCCESS;
|
||||
})->purpose('Reconcile historical ticket refunds with inventory after reviewing existing refunded units');
|
||||
|
||||
Artisan::command('reservations:expire', function (): void {
|
||||
$expired = app(ExpireStockReservationsService::class)->expireOverdue();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user