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,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\Customer;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Service;
|
||||
use App\Services\InvoicePaymentService;
|
||||
use App\Support\MailGlobals;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class AutoRenewFailedMail extends TemplateMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public const SCENARIO = 'auto_renew_failed';
|
||||
|
||||
public function __construct(
|
||||
public readonly Customer $customer,
|
||||
public readonly Service $service,
|
||||
public readonly Invoice $invoice,
|
||||
) {}
|
||||
|
||||
protected function scenario(): string
|
||||
{
|
||||
return self::SCENARIO;
|
||||
}
|
||||
|
||||
protected function variables(): array
|
||||
{
|
||||
$serverName = (string) $this->service->server_name;
|
||||
$frontend = MailGlobals::frontendUrl();
|
||||
|
||||
return [
|
||||
'client_name' => $this->customer->fullname ?? '',
|
||||
'product_name' => $this->service->product?->name ?? 'Dịch vụ',
|
||||
'server_name_suffix' => $serverName !== '' ? ' (' . e($serverName) . ')' : '',
|
||||
'expires_at' => $this->service->expires_at?->format('d/m/Y') ?? 'N/A',
|
||||
'invoice_number' => $this->invoice->invoice_number,
|
||||
'outstanding' => number_format(InvoicePaymentService::outstanding($this->invoice), 0, ',', '.'),
|
||||
'balance_formatted' => number_format((int) $this->customer->total, 0, ',', '.'),
|
||||
'topup_url' => $frontend . '/nap-tien',
|
||||
'invoice_url' => $frontend . $this->invoice->clientPath(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user