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

@@ -141,12 +141,12 @@ class AdminAppTicketService
$remainingItemAmount = max(0.0, round($itemTotal - $itemRefundedAmount, 2));
$total = null;
if ($tenant->allow_ticket_total_refund && $unitPrice <= $remainingItemAmount) {
if ($tenant->allow_refund() && $tenant->allow_ticket_total_refund && $unitPrice <= $remainingItemAmount) {
$total = number_format($unitPrice, 2, '.', '');
}
$partial = null;
if ($tenant->allow_partial_refund()) {
if ($tenant->allow_refund() && $tenant->allow_partial_refund()) {
$partialAmount = $this->refundAmount($purchaseItem, $tenant, 'partial');
if ($partialAmount <= $remainingItemAmount) {
$partial = number_format($partialAmount, 2, '.', '');
@@ -214,8 +214,8 @@ class AdminAppTicketService
private function ensureRefundIsAllowed(Tenant $tenant, string $refundType): void
{
$isAllowed = match ($refundType) {
'partial' => $tenant->allow_partial_refund(),
'total' => (bool) $tenant->allow_ticket_total_refund,
'partial' => $tenant->allow_refund() && $tenant->allow_partial_refund(),
'total' => $tenant->allow_refund() && (bool) $tenant->allow_ticket_total_refund,
};
if (! $isAllowed) {