mivita/tests/Feature/PaymentMethodsCommunicationTest.php
Kevin ce4750fd1a Stripe-Integration (S4, S5, S7.6): Abos, Zahlungsart ändern, Zahlarten-Kommunikation
Phase S4 – Abos über Stripe (E2E komplett im Testmodus):
- Abo-/Recovery-Checkout: customer_creation=always + setup_future_usage=off_session
- StripePaymentService::chargeAbo (off-session PaymentIntent, Idempotency-Key),
  StripeGateway, Provider-Dispatch im Abbuchungs-Cron (PAYONE-Pfad unverändert)
- Webhook: Zahlungsmittel-Capture vor Paid-Pfad, 503 payment_not_yet_visible bei
  Cron-Transaktions-Race; Command stripe:process-pending-events (Cron-Ende + 10-min
  Scheduler) verarbeitet liegengebliebene Events nach
- createNewAbo/advanceAboAfterRecoveryPayment Stripe-aware inkl. Race-Absicherung;
  Recovery-Orders nutzen advanceAboAfterRecoveryPayment (latenter PAYONE-Duplikat-Bug)
- Migrationen: Stripe-Abo-Spalten auf shopping_payments; clearingtype varchar(3)→(20)
  inkl. Reparatur der zu 'str' gekürzten Live-Zeilen

Phase S5 – Zahlungsart ändern (Scope: jede Zahlart, nicht nur Kreditkarte):
- Stripe Checkout mode=setup ohne Abbuchung; PAYONE-Abos ziehen beim Wechsel auf
  Stripe um (Auslaufmodell §7.2)
- AboPaymentMethodService: beginStripeChange/finalize/applyStripePaymentMethod
  (idempotent, detacht alte PM, card_changes-Log); Webhook setup_intent.succeeded
  als Sicherheitsnetz; Einstiege Portal/CRM/Berater-Kunden-Link flow-abhängig
- Views/Mails flow-abhängig („Zahlungsweise" statt „Kreditkarte")

Phase S7.6 – Zahlarten-Kommunikation:
- Einheitliche Zahlarten-Logos (SVG) + wiederverwendbares Partial payment_logos;
  Checkout/Footer zeigen Kern-Zahlarten + „···"-Icon, /zahlungsarten komplett neu
  mit allen aktiven Stripe-Zahlarten (gegen Account-Konfiguration verifiziert)
  und Vorkasse (PAYONE); Sofort/SEPA entfernt

Tests: StripeAboTest (15), StripePaymentMethodChangeTest (10),
PaymentMethodsCommunicationTest (28), PaymentProviderManagerTest angepasst.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 14:45:17 +00:00

70 lines
3.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use Illuminate\Support\Facades\Lang;
use Tests\TestCase;
uses(TestCase::class);
/**
* Plan S7.6 – Zahlarten-Kommunikation: Logos + Benennung der Stripe-Zahlarten
* (Checkout, Footer, /zahlungsarten).
*/
it('renders the core payment logos with vorkasse and a more icon by default', function () {
$html = view('web.layouts.includes.payment_logos')->render();
foreach (['Visa', 'Mastercard', 'American Express', 'PayPal', 'Apple Pay', 'Google Pay', 'Klarna', 'Amazon Pay', 'Link', 'EPS', 'Bancontact'] as $label) {
expect($html)->toContain('title="'.$label.'"');
}
expect($html)->toContain('vorkasse.svg')
->and($html)->toContain(__('payment.prepayment_payone'))
->and($html)->toContain('more.svg')
->and($html)->toContain(__('weborder.payment_method_more'))
->and($html)->not->toContain('blik.svg');
});
it('renders all regional payment logos without the more icon when showAll is set', function () {
$html = view('web.layouts.includes.payment_logos', ['showAll' => true])->render();
foreach (['BLIK', 'MB WAY', 'Pix', 'Satispay', 'Samsung Pay', 'Kakao Pay', 'Naver Pay', 'PAYCO'] as $label) {
expect($html)->toContain('title="'.$label.'"');
}
expect($html)->not->toContain('more.svg');
});
it('can render the payment logos partial without vorkasse', function () {
$html = view('web.layouts.includes.payment_logos', ['showVorkasse' => false])->render();
expect($html)->not->toContain('vorkasse.svg')
->and($html)->toContain('klarna.svg');
});
it('ships all referenced payment logo assets in public', function () {
foreach (['visa', 'mastercard', 'amex', 'paypal', 'applepay', 'googlepay', 'klarna', 'amazonpay', 'link', 'eps', 'bancontact', 'blik', 'mbway', 'pix', 'satispay', 'samsungpay', 'kakaopay', 'naverpay', 'payco', 'vorkasse', 'more'] as $file) {
expect(file_exists(public_path('images/payments-assets/'.$file.'.svg')))
->toBeTrue('missing asset: '.$file.'.svg');
}
});
it('has german and english copy for every payment method on the zahlungsarten page', function (string $key) {
expect(Lang::has('weborder.'.$key, 'de'))->toBeTrue('missing de key: '.$key)
->and(Lang::has('weborder.'.$key, 'en'))->toBeTrue('missing en key: '.$key);
})->with([
'payment_methods_intro',
'payment_method_creditcard', 'payment_method_creditcard_copy',
'payment_method_paypal', 'payment_method_paypal_copy',
'payment_method_applepay', 'payment_method_applepay_copy',
'payment_method_googlepay', 'payment_method_googlepay_copy',
'payment_method_klarna', 'payment_method_klarna_copy',
'payment_method_amazonpay', 'payment_method_amazonpay_copy',
'payment_method_link', 'payment_method_link_copy',
'payment_method_eps', 'payment_method_eps_copy',
'payment_method_bancontact', 'payment_method_bancontact_copy',
'payment_method_more', 'payment_method_more_copy',
'payment_method_prepayment', 'payment_method_prepayment_copy',
]);
it('labels vorkasse with payone on the zahlungsarten page', function () {
expect(__('weborder.payment_method_prepayment', [], 'de'))->toBe('Vorkasse (PAYONE)');
});