feat(tenant): add allow_refund and allow_partial_refund methods
This commit is contained in:
@@ -61,6 +61,48 @@ class TenantRefundConfigurationTest extends TestCase
|
||||
->assertJsonValidationErrors('ticket_partial_refund_percentage');
|
||||
}
|
||||
|
||||
public function test_tenant_allow_refund_logic(): void
|
||||
{
|
||||
$tenant = new Tenant([
|
||||
'allow_ticket_total_refund' => false,
|
||||
'allow_ticket_partial_refund' => false,
|
||||
'ticket_partial_refund_percentage' => 0,
|
||||
]);
|
||||
|
||||
$this->assertFalse($tenant->allow_refund());
|
||||
$this->assertFalse($tenant->allowRefund());
|
||||
$this->assertFalse($tenant->allow_refund);
|
||||
$this->assertFalse($tenant->allow_partial_refund());
|
||||
$this->assertFalse($tenant->allowPartialRefund());
|
||||
|
||||
// Partial refund enabled but percentage is 0 / unset
|
||||
$tenant->allow_ticket_partial_refund = true;
|
||||
$tenant->ticket_partial_refund_percentage = 0;
|
||||
$this->assertFalse($tenant->allow_refund());
|
||||
$this->assertFalse($tenant->allow_partial_refund());
|
||||
|
||||
// Partial refund enabled and percentage is set
|
||||
$tenant->ticket_partial_refund_percentage = 25.50;
|
||||
$this->assertTrue($tenant->allow_refund());
|
||||
$this->assertTrue($tenant->allowRefund());
|
||||
$this->assertTrue($tenant->allow_refund);
|
||||
$this->assertTrue($tenant->allow_partial_refund());
|
||||
$this->assertTrue($tenant->allowPartialRefund());
|
||||
|
||||
// Total refund enabled, partial refund disabled
|
||||
$tenant->allow_ticket_partial_refund = false;
|
||||
$tenant->allow_ticket_total_refund = true;
|
||||
$tenant->ticket_partial_refund_percentage = 0;
|
||||
$this->assertTrue($tenant->allow_refund());
|
||||
$this->assertFalse($tenant->allow_partial_refund());
|
||||
|
||||
// Total refund enabled and partial refund enabled with percentage
|
||||
$tenant->allow_ticket_partial_refund = true;
|
||||
$tenant->ticket_partial_refund_percentage = 50.00;
|
||||
$this->assertTrue($tenant->allow_refund());
|
||||
$this->assertTrue($tenant->allow_partial_refund());
|
||||
}
|
||||
|
||||
private function createTenant(string $code): Tenant
|
||||
{
|
||||
$attachmentIds = collect(['header', 'footer'])->map(function (string $name): int {
|
||||
|
||||
Reference in New Issue
Block a user