feat: implement payment step
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Model;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* DTO for bank account information used in payment processing.
|
||||
*/
|
||||
class BankAccountDto
|
||||
{
|
||||
#[Assert\NotBlank(message: 'Bitte geben Sie Ihre IBAN ein.')]
|
||||
#[Assert\Iban(message: 'Die eingegebene IBAN ist ungültig.')]
|
||||
public ?string $iban = null;
|
||||
|
||||
#[Assert\NotBlank(message: 'Bitte geben Sie den Kontoinhaber ein.')]
|
||||
#[Assert\Length(
|
||||
min: 2,
|
||||
max: 70,
|
||||
minMessage: 'Der Kontoinhaber muss mindestens {{ limit }} Zeichen lang sein.',
|
||||
maxMessage: 'Der Kontoinhaber darf maximal {{ limit }} Zeichen lang sein.'
|
||||
)]
|
||||
public ?string $accountHolder = null;
|
||||
|
||||
#[Assert\Length(
|
||||
max: 70,
|
||||
maxMessage: 'Der Bankname darf maximal {{ limit }} Zeichen lang sein.'
|
||||
)]
|
||||
public ?string $bankName = null;
|
||||
|
||||
#[Assert\IsTrue(message: 'Bitte akzeptieren Sie das SEPA-Mandat.')]
|
||||
public bool $sepaMandateAccepted = false;
|
||||
|
||||
/**
|
||||
* Returns IBAN formatted with spaces for display (e.g., DE12 3456 7890 1234 5678 90).
|
||||
*/
|
||||
public function getFormattedIban(): ?string
|
||||
{
|
||||
if (null === $this->iban) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$cleanIban = $this->getIbanWithoutSpaces();
|
||||
|
||||
return chunk_split($cleanIban, 4, ' ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns IBAN without spaces for storage and API submission.
|
||||
*/
|
||||
public function getIbanWithoutSpaces(): ?string
|
||||
{
|
||||
if (null === $this->iban) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (string) preg_replace('/\s+/', '', $this->iban);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user