mivita/app/Mail/AboPaymentFailedMail.php
Kevin 0660f4e0a0 Abo-Recovery: fehlgeschlagene Folgezahlung im Checkout nachholen
- Pay-now-Flow: bei fehlgeschlagenem Abo (Status 3) begleicht der Inhaber die
  offene Rechnung im Standard-Checkout mit frei waehlbarer, abo-faehiger Zahlart
  (nur eigenes Abo: Berater me-View + Kundenportal), payNow-Controller + Routen
- AboRecoveryCheckoutService baut die ShoppingInstance aus den Abo-Artikeln;
  neue Spalte shopping_orders.recovery_user_abo_id verknuepft Bestellung<->Abo
- Bei Erfolg: AboHelper::advanceAboAfterRecoveryPayment schreibt das Abo fort
  (Status->2, next_date) und uebernimmt die gewaehlte Zahlart als neues Token
  fuer kuenftige Abbuchungen
- Neue Pay-now-Fehlermail (AboPaymentFailedMail) ersetzt die generische
  Fehlermail im Abo-Cron; Link fuehrt auf die Abo-Detailseite (CRM bzw. Portal)
- Retry-/"extern erledigt"-Buttons nur noch fuer Admins; tote user/portal-
  Retry-Routen entfernt
- Checkout: Recovery-Hinweis statt "Abschluss des Abonnements", Lieferadresse
  vorbelegt, korrekter Zurueck-Link (Abo statt Shop)
- UserAbo::selfServiceDetailUrl zentralisiert die Abo-URL (Mail, Back-Links)
- Test-Command abo:test-recovery; Tests fuer payNow, Advance-Logik, Fehlermail

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-02 10:38:05 +00:00

38 lines
1.2 KiB
PHP

<?php
namespace App\Mail;
use App\Models\UserAbo;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
/**
* Wird versendet, wenn eine Abo-Folgezahlung fehlschlägt (Abo geht auf Status 3).
* Enthält einen Link auf die Abo-Detailseite (Berater-CRM bei is_for=me, sonst Kundenportal),
* wo der Inhaber die offene Zahlung nachholen und damit die Zahlart für künftige Abbuchungen
* aktualisieren kann.
*/
class AboPaymentFailedMail extends Mailable
{
use Queueable, SerializesModels;
public function __construct(public UserAbo $userAbo) {}
public function build(): self
{
$firstname = $this->userAbo->shopping_user?->billing_firstname;
$salutation = $firstname ? __('email.hello').' '.$firstname : __('email.hello');
$link = $this->userAbo->selfServiceDetailUrl();
return $this->subject(__('abo.payment_failed_mail_subject'))
->view('emails.abo_payment_failed')
->with([
'salutation' => $salutation,
'link' => $link,
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),
]);
}
}