Commit fd0f6d90 by Yvon Kerdoncuff

cleaning

parent 3e5789d7
......@@ -145,16 +145,10 @@ class PaymentController extends AbstractController
$captureToken->setTargetUrl($targetUrl);
$captureToken->setAfterUrl($afterUrl);
$targetUrl = $captureToken->getTargetUrl();
/* @var Payment $payment */
if (!$payment->getPayzenStartingPaymentUrl()) {
$payment->setPayzenStartingPaymentUrl($targetUrl);
}
$this->em->persist($captureToken);
$this->em->flush();
return $this->redirect($targetUrl);
return $this->redirect($captureToken->getTargetUrl());
}
/* COMMENT LES FLUX SONT-ILS CREES SUITE A LA CREATION D'UN PAIEMENT PAYZEN ?
......
......@@ -82,14 +82,6 @@ class Payment extends BasePayment
/**
* @var string|null
* Payzen payment page requested when payment starts
*
* @ORM\Column(type="text", nullable=true)
*/
protected $payzenStartingPaymentUrl;
/**
* @var string|null
*
* @ORM\Column(type="string", length=50, nullable=true)
*/
......@@ -210,18 +202,6 @@ class Payment extends BasePayment
return $this;
}
public function getPayzenStartingPaymentUrl(): ?string
{
return $this->payzenStartingPaymentUrl;
}
public function setPayzenStartingPaymentUrl(?string $payzenStartingPaymentUrl): self
{
$this->payzenStartingPaymentUrl = $payzenStartingPaymentUrl;
return $this;
}
/**
* @return string
*/
......
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240930144459 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE payment ADD payzen_starting_payment_url LONGTEXT DEFAULT NULL, ADD starting_payment_analysis_status VARCHAR(50) DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE payment DROP payzen_starting_payment_url, DROP starting_payment_analysis_status');
}
}
......@@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241007081547 extends AbstractMigration
final class Version20241119090231 extends AbstractMigration
{
public function getDescription() : string
{
......@@ -20,12 +20,14 @@ final class Version20241007081547 extends AbstractMigration
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE payment ADD created_at DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE payment ADD starting_payment_analysis_status VARCHAR(50) DEFAULT NULL, ADD created_at DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE payment DROP created_at');
$this->addSql('ALTER TABLE payment DROP starting_payment_analysis_status, DROP created_at');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8mb3 DEFAULT NULL COLLATE `utf8mb3_general_ci` COMMENT \'(DC2Type:personal_data)\'');
}
}
......@@ -51,8 +51,7 @@ class PaymentRepository extends ServiceEntityRepository
*/
public function findValidStartingPayment($clientEmail)
{
//At first, this method was created to return the url of an existing starting payment.
//As we don't know how to use this url to redirect the user to the existing payment page,
//Remark : we don't know how to redirect the user to the existing payment page,
//we simply return the datetime when the payment will be expired.
$candidates = $this->findBy([
'clientEmail' => $clientEmail,
......@@ -64,12 +63,6 @@ class PaymentRepository extends ServiceEntityRepository
$p->setStartingPaymentAnalysisStatus('NOT CONCERNED');
continue;
}
/* @var Payment $p */
$url = $p->getPayzenStartingPaymentUrl();
if (!$url) {
$p->setStartingPaymentAnalysisStatus('NO URL');
continue;
}
$createdAt = clone $p->getCreatedAt(); //don't modify original object
$timeout = $createdAt->add(\DateInterval::createFromDateString("10 minutes"));
if ($timeout < new \DateTime()) {
......
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