Commit 7f205197 by Yvon Kerdoncuff

payment hot fix : $p->getCreatedAt() does not always exist

parent 807a021d
...@@ -63,6 +63,9 @@ class PaymentRepository extends ServiceEntityRepository ...@@ -63,6 +63,9 @@ class PaymentRepository extends ServiceEntityRepository
$p->setStartingPaymentAnalysisStatus('NOT CONCERNED'); $p->setStartingPaymentAnalysisStatus('NOT CONCERNED');
continue; continue;
} }
if (!$p->getCreatedAt()) {
$p->setStartingPaymentAnalysisStatus('TIMEOUT');
} else {
$createdAt = clone $p->getCreatedAt(); //don't modify original object $createdAt = clone $p->getCreatedAt(); //don't modify original object
$timeout = $createdAt->add(\DateInterval::createFromDateString("10 minutes")); $timeout = $createdAt->add(\DateInterval::createFromDateString("10 minutes"));
if ($timeout < new \DateTime()) { if ($timeout < new \DateTime()) {
...@@ -71,6 +74,7 @@ class PaymentRepository extends ServiceEntityRepository ...@@ -71,6 +74,7 @@ class PaymentRepository extends ServiceEntityRepository
return $timeout; return $timeout;
} }
} }
}
//Note : some fields updates are done in this method to exclude non-candidate payment from future research. //Note : some fields updates are done in this method to exclude non-candidate payment from future research.
//We may not want to flush here so flushing will probably not occur when an ongoing starting payment is found, //We may not want to flush here so flushing will probably not occur when an ongoing starting payment is found,
//but it will occur only when the payment process succeeds, which is fine. //but it will occur only when the payment process succeeds, which is fine.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment