- 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>
61 lines
2.2 KiB
PHP
61 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Abo;
|
|
|
|
use App\Services\Payment\Payone\DTOs\CreditCardCheckData;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateAboCreditCardRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
// Eigentümer-/Guard-spezifische Prüfung erfolgt im Controller
|
|
// (User\AboController::checkPermissions bzw. Portal\AboController::checkPortalPermission),
|
|
// analog zu den übrigen Abo-Aktionen. Hier nur Format-Validierung.
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<int, mixed>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'cc_cardholder_first' => ['required', 'string', 'max:50'],
|
|
'cc_cardholder_last' => ['required', 'string', 'max:50'],
|
|
'cc_cardpan' => ['required', 'string', 'regex:/^\d{12,19}$/'],
|
|
'cc_cardexpiremonth' => ['required', 'string', 'regex:/^(0[1-9]|1[0-2])$/'],
|
|
'cc_cardexpireyear' => ['required', 'string', 'digits:4'],
|
|
'cc_cardtype' => ['required', 'string', 'in:V,M'],
|
|
'cc_cardcvc2' => ['required', 'string', 'regex:/^\d{3,4}$/'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'cc_cardholder_first.required' => __('abo.card_holder_required'),
|
|
'cc_cardholder_last.required' => __('abo.card_holder_required'),
|
|
'cc_cardpan.required' => __('abo.card_number_invalid'),
|
|
'cc_cardpan.regex' => __('abo.card_number_invalid'),
|
|
'cc_cardexpiremonth.required' => __('abo.card_expiry_invalid'),
|
|
'cc_cardexpiremonth.regex' => __('abo.card_expiry_invalid'),
|
|
'cc_cardexpireyear.required' => __('abo.card_expiry_invalid'),
|
|
'cc_cardexpireyear.digits' => __('abo.card_expiry_invalid'),
|
|
'cc_cardtype.in' => __('abo.card_type_invalid'),
|
|
'cc_cardcvc2.required' => __('abo.card_cvc_invalid'),
|
|
'cc_cardcvc2.regex' => __('abo.card_cvc_invalid'),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Builds the validated, immutable DTO for the payment service.
|
|
*/
|
|
public function toDto(): CreditCardCheckData
|
|
{
|
|
return CreditCardCheckData::fromFormData($this->validated());
|
|
}
|
|
}
|