- Karten-Update ohne Abbuchung via PAYONE creditcardcheck/pseudocardpan (AboPaymentMethodService, CardUpdateResult/CreditCardCheckData-DTOs) - Eingabe nur durch Abo-Inhaber: CRM- und Portal-Formular + zeitlich begrenzter Berater→Kunde-Link (AboCardUpdateLink + Mail) - Änderungshistorie in user_abo_card_changes, Anzeige im Admin-Abo-Detail - Admin: Abo löschen (destroy) inkl. Test - Portal-Fix: myOrderCreate wirft 404 statt TypeError bei ungültiger ID - VIP-Sichtbarkeitstests für Einmalartikel-Fenster ergänzt - Enthält bereits die Freeze-Guards für den Stripe-Notbetrieb (Folge-Commit) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
63 lines
2.3 KiB
PHP
63 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Payment\Payone\DTOs;
|
|
|
|
use App\Http\Requests\Abo\UpdateAboCreditCardRequest;
|
|
use App\Services\Payment\Payone\PayonePaymentService;
|
|
use App\Services\Payone;
|
|
|
|
/**
|
|
* Immutable, validated credit-card input for a card-on-file update (Abo).
|
|
*
|
|
* Built from {@see UpdateAboCreditCardRequest} so the payment
|
|
* service never reads unvalidated request arrays. Raw PAN/CVC exist only inside this
|
|
* object on the way to the PAYONE creditcardcheck request and must never be logged
|
|
* (redaction is enforced in {@see Payone::sendRequest()}).
|
|
*/
|
|
class CreditCardCheckData
|
|
{
|
|
public function __construct(
|
|
public readonly string $cardholderFirstName,
|
|
public readonly string $cardholderLastName,
|
|
public readonly string $cardPan,
|
|
public readonly string $cardExpireMonth,
|
|
public readonly string $cardExpireYear,
|
|
public readonly string $cardType,
|
|
public readonly string $cardCvc2,
|
|
) {}
|
|
|
|
/**
|
|
* @param array<string, mixed> $data Keys as posted by the checkout/abo CC form (cc_*).
|
|
*/
|
|
public static function fromFormData(array $data): self
|
|
{
|
|
return new self(
|
|
cardholderFirstName: (string) ($data['cc_cardholder_first'] ?? ''),
|
|
cardholderLastName: (string) ($data['cc_cardholder_last'] ?? ''),
|
|
cardPan: (string) ($data['cc_cardpan'] ?? ''),
|
|
cardExpireMonth: (string) ($data['cc_cardexpiremonth'] ?? ''),
|
|
cardExpireYear: (string) ($data['cc_cardexpireyear'] ?? ''),
|
|
cardType: (string) ($data['cc_cardtype'] ?? ''),
|
|
cardCvc2: (string) ($data['cc_cardcvc2'] ?? ''),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Maps back to the cc_* parameter keys expected by
|
|
* {@see PayonePaymentService::checkCreditCard()}.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function toCheckArray(): array
|
|
{
|
|
return [
|
|
'cc_cardholder_first' => $this->cardholderFirstName,
|
|
'cc_cardholder_last' => $this->cardholderLastName,
|
|
'cc_cardpan' => $this->cardPan,
|
|
'cc_cardexpiremonth' => $this->cardExpireMonth,
|
|
'cc_cardexpireyear' => $this->cardExpireYear,
|
|
'cc_cardtype' => $this->cardType,
|
|
'cc_cardcvc2' => $this->cardCvc2,
|
|
];
|
|
}
|
|
}
|