Commit e0cdca17 by Yvon Kerdoncuff

cosmetic

parent 856eb656
......@@ -32,13 +32,14 @@ class PaymentController extends AbstractController
protected $guardHandler;
protected $paymentUtils;
public function __construct(EntityManagerInterface $em,
TranslatorInterface $translator,
LoginAuthenticator $authenticator,
GuardAuthenticatorHandler $guardHandler,
Payum $payum,
PaymentUtils $paymentUtils)
{
public function __construct(
EntityManagerInterface $em,
TranslatorInterface $translator,
LoginAuthenticator $authenticator,
GuardAuthenticatorHandler $guardHandler,
Payum $payum,
PaymentUtils $paymentUtils
) {
$this->em = $em;
$this->translator = $translator;
$this->payum = $payum;
......@@ -55,7 +56,8 @@ class PaymentController extends AbstractController
// Enregistre les données du Flux en json, pour l'enregistrer une fois le paiement validé
$serializer = $this->container->get('serializer');
$toSerialize = Payment::TYPE_ADHESION == $type ? $form->get('cotisation')->getData() : $form->getData();
$data = $serializer->normalize($toSerialize,
$data = $serializer->normalize(
$toSerialize,
null,
[AbstractNormalizer::ATTRIBUTES => [
'reference',
......@@ -75,7 +77,8 @@ class PaymentController extends AbstractController
'expediteur' => ['id'],
'destinataire' => ['id'],
'operateur' => ['id'], ],
]);
]
);
$jsondata = $serializer->serialize($data, 'json');
......@@ -84,9 +87,9 @@ class PaymentController extends AbstractController
$gatewayName = 'payzen';
} else {
$this->addFlash(
'error',
$this->translator->trans('Une erreur est survenue due à la configuration du paiement dans l\'application. Il est pour l\'instant impossible de payer par CB, merci de contacter votre monnaie locale.')
);
'error',
$this->translator->trans('Une erreur est survenue due à la configuration du paiement dans l\'application. Il est pour l\'instant impossible de payer par CB, merci de contacter votre monnaie locale.')
);
return $this->redirectToRoute('index');
}
......@@ -129,9 +132,9 @@ class PaymentController extends AbstractController
$storage->update($payment);
$captureToken = $this->payum->getTokenFactory()->createCaptureToken(
$gatewayName,
$payment,
'payment_done' // the route to redirect after capture
$gatewayName,
$payment,
'payment_done' // the route to redirect after capture
);
// Symfony creates URLs with http and not https -> replace
......@@ -297,41 +300,43 @@ class PaymentController extends AbstractController
if (Payment::TYPE_ACHAT_MONNAIE_ADHERENT == $type || Payment::TYPE_ACHAT_MONNAIE_PRESTA == $type) {
$this->addFlash(
'success',
$this->translator->trans('Achat de monnaie locale bien effectué !')
);
'success',
$this->translator->trans('Achat de monnaie locale bien effectué !')
);
} elseif (Payment::TYPE_COTISATION_ADHERENT == $type || Payment::TYPE_COTISATION_PRESTA == $type) {
$this->addFlash(
'success',
$this->translator->trans('Cotisation bien reçue. Merci !')
);
'success',
$this->translator->trans('Cotisation bien reçue. Merci !')
);
} elseif (Payment::TYPE_ADHESION == $type) {
$this->addFlash(
'success',
$this->translator->trans('Votre adhésion a bien été prise en compte, bienvenue !')
);
'success',
$this->translator->trans('Votre adhésion a bien été prise en compte, bienvenue !')
);
// Connect new user
return $this->guardHandler
->authenticateUserAndHandleSuccess(
$this->em->getRepository(User::class)->findOneBy(['id' => $payment->getClientId()]),
$request,
$this->authenticator,
'main'
);
->authenticateUserAndHandleSuccess(
$this->em->getRepository(User::class)->findOneBy(['id' => $payment->getClientId()]),
$request,
$this->authenticator,
'main'
);
} elseif (Payment::TYPE_PAIEMENT_COTISATION_TAV == $type || Payment::TYPE_PAIEMENT_RECURRENT_COTISATION_TAV) {
$this->addFlash(
'success',
$this->translator->trans('Cotisation payée !')
);
'success',
$this->translator->trans('Cotisation payée !')
);
}
} elseif (GetHumanStatus::STATUS_CANCELED == $payment->getStatus() ||
} elseif (
GetHumanStatus::STATUS_CANCELED == $payment->getStatus() ||
GetHumanStatus::STATUS_EXPIRED == $payment->getStatus() ||
GetHumanStatus::STATUS_FAILED == $payment->getStatus()) {
GetHumanStatus::STATUS_FAILED == $payment->getStatus()
) {
$this->addFlash(
'error',
$this->translator->trans('La transaction a été annulée.')
);
'error',
$this->translator->trans('La transaction a été annulée.')
);
}
return $this->redirectToRoute('index');
......
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