Unable to get payment creation date
Opened this issue · 2 comments
Describe the bug
In our custom code, we try to get the payment created date, but we encounter this TypeError:
TypeError: Adyen\Payment\Model\Order\Payment::getCreatedAt(): Return value must be of type DateTime, string returned in /vendor/adyen/module-payment/Model/Order/Payment.php:122
Magento version
2.4.5-p7
Plugin version
9.5.0
Thank you for raising this issue with us. Investigating on this, our plugin is setting the createdAt field in adyen_order_payment table here, and the type being passed to the DB is DateTime. Checking the value stored in the database while testing this flow, I can indeed confirm it to be a DateTime. I would suggest checking whether there are any customizations on your end that are interfering with how our plugin is storing this field in the database.
Kind regards,
Rok
@RokPopov Yes, it is stored as a DateTime in the database, but when it was fetched from the database, it was returned as a string.
Here is the \Adyen\Payment\Model\Order\Payment
object taken from the database
As you can see the dates here are in string format.
So, at least for \Adyen\Payment\Model\Order\Payment::getCreatedAt()
the return type of the function must be string.