feat: revenue cat
CI / 🧪 Tests Laravel (push) Successful in 2m24s
CI / 🐳 Build & Push Image (push) Successful in 1m13s

This commit is contained in:
2026-08-12 16:00:11 +02:00
parent 31633cfd2c
commit 29e85589b0
55 changed files with 703 additions and 2363 deletions
-64
View File
@@ -1,64 +0,0 @@
<?php
namespace App\Mail;
use App\Models\PaymentTransaction;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class PaymentInvoiceMail extends Mailable
{
use Queueable, SerializesModels;
public function __construct(
public User $user,
public PaymentTransaction $transaction,
) {}
public function envelope(): Envelope
{
return new Envelope(
subject: trans('mail.payment_invoice.subject', [], $this->mailLocale()),
);
}
public function content(): Content
{
return new Content(
view: 'emails.payment-invoice',
with: [
'amount' => $this->formattedAmount(),
'invoicePdfUrl' => $this->transaction->invoice_pdf_url,
'invoiceUrl' => $this->transaction->invoice_url,
'locale' => $this->mailLocale(),
'productName' => $this->transaction->billingProduct?->name,
'userName' => $this->user->name,
],
);
}
public function attachments(): array
{
return [];
}
private function formattedAmount(): string
{
if ($this->transaction->amount === null) {
return trans('mail.payment_invoice.unknown_amount', [], $this->mailLocale());
}
return number_format($this->transaction->amount / 100, 2, ',', ' ')
.' '
.strtoupper($this->transaction->currency ?: 'eur');
}
private function mailLocale(): string
{
return $this->user->preferredLocale() ?? 'en';
}
}