feat(refund): implement backfill command for historical ticket refunds reconciliation
This commit is contained in:
@@ -289,8 +289,7 @@ class AdminAppTicketControllerTest extends TestCase
|
||||
'refunded_units_added' => 1,
|
||||
'real_stock_added' => 1,
|
||||
]);
|
||||
$backfill = require database_path('migrations/2026_09_16_000100_backfill_refunded_units.php');
|
||||
$backfill->up();
|
||||
$this->artisan('tickets:backfill-refunded-units')->assertSuccessful();
|
||||
|
||||
$this->assertSame(1, $inventory->fresh()->refunded_units);
|
||||
$this->assertSame(1, $inventory->fresh()->real_stock);
|
||||
@@ -308,6 +307,19 @@ class AdminAppTicketControllerTest extends TestCase
|
||||
$this->assertSame(2, $inventory->fresh()->real_stock);
|
||||
}
|
||||
|
||||
public function test_backfill_command_fails_without_changing_existing_refunded_units(): void
|
||||
{
|
||||
$inventory = Inventory::query()->create([
|
||||
'real_stock' => 3,
|
||||
'refunded_units' => 1,
|
||||
]);
|
||||
|
||||
$this->artisan('tickets:backfill-refunded-units')->assertFailed();
|
||||
|
||||
$this->assertSame(1, $inventory->fresh()->refunded_units);
|
||||
$this->assertSame(3, $inventory->fresh()->real_stock);
|
||||
}
|
||||
|
||||
public function test_it_records_different_refund_types_for_tickets_from_the_same_purchase_item(): void
|
||||
{
|
||||
$tenant = $this->createTenant('ticket-mixed-refunds');
|
||||
|
||||
Reference in New Issue
Block a user