webmoney/backend/app/Mail/DuePaymentsAlert.php
marco 54cccdd095 refactor: migração para desenvolvimento direto no servidor
- Removido README.md padrão do Laravel (backend)
- Removidos scripts de deploy (não mais necessários)
- Atualizado copilot-instructions.md para novo fluxo
- Adicionada documentação de auditoria do servidor
- Sincronizado código de produção com repositório

Novo workflow:
- Trabalhamos diretamente em /root/webmoney (symlink para /var/www/webmoney)
- Mudanças PHP são instantâneas
- Mudanças React requerem 'npm run build'
- Commit após validação funcional
2025-12-19 11:45:32 +01:00

130 lines
3.9 KiB
PHP
Executable File

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Headers;
use Illuminate\Queue\SerializesModels;
class DuePaymentsAlert extends Mailable
{
use Queueable, SerializesModels;
public string $userName;
public array $overdueItems;
public array $tomorrowItems;
public array $accountBalances;
public float $totalAvailable;
public float $totalDue;
public float $shortage;
public array $payableItems;
public array $unpayableItems;
public array $transferSuggestions;
public string $currency;
/**
* Create a new message instance.
*/
public function __construct(
string $userName,
array $overdueItems,
array $tomorrowItems,
array $accountBalances,
float $totalAvailable,
float $totalDue,
float $shortage,
array $payableItems,
array $unpayableItems,
array $transferSuggestions,
string $currency = 'EUR'
) {
$this->userName = $userName;
$this->overdueItems = $overdueItems;
$this->tomorrowItems = $tomorrowItems;
$this->accountBalances = $accountBalances;
$this->totalAvailable = $totalAvailable;
$this->totalDue = $totalDue;
$this->shortage = $shortage;
$this->payableItems = $payableItems;
$this->unpayableItems = $unpayableItems;
$this->transferSuggestions = $transferSuggestions;
$this->currency = $currency;
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
$subject = $this->shortage > 0
? '⚠️ Alerta: Pagamentos Vencidos - Saldo Insuficiente'
: '📋 Lembrete: Pagamentos Pendentes';
return new Envelope(
from: new Address('no-reply@cnxifly.com', 'WEBMoney - ConneXiFly'),
replyTo: [
new Address('support@cnxifly.com', 'Soporte WEBMoney'),
],
subject: $subject,
tags: ['due-payments', 'alert'],
metadata: [
'total_due' => $this->totalDue,
'shortage' => $this->shortage,
],
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
view: 'emails.due-payments-alert',
text: 'emails.due-payments-alert-text',
with: [
'userName' => $this->userName,
'overdueItems' => $this->overdueItems,
'tomorrowItems' => $this->tomorrowItems,
'accountBalances' => $this->accountBalances,
'totalAvailable' => $this->totalAvailable,
'totalDue' => $this->totalDue,
'shortage' => $this->shortage,
'payableItems' => $this->payableItems,
'unpayableItems' => $this->unpayableItems,
'transferSuggestions' => $this->transferSuggestions,
'currency' => $this->currency,
],
);
}
/**
* Extra headers to help deliverability.
*/
public function headers(): Headers
{
return new Headers(
text: [
'X-Mailer' => 'WEBMoney/1.44.5',
'X-Priority' => '3',
'X-Auto-Response-Suppress' => 'OOF, AutoReply',
'Precedence' => 'bulk',
'List-Unsubscribe' => '<https://webmoney.cnxifly.com/preferences>, <mailto:no-reply@cnxifly.com?subject=unsubscribe>',
'List-Unsubscribe-Post' => 'List-Unsubscribe=One-Click',
],
);
}
/**
* Get the attachments for the message.
*/
public function attachments(): array
{
return [];
}
}