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:
baodev0
2026-10-19 16:37:56 +07:00
co-authored by Claude Sonnet 5.5
parent ea9a53f742
commit 25f23d541e
134 changed files with 4926 additions and 185 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Support;
use App\Models\Customer;
class CustomerBillingProfile
{
public const FIELDS = ['invoice_company', 'tax_code', 'invoice_address', 'invoice_email'];
public static function payload(Customer $customer): array
{
return [
'invoice_company' => $customer->invoice_company,
'tax_code' => $customer->tax_code,
'invoice_address' => $customer->invoice_address,
'invoice_email' => $customer->invoice_email,
];
}
public static function save(Customer $customer, array $input): array
{
$customer->update(array_map(
fn ($value) => is_string($value) && trim($value) === '' ? null : $value,
array_intersect_key($input, array_flip(self::FIELDS)) + array_fill_keys(self::FIELDS, null),
));
return self::payload($customer->fresh());
}
}