Commit 9186ba4b by Yvon Kerdoncuff

take into account payment lines with status new or null

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