Commit 9186ba4b by Yvon Kerdoncuff

take into account payment lines with status new or null

parent 0f70de63
...@@ -5,6 +5,7 @@ namespace App\Repository; ...@@ -5,6 +5,7 @@ namespace App\Repository;
use App\Entity\Payment; use App\Entity\Payment;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Payum\Core\Request\GetHumanStatus;
use Symfony\Component\HttpClient\HttpClient; use Symfony\Component\HttpClient\HttpClient;
/** /**
...@@ -53,11 +54,14 @@ class PaymentRepository extends ServiceEntityRepository ...@@ -53,11 +54,14 @@ class PaymentRepository extends ServiceEntityRepository
{ {
$candidates = $this->findBy([ $candidates = $this->findBy([
'clientEmail' => $clientEmail, 'clientEmail' => $clientEmail,
'status' => null,
'startingPaymentAnalysisStatus' => null, 'startingPaymentAnalysisStatus' => null,
]); ]);
foreach ($candidates as $p) { foreach ($candidates as $p) {
if (!in_array($p->getStatus(),[null,GetHumanStatus::STATUS_NEW])) {
$p->setStartingPaymentAnalysisStatus('NOT CONCERNED');
continue;
}
/* @var Payment $p */ /* @var Payment $p */
$url = $p->getPayzenStartingPaymentUrl(); $url = $p->getPayzenStartingPaymentUrl();
if (!$url) { if (!$url) {
...@@ -69,6 +73,8 @@ class PaymentRepository extends ServiceEntityRepository ...@@ -69,6 +73,8 @@ class PaymentRepository extends ServiceEntityRepository
if ($timeout < new \DateTime()) { if ($timeout < new \DateTime()) {
$p->setStartingPaymentAnalysisStatus('TIMEOUT'); $p->setStartingPaymentAnalysisStatus('TIMEOUT');
} else { } else {
var_dump("OK RETURNING URL !");
die;
return $url; return $url;
} }
} }
......
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