widerrufsbelehrung hinzugefügt und in den checkout mit eingebunden. refund ins backend eingebaut.

This commit is contained in:
Codex Agent
2025-12-07 11:57:05 +01:00
parent e092f72475
commit 1d3d49e05a
44 changed files with 1143 additions and 71 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Notifications\Customer;
use App\Models\PackagePurchase;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class RefundReceipt extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
private readonly PackagePurchase $purchase,
private readonly ?string $reason = null,
) {}
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(object $notifiable): MailMessage
{
$tenant = $this->purchase->tenant;
$package = $this->purchase->package;
$amount = number_format((float) $this->purchase->price, 2);
$mail = (new MailMessage)
->subject(__('emails.refund.subject', ['package' => $package?->name ?? __('emails.package_limits.package_fallback')]))
->greeting(__('emails.refund.greeting', ['name' => $tenant?->name ?? __('emails.package_limits.team_fallback')]))
->line(__('emails.refund.body', [
'amount' => $amount,
'currency' => '€',
'provider_id' => $this->purchase->provider_id ?? '—',
]));
if ($this->reason) {
$mail->line(__('emails.refund.reason', ['reason' => $this->reason]));
}
return $mail->line(__('emails.refund.footer'));
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Notifications\Ops;
use App\Models\EventPackageAddon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class AddonPurchased extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(private readonly EventPackageAddon $addon) {}
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(object $notifiable): MailMessage
{
$event = $this->addon->event;
$tenant = $event?->tenant;
$label = $this->addon->metadata['label'] ?? $this->addon->addon_key;
$amount = $this->addon->amount ? number_format((float) $this->addon->amount, 2) : null;
$currency = $this->addon->currency ?? 'EUR';
return (new MailMessage)
->subject(__('emails.ops.addon.subject', ['addon' => $label]))
->greeting(__('emails.ops.addon.greeting'))
->line(__('emails.ops.addon.tenant', ['tenant' => $tenant?->name ?? __('emails.tenant_feedback.unknown_tenant')]))
->line(__('emails.ops.addon.event', ['event' => $event?->name['de'] ?? $event?->name['en'] ?? $event?->name ?? __('emails.package_limits.event_fallback')]))
->line(__('emails.ops.addon.addon', ['addon' => $label, 'quantity' => $this->addon->quantity]))
->when($amount, fn ($mail) => $mail->line(__('emails.ops.addon.amount', ['amount' => $amount, 'currency' => $currency])))
->line(__('emails.ops.addon.provider', [
'checkout' => $this->addon->checkout_id ?? '—',
'transaction' => $this->addon->transaction_id ?? '—',
]))
->line(__('emails.ops.addon.footer'));
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Notifications\Ops;
use App\Models\PackagePurchase;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class PurchaseCreated extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(private readonly PackagePurchase $purchase) {}
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(object $notifiable): MailMessage
{
$tenant = $this->purchase->tenant;
$package = $this->purchase->package;
$amount = number_format((float) $this->purchase->price, 2);
$consents = $this->purchase->metadata['consents'] ?? [];
return (new MailMessage)
->subject(__('emails.ops.purchase.subject', ['package' => $package?->name ?? __('emails.package_limits.package_fallback')]))
->greeting(__('emails.ops.purchase.greeting'))
->line(__('emails.ops.purchase.tenant', ['tenant' => $tenant?->name ?? __('emails.tenant_feedback.unknown_tenant')]))
->line(__('emails.ops.purchase.package', ['package' => $package?->name ?? __('emails.package_limits.package_fallback')]))
->line(__('emails.ops.purchase.amount', ['amount' => $amount, 'currency' => '€']))
->line(__('emails.ops.purchase.provider', ['provider' => $this->purchase->provider, 'id' => $this->purchase->provider_id ?? '—']))
->line(__('emails.ops.purchase.consents', [
'legal' => $consents['legal_version'] ?? 'n/a',
'terms' => $consents['accepted_terms_at'] ?? 'n/a',
'waiver' => $consents['digital_content_waiver_at'] ?? 'n/a',
]))
->line(__('emails.ops.purchase.footer'));
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace App\Notifications\Ops;
use App\Models\PackagePurchase;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class RefundProcessed extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
private readonly PackagePurchase $purchase,
private readonly bool $success,
private readonly ?string $reason = null,
private readonly ?string $error = null,
) {}
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(object $notifiable): MailMessage
{
$tenant = $this->purchase->tenant;
$package = $this->purchase->package;
$amount = number_format((float) $this->purchase->price, 2);
$mail = (new MailMessage)
->subject(__('emails.ops.refund.subject', ['package' => $package?->name ?? __('emails.package_limits.package_fallback')]))
->greeting(__('emails.ops.refund.greeting'))
->line(__('emails.ops.refund.tenant', ['tenant' => $tenant?->name ?? __('emails.tenant_feedback.unknown_tenant')]))
->line(__('emails.ops.refund.package', ['package' => $package?->name ?? __('emails.package_limits.package_fallback')]))
->line(__('emails.ops.refund.amount', ['amount' => $amount, 'currency' => '€']))
->line(__('emails.ops.refund.provider', ['provider' => $this->purchase->provider, 'id' => $this->purchase->provider_id ?? '—']))
->line($this->success ? __('emails.ops.refund.status_success') : __('emails.ops.refund.status_failed'));
if ($this->reason) {
$mail->line(__('emails.ops.refund.reason', ['reason' => $this->reason]));
}
if ($this->error) {
$mail->line(__('emails.ops.refund.error', ['error' => $this->error]));
}
return $mail->line(__('emails.ops.refund.footer'));
}
}