feat(ticket): add action capability helpers and expose them in admin resource

This commit is contained in:
2026-09-11 09:25:19 -03:00
parent 5d00dc439e
commit 2ddb046c26
4 changed files with 77 additions and 4 deletions

View File

@@ -74,6 +74,9 @@ class AdminAppTicketControllerTest extends TestCase
->assertJsonPath('data.0.values.status', Ticket::STATUS_ACTIVE)
->assertJsonPath('data.0.status_label', 'Activo')
->assertJsonPath('data.0.allow_refund', false)
->assertJsonPath('data.0.is_active', true)
->assertJsonPath('data.0.can_cancel', true)
->assertJsonPath('data.0.can_refund', false)
->assertJsonMissingPath('data.0.values.ticket')
->assertJsonPath('data.0.values.date', '-')
->assertJsonPath('data.0.values.size', '-')
@@ -93,13 +96,15 @@ class AdminAppTicketControllerTest extends TestCase
// Default: neither total nor partial refund allowed
$this->getJson('/api/v1/adminapp/tenant/tickets')
->assertOk()
->assertJsonPath('data.0.allow_refund', false);
->assertJsonPath('data.0.allow_refund', false)
->assertJsonPath('data.0.can_refund', false);
// Total refund allowed
$tenant->update(['allow_ticket_total_refund' => true]);
$this->getJson('/api/v1/adminapp/tenant/tickets')
->assertOk()
->assertJsonPath('data.0.allow_refund', true);
->assertJsonPath('data.0.allow_refund', true)
->assertJsonPath('data.0.can_refund', true);
// Partial refund allowed with percentage set
$tenant->update([
@@ -109,7 +114,8 @@ class AdminAppTicketControllerTest extends TestCase
]);
$this->getJson('/api/v1/adminapp/tenant/tickets')
->assertOk()
->assertJsonPath('data.0.allow_refund', true);
->assertJsonPath('data.0.allow_refund', true)
->assertJsonPath('data.0.can_refund', true);
// Partial refund enabled but percentage is 0
$tenant->update([
@@ -117,7 +123,8 @@ class AdminAppTicketControllerTest extends TestCase
]);
$this->getJson('/api/v1/adminapp/tenant/tickets')
->assertOk()
->assertJsonPath('data.0.allow_refund', false);
->assertJsonPath('data.0.allow_refund', false)
->assertJsonPath('data.0.can_refund', false);
}
public function test_it_cancels_a_ticket_from_the_authenticated_tenant(): void