src/Infrastructure/Payment/ApiPlatform/Payload/PaymentPayload.php line 12

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Infrastructure\Payment\ApiPlatform\Payload;
  4. use ApiPlatform\Metadata\ApiProperty;
  5. use App\Infrastructure\Payment\Validators\Constraints\UniqueExternalId;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. #[UniqueExternalId]
  8. class PaymentPayload
  9. {
  10.     #[Assert\NotNull]
  11.     #[Assert\NotBlank]
  12.     #[Assert\Type('string')]
  13.     #[Assert\Length(max256)]
  14.     public string $paymentId;
  15.     #[Assert\NotNull]
  16.     #[Assert\NotBlank]
  17.     #[Assert\Type('string')]
  18.     public string $userId;
  19.     #[ApiProperty(
  20.         openapiContext: [
  21.             'type' => 'float',
  22.             'example' => 10.5,
  23.         ]
  24.     )]
  25.     #[Assert\NotNull]
  26.     #[Assert\NotBlank]
  27.     #[Assert\Type('float')]
  28.     public float $amount;
  29.     #[ApiProperty(
  30.         openapiContext: [
  31.             'type' => 'string',
  32.             'example' => 'EUR',
  33.         ]
  34.     )]
  35.     #[Assert\NotNull]
  36.     #[Assert\NotBlank]
  37.     #[Assert\Currency]
  38.     #[Assert\Type('string')]
  39.     public string $currency;
  40.     #[ApiProperty(
  41.         openapiContext: [
  42.             'type' => 'string',
  43.             'example' => 'Test payment',
  44.         ]
  45.     )]
  46.     #[Assert\NotNull]
  47.     #[Assert\NotBlank]
  48.     #[Assert\Type('string')]
  49.     #[Assert\Length(max256)]
  50.     public string $description;
  51.     #[Assert\NotNull]
  52.     #[Assert\NotBlank]
  53.     #[Assert\Type('string')]
  54.     public string $successUrl;
  55.     #[Assert\NotNull]
  56.     #[Assert\NotBlank]
  57.     #[Assert\Type('string')]
  58.     public string $failureUrl;
  59.     #[Assert\NotNull]
  60.     #[Assert\NotBlank]
  61.     #[Assert\Type('string')]
  62.     public string $pendingUrl;
  63.     #[Assert\NotNull]
  64.     #[Assert\NotBlank]
  65.     #[Assert\Type('string')]
  66.     public string $notificationUrl;
  67.     #[ApiProperty(
  68.         openapiContext: [
  69.             'type' => 'string',
  70.             'example' => 'DK',
  71.         ]
  72.     )]
  73.     #[Assert\Type('string')]
  74.     public ?string $countryCode null;
  75.     #[ApiProperty(
  76.         openapiContext: [
  77.             'type' => 'string',
  78.             'example' => 'n26',
  79.         ]
  80.     )]
  81.     #[Assert\Type('string')]
  82.     public ?string $bankId null;
  83.     #[ApiProperty(
  84.         openapiContext: [
  85.             'type' => 'string',
  86.             'example' => 'John Doe',
  87.         ]
  88.     )]
  89.     #[Assert\Type('string')]
  90.     #[Assert\Length(max255)]
  91.     public ?string $debtorName null;
  92.     #[ApiProperty(
  93.         openapiContext: [
  94.             'type' => 'string',
  95.             'example' => 'DK5000400440116243',
  96.         ]
  97.     )]
  98.     #[Assert\Type('string')]
  99.     #[Assert\Length(max50)]
  100.     public ?string $debtorIban null;
  101.     #[ApiProperty(
  102.         openapiContext: [
  103.             'type' => 'string',
  104.             'example' => '<div class="container">${ibanxs}</div>',
  105.         ]
  106.     )]
  107.     #[Assert\Type('string')]
  108.     public ?string $html null;
  109.     #[ApiProperty(
  110.         openapiContext: [
  111.             'type' => 'string',
  112.             'example' => '.container { max-width: 500px; margin: 0 auto; }',
  113.         ]
  114.     )]
  115.     #[Assert\Type('string')]
  116.     public ?string $css null;
  117. }