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>
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Payment\Stripe;
|
|
|
|
use Stripe\StripeClient;
|
|
|
|
/**
|
|
* Dünne, injizierbare Hülle um den Stripe-SDK-Client.
|
|
*
|
|
* Hier sitzt der bewusst aus config/stripe.php verlagerte Hard-Fail
|
|
* (Plan S0.4-Abweichung): Ein Deployment ohne Stripe-Keys bootet normal
|
|
* (Dark Launch); erst die tatsächliche Nutzung ohne STRIPE_SECRET
|
|
* schlägt hart und diagnostizierbar fehl.
|
|
*/
|
|
class StripeClientWrapper
|
|
{
|
|
private ?StripeClient $client = null;
|
|
|
|
public function __construct(private readonly ?string $secret) {}
|
|
|
|
public function client(): StripeClient
|
|
{
|
|
if ($this->client === null) {
|
|
if ($this->secret === null || trim($this->secret) === '') {
|
|
throw new \RuntimeException(
|
|
'STRIPE_SECRET ist nicht gesetzt. Hinterlege den Stripe Secret Key (sk_…) in der .env, bevor Stripe als Zahlungsanbieter genutzt wird.'
|
|
);
|
|
}
|
|
$this->client = new StripeClient($this->secret);
|
|
}
|
|
|
|
return $this->client;
|
|
}
|
|
|
|
public function isConfigured(): bool
|
|
{
|
|
return $this->secret !== null && trim($this->secret) !== '';
|
|
}
|
|
}
|