60 lines
1.2 KiB
PHP
60 lines
1.2 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity\Input\QRCode;
|
|
|
|
use App\Validator\Currency;
|
|
use App\Validator\Money;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
/**
|
|
* Money type for QR code
|
|
*/
|
|
class QRCodeMoney
|
|
{
|
|
#[Assert\Positive(
|
|
message: 'messages.not_valid_amount',
|
|
)]
|
|
#[Assert\NotBlank(message: 'messages.fill_value')]
|
|
#[Money(message: 'messages.not_valid_amount')]
|
|
private ?string $amount;
|
|
|
|
// TODO: getCurrencies validation
|
|
#[Assert\NotBlank(message: 'messages.fill_value')]
|
|
#[Currency(message: 'messages.not_currency')]
|
|
private ?string $currency;
|
|
|
|
/**
|
|
* @param string|null $amount
|
|
* @param string|null $currency
|
|
*/
|
|
public function __construct(?string $amount = null, ?string $currency = null)
|
|
{
|
|
$this->amount = $amount;
|
|
$this->currency = $currency;
|
|
}
|
|
|
|
|
|
public function getAmount(): ?string
|
|
{
|
|
return $this->amount;
|
|
}
|
|
|
|
public function setAmount(?string $amount): void
|
|
{
|
|
$this->amount = $amount;
|
|
}
|
|
|
|
public function getCurrency(): ?string
|
|
{
|
|
return $this->currency;
|
|
}
|
|
|
|
public function setCurrency(?string $currency): void
|
|
{
|
|
$this->currency = $currency;
|
|
}
|
|
|
|
|
|
}
|