feat(tenant): add master toggle for ticket refunds

This commit is contained in:
2026-09-11 16:22:27 -03:00
parent b4da6e3747
commit c0c19c9c01
9 changed files with 102 additions and 11 deletions

View File

@@ -52,6 +52,7 @@ use Illuminate\Support\Facades\Schema;
'checkout_editing_policy',
'display_cart_item_images',
'scanner_category_validation_enabled',
'allow_ticket_refund',
'allow_ticket_total_refund',
'allow_ticket_partial_refund',
'ticket_partial_refund_percentage',
@@ -75,6 +76,7 @@ class Tenant extends Model
'checkout_editing_policy' => CartEditingPolicy::Disabled->value,
'display_cart_item_images' => true,
'scanner_category_validation_enabled' => true,
'allow_ticket_refund' => false,
'allow_ticket_total_refund' => false,
'allow_ticket_partial_refund' => false,
'ticket_partial_refund_percentage' => 0,
@@ -114,12 +116,14 @@ class Tenant extends Model
public function allow_refund(): bool
{
return (bool) $this->allow_ticket_total_refund || $this->allow_partial_refund();
return (bool) $this->allow_ticket_refund
&& ((bool) $this->allow_ticket_total_refund || $this->allow_partial_refund());
}
public function allow_partial_refund(): bool
{
return (bool) $this->allow_ticket_partial_refund
return (bool) $this->allow_ticket_refund
&& (bool) $this->allow_ticket_partial_refund
&& $this->ticket_partial_refund_percentage !== null
&& (float) $this->ticket_partial_refund_percentage > 0;
}
@@ -157,6 +161,7 @@ class Tenant extends Model
'checkout_editing_policy' => CartEditingPolicy::class,
'display_cart_item_images' => 'boolean',
'scanner_category_validation_enabled' => 'boolean',
'allow_ticket_refund' => 'boolean',
'allow_ticket_total_refund' => 'boolean',
'allow_ticket_partial_refund' => 'boolean',
'ticket_partial_refund_percentage' => 'decimal:2',