mivita/tests/Feature/StripeFoundationTest.php
Kevin 6f21845607 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>
2026-07-08 15:56:41 +00:00

32 lines
1.1 KiB
PHP

<?php
use App\Enums\PaymentProvider;
use Stripe\StripeClient;
use Tests\TestCase;
uses(TestCase::class);
it('loads the stripe configuration from the environment', function () {
expect(config('stripe.secret'))->toBe('sk_test_fake_suite_key')
->and(config('stripe.key'))->toBe('pk_test_fake_suite_key')
->and(config('stripe.webhook_secret'))->toBe('whsec_fake_suite_secret')
->and(config('stripe.mode'))->toBe('test');
});
it('does not hard-fail the boot when stripe secrets are missing', function () {
config(['stripe.secret' => null, 'stripe.webhook_secret' => null]);
expect(config('stripe.secret'))->toBeNull()
->and(config('stripe.mode'))->toBe('test');
});
it('exposes both payment providers as enum', function () {
expect(PaymentProvider::Payone->value)->toBe('payone')
->and(PaymentProvider::Stripe->value)->toBe('stripe')
->and(PaymentProvider::from('stripe'))->toBe(PaymentProvider::Stripe)
->and(PaymentProvider::tryFrom('unknown'))->toBeNull();
});
it('has the stripe sdk installed', function () {
expect(class_exists(StripeClient::class))->toBeTrue();
});