feat(billing): renewals, coupons, VAT numbering, billing cycles and invoice payment tracking
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
ea9a53f742
commit
25f23d541e
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use App\Models\Customer;
|
||||
use App\Models\Invoice;
|
||||
|
||||
class InvoiceBuyer
|
||||
{
|
||||
public static function fromCustomer(?Customer $customer): array
|
||||
{
|
||||
return [
|
||||
'name' => $customer?->fullname ?? '',
|
||||
'company' => $customer?->invoice_company ?: ($customer?->company ?? ''),
|
||||
'tax_code' => $customer?->tax_code ?? '',
|
||||
'address' => $customer?->invoice_address ?: ($customer?->address ?? ''),
|
||||
'email' => $customer?->invoice_email ?: ($customer?->email ?? ''),
|
||||
];
|
||||
}
|
||||
|
||||
public static function forInvoice(Invoice $invoice): array
|
||||
{
|
||||
return $invoice->buyer_snapshot ?: self::fromCustomer($invoice->customer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user