widerrufsbelehrung hinzugefügt und in den checkout mit eingebunden. refund ins backend eingebaut.
This commit is contained in:
52
app/Notifications/Ops/RefundProcessed.php
Normal file
52
app/Notifications/Ops/RefundProcessed.php
Normal 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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user