Symfony style error message

This commit is contained in:
Francis Hilaire 2024-02-22 18:47:08 +01:00 committed by Grzegorz Sadowski
parent fe5ad08276
commit de668e900a
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364

View file

@ -51,14 +51,14 @@ final class AddPaymentRequestHandler implements MessageHandlerInterface
'code' => $addPaymentRequest->getPaymentMethodCode(),
]);
Assert::notNull($paymentMethod, sprintf(
'Payment method code "%s", can not be found!',
'Payment method (code "%s") not found.',
$addPaymentRequest->getPaymentMethodCode(),
));
/** @var PaymentInterface|null $payment */
$payment = $this->paymentRepository->find($addPaymentRequest->getPaymentId());
Assert::notNull(
$payment,
sprintf('Payment ID "%s" can not be found!', $addPaymentRequest->getPaymentId()),
sprintf('Payment (id "%s") not found.', $addPaymentRequest->getPaymentId()),
);
$paymentRequest = $this->paymentRequestFactory->createWithPaymentAndPaymentMethod($payment, $paymentMethod);