add missing info on redirect to payment page (#729)
This commit is contained in:
parent
7fd21b6dda
commit
ac791cfae6
4 changed files with 33 additions and 4 deletions
|
|
@ -7,6 +7,7 @@ namespace App\Controller\Payment\PlatformMembership;
|
||||||
use App\Entity\PlatformOffer;
|
use App\Entity\PlatformOffer;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Payment\PayumManager;
|
use App\Payment\PayumManager;
|
||||||
|
use App\Repository\ConfigurationRepository;
|
||||||
use App\Repository\PlatformOfferRepository;
|
use App\Repository\PlatformOfferRepository;
|
||||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
|
@ -57,10 +58,12 @@ final class PrepareAction extends AbstractController
|
||||||
'en' => '/en/subcription',
|
'en' => '/en/subcription',
|
||||||
'fr' => '/fr/abonnement',
|
'fr' => '/fr/abonnement',
|
||||||
], name: 'redirect_to_payment')]
|
], name: 'redirect_to_payment')]
|
||||||
public function redirectToPayment(PlatformOfferRepository $platformOfferRepository): Response
|
public function redirectToPayment(PlatformOfferRepository $platformOfferRepository, ConfigurationRepository $configurationRepository): Response
|
||||||
{
|
{
|
||||||
$offers = $platformOfferRepository->findBy(['active' => true]);
|
$offers = $platformOfferRepository->findBy(['active' => true]);
|
||||||
|
$lowOffer = $platformOfferRepository->findLowOffer();
|
||||||
|
$platformName = $configurationRepository->getInstanceConfigurationOrCreate()->getPlatformName();
|
||||||
|
|
||||||
return $this->render('pages/redirect_to_payment.html.twig', compact('offers'));
|
return $this->render('pages/redirect_to_payment.html.twig', compact('offers', 'lowOffer', 'platformName'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ namespace App\Repository;
|
||||||
|
|
||||||
use App\Entity\PlatformOffer;
|
use App\Entity\PlatformOffer;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\ORM\NonUniqueResultException;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,4 +38,19 @@ class PlatformOfferRepository extends ServiceEntityRepository
|
||||||
{
|
{
|
||||||
return $this->findOneBy(['id' => $id, 'active' => true]);
|
return $this->findOneBy(['id' => $id, 'active' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws NonUniqueResultException
|
||||||
|
*/
|
||||||
|
public function findLowOffer(): ?PlatformOffer
|
||||||
|
{
|
||||||
|
/** @var ?PlatformOffer */
|
||||||
|
return $this
|
||||||
|
->createQueryBuilder('o')
|
||||||
|
->andWhere('o.active = true')
|
||||||
|
->orderBy('o.price', 'ASC')
|
||||||
|
->getQuery()
|
||||||
|
->setMaxResults(1)
|
||||||
|
->getOneOrNullResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,21 @@
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="">
|
<div class="">
|
||||||
{% include 'components/layout/_title_3.html.twig' with {
|
{% include 'components/layout/_title_3.html.twig' with {
|
||||||
name: (i18n_prefix ~ '.title')|trans
|
name: (i18n_prefix ~ '.title')|trans({'%name%': platformName})
|
||||||
} %}
|
} %}
|
||||||
{% include 'components/layout/_text.html.twig' with {
|
{% include 'components/layout/_text.html.twig' with {
|
||||||
text: (i18n_prefix ~ '.text')|trans
|
text: (i18n_prefix ~ '.text')|trans
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
|
<div class="col-md-6 col-lg-4 col-xl-4 mx-lg-auto">
|
||||||
|
<p class="text-gray fw-bolder fs-6 text-lg-center">
|
||||||
|
{{ (i18n_prefix ~ '.membership')|trans }}
|
||||||
|
<span class="text-gray fs-6 fw-normal">
|
||||||
|
{{ (i18n_prefix ~ '.membership.start')|trans }}
|
||||||
|
{{ lowOffer.actualPrice|format_currency(lowOffer.currency) }}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<div class="d-grid col col-lg-4 mx-auto">
|
<div class="d-grid col col-lg-4 mx-auto">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
<trans-unit id="QsIj9kp" resname="templates.pages.redirect_to_payment.title">
|
<trans-unit id="QsIj9kp" resname="templates.pages.redirect_to_payment.title">
|
||||||
<source>templates.pages.redirect_payment.title</source>
|
<source>templates.pages.redirect_payment.title</source>
|
||||||
<target>Bienvenue</target>
|
<target>Bienvenue sur %name%</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
|
||||||
<trans-unit id="wSc8oud" resname="templates.pages.redirect_to_payment.text">
|
<trans-unit id="wSc8oud" resname="templates.pages.redirect_to_payment.text">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue