Strangler-Refactoring der PAYONE-Zahlungslogik in eine testbare
Service-Schicht, ohne Verhalten in Checkout/Cron/IPN zu ändern.
Neue Services (app/Services/Payment/Payone):
- PayonePaymentService (+ PayonePaymentResult-DTO) für CC-/SEPA-Check
und Abo-Abbuchung
- PayoneRequestBuilder, PaymentMethodResolver, PayoneMethodConfig
- PayoneTransactionRecorder: zentrale PaymentTransaction-Erstellung
(API-Response, Invoice, Webhook) inkl. PCI-Redaction (cardpan/cardcvc2)
- PayoneWebhookHandler (+ PayoneWebhookResult): IPN/TSOK-Logik aus
Api\PayoneController; response('TSOK') statt echo/exit
- PayoneTransportException + Handler-Mapping (403) statt abort() im Service
Hotfixes (R1): var_dump/exit & bare exit() entfernt, Log-Redaction.
Security (R-Review):
- PAYONE_KEY_HASH (MD5-Hash, kein Klartext) mit Boot-Hard-Fail; schließt
zugleich die ''-Webhook-Bypass-Lücke. Artisan-Command payone:hash-key
(verdeckte Eingabe, optional --write) zur Hash-Erzeugung.
- Webhook: txaction Pflichtfeld, mode-Fallback auf payment->mode.
Pay\PayoneController ist @deprecated-Fassade (614 → 328 Zeilen),
delegiert an Services via Container-Singleton.
Migration: fehlende Spalte shopping_payments.carddata nachgezogen.
Tests: 47 grün (PayonePaymentService, Recorder, Webhook, Resolver,
TransportException, hash-key). End-to-End im Test-System verifiziert
(siehe dev/2026-06-09-payments).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
19 lines
660 B
PHP
19 lines
660 B
PHP
<?php
|
|
|
|
use Tests\TestCase;
|
|
|
|
uses(TestCase::class);
|
|
|
|
it('gibt den korrekten MD5-Hash für den PAYONE-Portal-Key aus', function (): void {
|
|
$this->artisan('payone:hash-key')
|
|
->expectsQuestion('PAYONE-Portal-Key (Klartext, verdeckte Eingabe)', 'Zjop5cvP2UeB7Qhy')
|
|
->expectsOutputToContain('698fb2555f8b2efc74f60b2121421f45')
|
|
->assertExitCode(0);
|
|
});
|
|
|
|
it('hasht beliebige Eingaben deterministisch (md5)', function (): void {
|
|
$this->artisan('payone:hash-key')
|
|
->expectsQuestion('PAYONE-Portal-Key (Klartext, verdeckte Eingabe)', 'hello')
|
|
->expectsOutputToContain(hash('md5', 'hello'))
|
|
->assertExitCode(0);
|
|
});
|