Stripe-Integration (S0–S3): Einmalzahlungen über Stripe Checkout + Notfall-Go-Live
Wegen PAYONE-Ausfall vorgezogen live geschaltet: alle Einmalzahlungen (Shop + Salescenter) laufen über Stripe Hosted Checkout, Abos sind bis Phase S4 eingefroren. - Provider-Abstraktion: PaymentProvider-Enum, PaymentGatewayInterface, PaymentProviderManager (Settings-Schalter, provider-treu je Bestand), PayoneGateway als unveränderter Adapter - StripePaymentService: Checkout Session (eine Gesamtposition, Metadata, success/cancel-Redirects), StripeClientWrapper (lazy, Dark Launch), StripeCustomerService, StripeTransactionRecorder (client_secret-Redaction) - Webhook /stripe/webhook: Signaturprüfung, Idempotenz über stripe_webhook_events (Crash-Retry-Reprocessing), txaction-Prioritäten, Betrags-Guard, lockForUpdate-Paid-Pfad, genau eine Bestätigungsmail - Zahlungsmethoden-Anzeige aus charge.succeeded (carddata inkl. Wallet, auftragsunabhängiges Backfill aus dem Event-Store) - Checkout: Wartungsmodus mit Admin-Bypass, Abo-Freeze-Hinweis, Stripe-Option (Online-Zahlung) statt Zahlartenwahl, Vorkasse ausblendbar - Abo-Freeze-Guards: Cron user:make_abo_order, Retry, Kartenupdate - Admin-Settings-Karte Zahlungen (Provider, Wartung, Freeze, Vorkasse) - Hotfix: 500 bei Vorkasse ohne Clearing-Daten in admin/sales/_detail und checkout-final (PAYONE-Ausfall) - Doku dev/2026-07-08-stripe/ (Plan S0–S8, Konzept, IST-Analyse) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
671022a28d
commit
6f21845607
48 changed files with 4428 additions and 831 deletions
|
|
@ -3,7 +3,9 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* App\Models\ShoppingPayment
|
||||
|
|
@ -18,11 +20,12 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property string $currency
|
||||
* @property string|null $status
|
||||
* @property string|null $txaction
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\PaymentTransaction[] $payment_transactions
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|PaymentTransaction[] $payment_transactions
|
||||
* @property-read int|null $payment_transactions_count
|
||||
* @property-read \App\Models\ShoppingOrder $shopping_order
|
||||
* @property-read ShoppingOrder $shopping_order
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment query()
|
||||
|
|
@ -38,28 +41,37 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereTxaction($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereWallettype($value)
|
||||
*
|
||||
* @property string|null $mode
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereMode($value)
|
||||
*
|
||||
* @property array|null $carddata
|
||||
* @property int|null $is_abo
|
||||
* @property int|null $abo_interval
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingPayment whereAboInterval($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingPayment whereCarddata($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingPayment whereIsAbo($value)
|
||||
*
|
||||
* @property string|null $identifier
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ShoppingPayment whereIdentifier($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingPayment extends Model
|
||||
{
|
||||
protected $table = 'shopping_payments';
|
||||
|
||||
|
||||
protected $casts = [
|
||||
'carddata' => 'array',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'shopping_order_id',
|
||||
'payment_provider',
|
||||
'external_reference',
|
||||
'clearingtype',
|
||||
'wallettype',
|
||||
'onlinebanktransfertype',
|
||||
|
|
@ -73,47 +85,86 @@ class ShoppingPayment extends Model
|
|||
'identifier',
|
||||
];
|
||||
|
||||
|
||||
public function shopping_order()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ShoppingOrder','shopping_order_id');
|
||||
return $this->belongsTo('App\Models\ShoppingOrder', 'shopping_order_id');
|
||||
}
|
||||
|
||||
public function payment_transactions()
|
||||
{
|
||||
return $this->hasMany('App\Models\PaymentTransaction','shopping_payment_id');
|
||||
return $this->hasMany('App\Models\PaymentTransaction', 'shopping_payment_id');
|
||||
}
|
||||
|
||||
public function getPaymentType(){
|
||||
|
||||
if($this->clearingtype === 'wlt') {
|
||||
public function getPaymentType()
|
||||
{
|
||||
if ($this->payment_provider === 'stripe') {
|
||||
return $this->stripePaymentTypeLabel();
|
||||
}
|
||||
|
||||
if ($this->clearingtype === 'wlt') {
|
||||
if ($this->wallettype === 'PPE') {
|
||||
return __('payment.paypal');
|
||||
}
|
||||
}
|
||||
if($this->clearingtype === 'cc') {
|
||||
return __('payment.credit_card');
|
||||
if ($this->clearingtype === 'cc') {
|
||||
return __('payment.credit_card');
|
||||
}
|
||||
if($this->clearingtype === 'vor') {
|
||||
if ($this->clearingtype === 'vor') {
|
||||
return __('payment.prepayment');
|
||||
}
|
||||
if($this->clearingtype === 'elv') {
|
||||
return __('payment.sepa_direct_debit');
|
||||
if ($this->clearingtype === 'elv') {
|
||||
return __('payment.sepa_direct_debit');
|
||||
}
|
||||
if($this->clearingtype === 'sb') {
|
||||
if ($this->clearingtype === 'sb') {
|
||||
if ($this->onlinebanktransfertype === 'PNT') {
|
||||
return __('payment.sofort_bank_transfer');
|
||||
return __('payment.sofort_bank_transfer');
|
||||
}
|
||||
}
|
||||
if($this->clearingtype === 'fnc') {
|
||||
if ($this->clearingtype === 'fnc') {
|
||||
if ($this->onlinebanktransfertype === 'MIV') {
|
||||
return __('payment.purchase_on_account');
|
||||
return __('payment.purchase_on_account');
|
||||
}
|
||||
}
|
||||
|
||||
return __('payment.unknown');
|
||||
}
|
||||
|
||||
public function getPaymentAmount(){
|
||||
return Util::formatNumber($this->amount/100)." ".$this->currency;
|
||||
public function getPaymentAmount()
|
||||
{
|
||||
return Util::formatNumber($this->amount / 100).' '.$this->currency;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Anzeige-Label für Stripe-Zahlungen aus den gespeicherten
|
||||
* payment_method_details (StripeWebhookHandler::storePaymentMethodDetails).
|
||||
*/
|
||||
private function stripePaymentTypeLabel(): string
|
||||
{
|
||||
$details = is_array($this->carddata) ? $this->carddata : [];
|
||||
$type = $details['type'] ?? null;
|
||||
|
||||
$cardSuffix = ! empty($details['brand']) && ! empty($details['last4'])
|
||||
? ' ('.ucfirst($details['brand']).' •••• '.$details['last4'].')'
|
||||
: '';
|
||||
|
||||
if ($type === 'card') {
|
||||
$wallet = $details['wallet'] ?? null;
|
||||
if ($wallet === 'apple_pay') {
|
||||
return 'Apple Pay'.$cardSuffix;
|
||||
}
|
||||
if ($wallet === 'google_pay') {
|
||||
return 'Google Pay'.$cardSuffix;
|
||||
}
|
||||
|
||||
return __('payment.credit_card').$cardSuffix;
|
||||
}
|
||||
|
||||
return match ($type) {
|
||||
'paypal' => __('payment.paypal'),
|
||||
'klarna' => 'Klarna',
|
||||
'amazon_pay' => 'Amazon Pay',
|
||||
'sepa_debit' => __('payment.sepa_direct_debit').(! empty($details['last4']) ? ' (•••• '.$details['last4'].')' : ''),
|
||||
default => __('payment.stripe_online_short'),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue