feat: better data wf

This commit is contained in:
2024-01-18 16:41:03 +01:00
parent 9bd3b5efff
commit 1a3cf1c2e0
22 changed files with 186 additions and 77 deletions

View File

@@ -3,10 +3,10 @@ declare(strict_types=1);
namespace App\Service\Remote\Edge;
use App\Entity\QRCode\QRCode;
use App\Entity\QRCode\QRCodeMoney;
use App\Entity\QRCode\QRCodePaymentIdentification;
use App\Entity\QRCode\QRCodeQROptions;
use App\Entity\DTO\QRCode\QRCode;
use App\Entity\DTO\QRCode\QRCodeMoney;
use App\Entity\DTO\QRCode\QRCodePaymentIdentification;
use App\Entity\DTO\QRCode\QRCodeQROptions;
use App\Entity\Remote\Usetreno\Edge\EdgeQRCode;
use App\Entity\Remote\Usetreno\Edge\EdgeQRCodeMoney;
use App\Entity\Remote\Usetreno\Edge\EdgeQRCodePaymentIdentification;
@@ -19,28 +19,28 @@ class QRCodeEntityConverter
public function convert(QRCode $code): EdgeQRCode {
return new EdgeQRCode(
$code->getIban() ?? throw new MissingParameterException("iban not set"),
$code->getDueDate() ? $code->getDueDate()->format('Y-m-d') : throw new MissingParameterException("due date not set"),
$code->getMessage() ?? throw new MissingParameterException("message not set"),
$this->convertMoney($code->getMoney() ?? throw new MissingParameterException("money not set")),
$this->convertCodeOptions($code->getCodeQROptions() ?? throw new MissingParameterException("codeQROptions not set")),
$this->convertIdentification($code->getPaymentIdentification())
$code->iban,
$code->dueDate->format('Y-m-d'),
$code->message,
$this->convertMoney($code->money),
$this->convertCodeOptions($code->qrOptions),
$this->convertIdentification($code->paymentIdentification)
);
}
protected function convertMoney(QRCodeMoney $money): EdgeQRCodeMoney
{
return new EdgeQRCodeMoney(
$money->getAmount() ?? throw new MissingParameterException("amount not set"),
$money->getCurrency() ?? throw new MissingParameterException("currency not set")
$money->amount,
$money->currency
);
}
protected function convertCodeOptions(QRCodeQROptions $options): EdgeQRCodeQROptions
{
return new EdgeQRCodeQROptions(
$options->getScale(),
$options->getMargin()
$options->scale,
$options->margin
);
}
@@ -53,9 +53,9 @@ class QRCodeEntityConverter
"0"
),
default => new EdgeQRCodePaymentIdentification(
$ident->getVariableSymbol() ?? "0",
$ident->getSpecificSymbol() ?? "0",
$ident->getConstantSymbol() ?? "0"
$ident->variableSymbol ?? "0",
$ident->specificSymbol ?? "0",
$ident->constantSymbol ?? "0"
)
};
}