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
@@ -4,7 +4,6 @@ namespace App\Jobs\Mail;
|
||||
|
||||
use App\Http\Services\Telegram;
|
||||
use App\Mail\Customer\VmCredentials;
|
||||
use App\Models\Invoice;
|
||||
use App\Services\InvoicePdfService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
@@ -33,28 +32,9 @@ class SendInformationVirtualMachine implements ShouldQueue
|
||||
public function handle(): void
|
||||
{
|
||||
try {
|
||||
// Generate PDF inside the job — never pass binary blobs through queue payload
|
||||
$invoice = null;
|
||||
$invoicePdf = null;
|
||||
$invoicePdfFileName = null;
|
||||
|
||||
if ($this->invoiceId) {
|
||||
try {
|
||||
$invoice = Invoice::with(['invoiceItems.product', 'customer', 'order.orderItems'])
|
||||
->find($this->invoiceId);
|
||||
|
||||
if ($invoice) {
|
||||
$pdfService = app(InvoicePdfService::class);
|
||||
$invoicePdf = $pdfService->generate($invoice);
|
||||
$invoicePdfFileName = $pdfService->generateFileName($invoice);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('SendInformationVirtualMachine: PDF generation failed, sending without attachment', [
|
||||
'invoice_id' => $this->invoiceId,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
$attachment = app(InvoicePdfService::class)->attachment($this->invoiceId);
|
||||
$invoicePdf = $attachment['pdf'] ?? null;
|
||||
$invoicePdfFileName = $attachment['file_name'] ?? null;
|
||||
|
||||
$email = new VmCredentials($this->data, $invoicePdf, $invoicePdfFileName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user