Commit 81227837 by Damien Moulard

Choix d'utiliser ou non payzen dans la config

parent 7d6d9e20
...@@ -631,6 +631,10 @@ App\Entity\GlobalParameter: ...@@ -631,6 +631,10 @@ App\Entity\GlobalParameter:
name: "MAP_ZOOM" name: "MAP_ZOOM"
value: '9' value: '9'
mandatory: 1 mandatory: 1
gp14:
name: "USE_PAYZEN"
value: 'true'
mandatory: 1
App\Entity\Siege: App\Entity\Siege:
siege_1: siege_1:
......
...@@ -27,6 +27,7 @@ class GlobalParameter ...@@ -27,6 +27,7 @@ class GlobalParameter
const RECONVERSION_PRESTATAIRE = 'RECONVERSION_PRESTATAIRE'; const RECONVERSION_PRESTATAIRE = 'RECONVERSION_PRESTATAIRE';
const MAP_CENTER = 'MAP_CENTER'; const MAP_CENTER = 'MAP_CENTER';
const MAP_ZOOM = 'MAP_ZOOM'; const MAP_ZOOM = 'MAP_ZOOM';
const USE_PAYZEN = 'USE_PAYZEN';
/** /**
* @ORM\Id() * @ORM\Id()
......
...@@ -54,6 +54,8 @@ class CotiserFormType extends AbstractType ...@@ -54,6 +54,8 @@ class CotiserFormType extends AbstractType
$canPayWithMlc = ($this->session->get('_prestagere')->getEcompte() >= $montant); $canPayWithMlc = ($this->session->get('_prestagere')->getEcompte() >= $montant);
} }
$canPayWithCB = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::USE_PAYZEN) === 'true' ? true : false;
$builder $builder
->add('operateur', HiddenType::class, array( ->add('operateur', HiddenType::class, array(
'entity_class' => User::class, 'entity_class' => User::class,
...@@ -94,7 +96,9 @@ class CotiserFormType extends AbstractType ...@@ -94,7 +96,9 @@ class CotiserFormType extends AbstractType
if ($canPayWithMlc) { if ($canPayWithMlc) {
$builder->add('payMLC', SubmitType::class, ['label' => "Payer en eMLC"]); $builder->add('payMLC', SubmitType::class, ['label' => "Payer en eMLC"]);
} }
if ($canPayWithCB) {
$builder->add('payCB', SubmitType::class, ['label' => "Payer en CB"]); $builder->add('payCB', SubmitType::class, ['label' => "Payer en CB"]);
}
if ($this->security->getUser()->isGranted('ROLE_ADHERENT')) { if ($this->security->getUser()->isGranted('ROLE_ADHERENT')) {
$builder $builder
......
...@@ -118,6 +118,16 @@ class GlobalConfigurationFormType extends AbstractType ...@@ -118,6 +118,16 @@ class GlobalConfigurationFormType extends AbstractType
], ],
'help' => '' 'help' => ''
)) ))
->add('usepayzen', GlobalParameterType::class, array(
'label' => "Utiliser le paiement par CB avec Payzen :",
'name_param' => GlobalParameter::USE_PAYZEN,
'required' => true,
'_placeholder' => 'false',
'constraints_param' => [
new RegexConstraint(['pattern' => '/^true$|^false$/', 'message' => 'La valeur doit être "true" ou "false"'])
],
'help' => 'Si cette option est activée (true), les utilisateurs pourront cotiser et acheter de la monnaie locale par CB sur l\'application.'
))
; ;
} }
......
...@@ -11,6 +11,7 @@ use App\Entity\Prestataire; ...@@ -11,6 +11,7 @@ use App\Entity\Prestataire;
use App\Entity\Rubrique; use App\Entity\Rubrique;
use App\Entity\Siege; use App\Entity\Siege;
use App\Entity\User; use App\Entity\User;
use App\Entity\GlobalParameter;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Knp\Component\Pager\PaginatorInterface; use Knp\Component\Pager\PaginatorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -61,10 +62,16 @@ class AppExtension extends AbstractExtension ...@@ -61,10 +62,16 @@ class AppExtension extends AbstractExtension
new \Twig_SimpleFunction('getWordpressApiKey', array($this, 'getWordpressApiKey')), new \Twig_SimpleFunction('getWordpressApiKey', array($this, 'getWordpressApiKey')),
new \Twig_SimpleFunction('parameter', function ($name) { new \Twig_SimpleFunction('parameter', function ($name) {
return $this->container->getParameter($name); return $this->container->getParameter($name);
}) }),
new \Twig_SimpleFunction('isPayzenEnabled', array($this, 'isPayzenEnabled'))
]; ];
} }
public function isPayzenEnabled()
{
return $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::USE_PAYZEN) === 'true' ? true : false;
}
public function getFilters() public function getFilters()
{ {
return array( return array(
......
...@@ -155,7 +155,9 @@ ...@@ -155,7 +155,9 @@
{% include 'block/cotisations.html.twig' %} {% include 'block/cotisations.html.twig' %}
{% include 'groupepresta/block/inscription.html.twig' %} {% include 'groupepresta/block/inscription.html.twig' %}
{% endif %} {% endif %}
{% if isPayzenEnabled() %}
{% include 'presta/block/achat_monnaie.html.twig' %} {% include 'presta/block/achat_monnaie.html.twig' %}
{% endif %}
{% include 'presta/block/transaction_presta.html.twig' %} {% include 'presta/block/transaction_presta.html.twig' %}
{% include 'presta/block/transaction_adherent.html.twig' %} {% include 'presta/block/transaction_adherent.html.twig' %}
{% if getCurrentPrestataire().mlc == false and getCurrentPrestataire().ecompte > 0 %} {% if getCurrentPrestataire().mlc == false and getCurrentPrestataire().ecompte > 0 %}
...@@ -170,7 +172,9 @@ ...@@ -170,7 +172,9 @@
{% include 'block/userpassword.html.twig' %} {% include 'block/userpassword.html.twig' %}
{% include 'block/cotisations.html.twig' %} {% include 'block/cotisations.html.twig' %}
{% include 'block/transactions.html.twig' %} {% include 'block/transactions.html.twig' %}
{% if isPayzenEnabled() %}
{% include 'adherent/block/achat_monnaie.html.twig' %} {% include 'adherent/block/achat_monnaie.html.twig' %}
{% endif %}
{% include 'adherent/block/transaction_presta.html.twig' %} {% include 'adherent/block/transaction_presta.html.twig' %}
{% include 'adherent/block/transaction_adherent.html.twig' %} {% include 'adherent/block/transaction_adherent.html.twig' %}
......
...@@ -26,8 +26,15 @@ ...@@ -26,8 +26,15 @@
{% else %} {% else %}
<div class='col-12'> <div class='col-12'>
{% endif %} {% endif %}
{% if form.payCB is defined %}
<div class='col-6'>
{{ form_widget(form.payCB) }} {{ form_widget(form.payCB) }}
</div> </div>
<div class='col-6'>
{% else %}
<div class='col-12'>
{% endif %}
</div>
</div> </div>
{{ form_end(form) }} {{ form_end(form) }}
</div> </div>
......
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