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
+25 -2
View File
@@ -6,17 +6,26 @@ use App\Mail\TemplateMailable;
use App\Support\EmailTemplateShell;
use App\Support\MailGlobals;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Queue\SerializesModels;
class HostingAccountCreated extends TemplateMailable
{
use Queueable, SerializesModels;
public function __construct(public array $data) {}
public function __construct(
public array $data,
public readonly ?string $invoicePdf = null,
public readonly ?string $invoicePdfFileName = null,
) {}
public function attachments(): array
{
return [];
if ($this->invoicePdf === null || $this->invoicePdfFileName === null) {
return [];
}
return [Attachment::fromData(fn () => $this->invoicePdf, $this->invoicePdfFileName)->withMime('application/pdf')];
}
protected function scenario(): string
@@ -47,6 +56,8 @@ class HostingAccountCreated extends TemplateMailable
'full_name' => $data['customer_name'] ?? 'Quý khách',
'domain_name' => $data['domain_name'] ?? '',
'hosting_plan' => $data['hosting_plan'] ?? '',
'server_name' => $data['server_name'] ?? '',
'recipient_label' => $this->recipientLabel($data),
'server_host_row' => $row('Máy chủ / FTP Host', $data['server_host'] ?? null),
'ftp_username_row' => $row('Tài khoản FTP', $data['ftp_username'] ?? null),
'ftp_password_row' => $row('Mật khẩu FTP', $data['ftp_password'] ?? null),
@@ -56,4 +67,16 @@ class HostingAccountCreated extends TemplateMailable
'plesk_block' => $pleskBlock,
];
}
private function recipientLabel(array $data): string
{
foreach (['customer_name', 'customer_company'] as $key) {
$value = trim((string) ($data[$key] ?? ''));
if ($value !== '') {
return $value;
}
}
return 'Công ty';
}
}