lexik / lexikpayboxbundle Goto Github PK
View Code? Open in Web Editor NEWLexikPayboxBundle eases the implementation of the Paybox payment system
License: MIT License
LexikPayboxBundle eases the implementation of the Paybox payment system
License: MIT License
Hi and thank you for this bundle.
Payments work fine but I have some trouble with cancellations.
Don't we need to send the 'identifiant' value ? As the doc says this parameter is required to get a command cancellation and actually we send the login value instead. Without it Paybox does not seem to authorize this operation.
// LexikPayboxBundle/Paybox/System/Cancellation/Request.php #63
protected function initParameters()
{
$this->setParameter('VERSION', '001');
$this->setParameter('TYPE', '001');
$this->setParameter('SITE', $this->globals['site']);
$this->setParameter('MACH', sprintf('%03d', $this->globals['rank']));
$this->setParameter('IDENTIFIANT', $this->globals['login']);
}
Did I miss something ? Else, I would make a pull request if necessary.
Thank you
so in insight, it doesn't return a critical error
Hi thank for this bundle how i hope will help me.
so here is my question, i want to send strait my request to the paybox server from my controller, i dont want to pass by render (in controller) and form.
$paybox = $this->get('lexik_paybox.request_handler');
$paybox->setParameters(array(
'PBX_CMD' => 'CMD'.time(),
'PBX_DEVISE' => '978',
'PBX_PORTEUR' => '[email protected]',
'PBX_RETOUR' => 'Mt:M;Ref:R;Auto:A;Erreur:E',
'PBX_TOTAL' => '1000',
'PBX_TYPEPAIEMENT' => 'CARTE',
'PBX_TYPECARTE' => 'CB',
'PBX_EFFECTUE' => $this->generateUrl('PayBox_return', array('status' => 'success'), true),
'PBX_REFUSE' => $this->generateUrl('PayBox_return', array('status' => 'denied'), true),
'PBX_ANNULE' => $this->generateUrl('PayBox_return', array('status' => 'canceled'), true),
'PBX_RUF1' => 'POST',
'PBX_REPONDRE_A' => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), true),
));
after this send all to paybox.
how i can do this?
We've detected an error in your SampleController.php
'PBX_EFFECTUE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'success'), true),
Or in symfony3 generate url use a constant and not "true or false"
'PBX_EFFECTUE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'success'), UrlGeneratorInterface::ABSOLUTE_URL),
Thanks by advance
Can you put a stable version ?
I want to use this bundle but I have to set symfony package to dev for work, and I'm not sure if it is secure in production... ;)
Regards
It seems you integrated Paybox Direct plus on #41 but we can't find any documentation about how to use it.
Could you please add some?
I used fake paybox's card in dev env, and I have a invalid signature :
[2013-01-16 17:05:32] request.INFO: Matched route "lexik_paybox_ipn" (parameters: "_controller": "Lexik\Bundle\PayboxBundle\Controller\DefaultController::ipnAction", "time": "1358352320", "_route": "lexik_paybox_ipn") [] []
[2013-01-16 17:05:32] security.INFO: Populated SecurityContext with an anonymous Token [] []
[2013-01-16 17:05:32] payment.INFO: New IPN call. [] []
[2013-01-16 17:05:32] payment.INFO: amount=8252 [] []
[2013-01-16 17:05:32] payment.INFO: cmd=FR201301000001-1358352320 [] []
[2013-01-16 17:05:32] payment.INFO: auto=XXXXXX [] []
[2013-01-16 17:05:32] payment.INFO: trans=4353761 [] []
[2013-01-16 17:05:32] payment.INFO: type=CARTE [] []
[2013-01-16 17:05:32] payment.INFO: card=CB,VISA,EUROCARD_MASTERCARD [] []
[2013-01-16 17:05:32] payment.INFO: error=00000 [] []
[2013-01-16 17:05:32] payment.INFO: country=FRA [] []
[2013-01-16 17:05:32] payment.INFO: Sign=JDg9jvoFcM+i3JDOA6qy9Q6Gx6kFsyc+tymWVSTc7fYkNcwlKqF7SUdvBz6awxsD2tYuqkPtZjtdvTtYJm5mlnJdbrzPn3ixdjD7weTOxkJOcbUqqpmig3LDz2bpKajLFvE9Ut/+MRoemmSawpC3m2sQ2uFGkMtmFGCYfYQzzag= [] []
[2013-01-16 17:05:32] payment.INFO: amount=8252&cmd=FR201301000001-1358352320&auto=XXXXXX&trans=4353761&type=CARTE&card=CB%2CVISA%2CEUROCARD_MASTERCARD&error=00000&country=FRA [] []
[2013-01-16 17:05:32] payment.INFO: JDg9jvoFcM+i3JDOA6qy9Q6Gx6kFsyc+tymWVSTc7fYkNcwlKqF7SUdvBz6awxsD2tYuqkPtZjtdvTtYJm5mlnJdbrzPn3ixdjD7weTOxkJOcbUqqpmig3LDz2bpKajLFvE9Ut/+MRoemmSawpC3m2sQ2uFGkMtmFGCYfYQzzag= [] []
[2013-01-16 17:05:32] payment.ERROR: Signature is invalid. [] []
Here, my paybox form action :
/**
* @Route("/paybox")
* @Template()
*/
public function payboxAction()
{
$ref = $this->getRequest()->get('ref');
/* @var $invoice Invoice */
$invoice = $this->getDoctrine()->getRepository('SLLHMainBundle:Invoice')->findOneBy(array('ref' => $ref));
/* @var $paybox PayboxRequest */
$paybox = $this->get('lexik_paybox.request_handler');
$paybox->setParameters(array(
'PBX_CMD' => $invoice->getRef().'-'.time(),
'PBX_DEVISE' => '978',
'PBX_PORTEUR' => '[email protected]',
'PBX_RETOUR' => 'amount:M;cmd:R;auto:A;trans:T;type:P;card:C;countrycard:Y;error:E;country:I',
'PBX_TOTAL' => $invoice->getBalance() * 100,
'PBX_TYPEPAIEMENT' => 'CARTE',
'PBX_TYPECARTE' => 'CB,VISA,EUROCARD_MASTERCARD',
'PBX_EFFECTUE' => $this->generateUrl('sllh_front_payment_paybox_return', array('status' => 'success'), true),
'PBX_REFUSE' => $this->generateUrl('sllh_front_payment_paybox_return', array('status' => 'denied'), true),
'PBX_ANNULE' => $this->generateUrl('sllh_front_payment_paybox_return', array('status' => 'canceled'), true),
'PBX_RUF1' => 'POST',
'PBX_REPONDRE_A' => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), true),
));
$env = $this->container->getParameter('kernel.environment');
return array(
'invoice' => $invoice,
'url' => $paybox->getUrl(),
'form' => $paybox->getForm()->createView(),
);
}
Did you already have thir error ? How did you fix it ?
Thanks for help.
Hi !
In ParameterResolver.php, there is an array of PBX_TYPECARTE allowed, with only some type... but not PayPal (and, in Paybox documentation (http://www1.paybox.com/wp-content/uploads/2016/08/ManuelIntegrationPayboxSystem_V7.1_FR.pdf), we have to set PBX_TYPEPAIEMENT and PBX_TYPECARTE to PAYPAL).
How to use this bundle to pay with PayPal ? In previous version, like in v1.0.3, there is not this array of allowed types (which was added by @Olineuve in commit ea2040f), so I could pay with PayPal, but with recent versions (that I have to use, cause of my symfony version), I can't... why ?
Thanks !
Hi,
I think there is a problem in the DirectPlus ParameterResolver format definition for the 'DATEQ' parameter.
It is '%014d' and IMHO it should be '%014s'. Because 14 digits number is too long to be an integer.
Do you confirm ?
Thanks for this great bundle!
Hi, we received an email form Paybox about IP changes between march and june.
Anything to worry about with the bundle ?
Hi,
First, thanks for this bundle !
I have a problem with the bundle because my server should use an HTTP Proxy to go out and access the paybox server.
Here is the error : "Warning: DOMDocument::loadHTML(): Empty string supplied as input" in vendor/lexik/paybox-bundle/Paybox/AbstractRequest.php at line 152
To access to the paybox server, a new curl option CURLOPT_PROXY should be added in the getWebPage function of AbstractRequest.php, like this :
protected function getWebPage($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_PROXY,'xxx.xxxx.xxx.xx:port' true); <- this line
$output = curl_exec($curl);
curl_close($curl);
return (string) $output;
}
Is it possible to add new parameters in configuration of this bundle to define the IP address of the HTTP proxy and its port and, if they are defined , add the necessary line in getWebPage function?
Thanks
How to properly desactivate properly this listener ?
It is defined here : https://github.com/lexik/LexikPayboxBundle/blob/master/Resources/config/services.yml so it's automatically loaded...
It is possible to separate it, with a services-samples.yml not loaded for example ?
Thanks for help.
Hello,
I'm trying to implement PayBox payment but I get the error :
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "lexik_paybox_sample_return" as such route does not exist."
In my twig I call the controller with :
{{ render(controller('LexikPayboxBundle:Sample:call')) }}
Any idea on what I could be missing or doing wrong please ?
To comply the 3D-Secure v2 , Paybox added 2 new variables to send :
<?xml version="1.0" encoding="utf-8"?>
<shoppingcart>
<total>
<totalQuantity>15</totalQuantity>
</total>
</shoppingcart>
<?xml version="1.0" encoding="utf-8"?>
<Billing>
<Address>
<FirstName>Jean</FirstName>
<LastName>Dupont</LastName>
<Address1>12 rue Paul Dautier</Address1>
<ZipCode>78140</ZipCode>
<City>Vélizy-Villacoublay</City>
<CountryCode>250</CountryCode>
</Address>
</Billing>
Is it possible to add these two new variables ?
Thanks
Hi,
Is there any way to use your bundle with multiple account ?
Currently it looks like there is only one account allowed (in config.yml) and I'm looking for a bundle that allow to set dynamically the account that will be used...
Thanks
PHP Fatal error: Call to undefined method Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition::prototype() in vendor/lexik/paybox-bundle/Lexik/Bundle/PayboxBundle/DependencyInjection/Configuration.php on line 75
hi,
got this form and all input are visible, not hidden
{% import 'LexikPayboxBundle:Macro:paybox.html.twig' as paybox %}
<form action="{{ url }}" method="post">
{{ paybox.form(form) }}
<input type="submit" />
wtf ? :)
in the view, here an exemple of the form
<input type="_form_PBX_DEVISE" value="978" name="PBX_DEVISE">
i'd like to share documentation about request call direct/direct plus and maybe some functional code example.
Good idea ?
Hi,
Could you help me ?
Is compose.json file up to date ?
thx !
-------------------------- here my error ---------------
php composer.phar up
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: remove symfony/symfony v2.6.11
- Conclusion: don't install symfony/symfony v2.6.11
- Conclusion: don't install symfony/symfony v2.6.10
- Conclusion: don't install symfony/symfony v2.6.9
- Conclusion: don't install symfony/symfony v2.6.8
- Conclusion: don't install symfony/symfony v2.6.7
- Conclusion: don't install symfony/symfony v2.6.6
- Conclusion: don't install symfony/symfony v2.6.5
- Conclusion: don't install symfony/symfony v2.6.4
- Conclusion: don't install symfony/symfony v2.6.3
- Conclusion: don't install symfony/symfony v2.6.2
- Conclusion: don't install symfony/symfony v2.6.1
- lexik/paybox-bundle dev-master requires symfony/options-resolver ~2.7 -> satisfiable by symfony/options-resolver[v2.7.0, v2.7.1, v2.7.2, v2.7.3].
- lexik/paybox-bundle dev-master requires symfony/options-resolver ~2.7 -> satisfiable by symfony/options-resolver[v2.7.0, v2.7.1, v2.7.2, v2.7.3].
- don't install symfony/options-resolver v2.7.0|don't install symfony/symfony v2.6.0
- don't install symfony/options-resolver v2.7.1|don't install symfony/symfony v2.6.0
- don't install symfony/options-resolver v2.7.2|don't install symfony/symfony v2.6.0
- don't install symfony/options-resolver v2.7.3|don't install symfony/symfony v2.6.0
- Installation request for symfony/symfony 2.6.* -> satisfiable by symfony/symfony[v2.6.0, v2.6.1, v2.6.10, v2.6.11, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9].
- Installation request for lexik/paybox-bundle dev-master -> satisfiable by lexik/paybox-bundle[dev-master].
Hi,
I found a small issue when I tried to generate several forms for one page (one form per payment type), the field PBX_HMAC is not regenerated for each form.
It seems that once the service has been called and a form generated, this parameter is set for the execution lifetime, due to this if condition in Lexik\Bundle\PayboxBundle\Paybox\System\Base\Request (line 129-133) :
/**
* Returns all parameters set for a payment.
*
* @return array
*/
public function getParameters()
{
// This condition prevent the generation of a new PBX_HMAC
if (null === $this->getParameter('PBX_HMAC')) {
$this->setParameter('PBX_TIME', date('c'));
$this->setParameter('PBX_HMAC', strtoupper($this->computeHmac()));
}
$resolver = new ParameterResolver($this->globals['currencies']);
return $resolver->resolve($this->parameters);
}
To overcome this, I extended this class in my app by adding this parameter
parameters:
lexik_paybox.request_handler.class: 'Path\To\Custom\Request'
And commented the condition like this :
/**
* Returns all parameters set for a payment.
*
* @return array
*/
public function getParameters()
{
//if (null === $this->getParameter('PBX_HMAC')) {
$this->setParameter('PBX_TIME', date('c'));
$this->setParameter('PBX_HMAC', strtoupper($this->computeHmac()));
//}
$resolver = new ParameterResolver($this->globals['currencies']);
return $resolver->resolve($this->parameters);
}
It works well :)
Btw, I also had to extend \Lexik\Bundle\PayboxBundle\Paybox\System\Base\ParameterResolver for another reason, the value "ANCV" was not allowed in the PBX_TYPECARTE options, since the ParameterResolver is manually instanciated in Request::getParameters().
Yondz
Hi i use - lexik_paybox - in same projet credit agricole, but this time i need to setup payment system for monetico (credit mutuel). i have look in the doc monetico : my question is lexik_paybox is compatible with monetico ?
thank
Hi,
In my config.yml:
lexik_paybox:
parameters:
rank: 01
The form show:
input type="hidden" value="1" name="PBX_RANG"
This is wrong because the value must be 2 characters, otherwise the message "error protection" appears.
Thank you to correct it.
PG
Hello,
I'm trying to perform an action in a custom IPN listener, but it does not seem to work.
vendor/lexik/paybox-bundle/Resources/config/routing.yml :
lexik_paybox_ipn:
path: /payment-ipn/{time}
defaults: { _controller: LexikPayboxBundle:Default:ipn }
methods: [GET, POST]
lexik_paybox_membership_return:
path: /payment/return/{status}
defaults: { _controller: AppBundle:Membership:return, status: error }
requirements:
status: success|canceled|denied
vendor/lexik/paybox-bundle/Resources/config/services.yml :
parameters:
lexik_paybox.request_handler.class: 'Lexik\Bundle\PayboxBundle\Paybox\System\Base\Request'
lexik_paybox.request_cancellation_handler.class: 'Lexik\Bundle\PayboxBundle\Paybox\System\Cancellation\Request'
lexik_paybox.response_handler.class: 'Lexik\Bundle\PayboxBundle\Paybox\System\Base\Response'
lexik_paybox.direc_plus.request_handler: 'Lexik\Bundle\PayboxBundle\Paybox\DirectPlus\Request'
lexik_paybox.membership_response_listener.class: 'AppBundle\Controller\MembershipIpnListener'
services:
lexik_paybox.request_handler:
class: '%lexik_paybox.request_handler.class%'
arguments: ['%lexik_paybox.parameters%', '%lexik_paybox.servers%', '@form.factory']
lexik_paybox.request_cancellation_handler:
class: '%lexik_paybox.request_cancellation_handler.class%'
arguments: ['%lexik_paybox.parameters%', '%lexik_paybox.servers%', '@lexik_paybox.transport']
lexik_paybox.response_handler:
class: '%lexik_paybox.response_handler.class%'
arguments: ['@request_stack', '@logger', '@event_dispatcher', '%lexik_paybox.parameters%']
tags:
- { name: monolog.logger, channel: payment }
lexik_paybox.direc_plus.request_handler:
class: '%lexik_paybox.direc_plus.request_handler%'
arguments: ['%lexik_paybox.parameters%', '%lexik_paybox.servers%', '@logger', '@event_dispatcher', '@lexik_paybox.transport']
tags:
- { name: monolog.logger, channel: payment }
lexik_paybox.transport:
class: '%lexik_paybox.transport.class%'
lexik_paybox.membership_response_listener:
class: '%lexik_paybox.membership_response_listener.class%'
arguments: ['%kernel.root_dir%', '@filesystem']
tags:
- { name: kernel.event_listener, event: paybox.ipn_response, method: onPayboxIpnResponse }
src/AppBundle/Controller/MembershipController.php :
<?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
/**
* Class MembershipController
*
* @package Lexik\Bundle\PayboxBundle\Controller
*
* @author Lexik <[email protected]>
* @author Olivier Maisonneuve <[email protected]>
*/
class MembershipController extends Controller
{
/**
* OneYear action creates the form for a one year membership payment call.
*
* @return Response
*/
public function OneYearAction()
{
$user = ParseUser::getCurrentUser();
$email = $user->get('email');
$paybox = $this->get('lexik_paybox.request_handler');
$paybox->setParameters(array(
'PBX_CMD' => 'CMD-' . $user->getObjectId() . '-190-' .time(),
'PBX_DEVISE' => '978',
'PBX_PORTEUR' => $email,
'PBX_RETOUR' => 'Mt:M;Ref:R;Auto:A;Erreur:E',
'PBX_TOTAL' => '1490',
'PBX_TYPEPAIEMENT' => 'CARTE',
'PBX_TYPECARTE' => 'CB',
'PBX_EFFECTUE' => $this->generateUrl('lexik_paybox_membership_return', array('status' => 'success'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_REFUSE' => $this->generateUrl('lexik_paybox_membership_return', array('status' => 'denied'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_ANNULE' => $this->generateUrl('lexik_paybox_membership_return', array('status' => 'canceled'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_RUF1' => 'POST',
'PBX_REPONDRE_A' => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), UrlGeneratorInterface::ABSOLUTE_URL),
));
return $this->render(
'my_bundle/user/membershippayboxform.html.twig',
array(
'url' => $paybox->getUrl(),
'form' => $paybox->getForm()->createView(),
)
);
}
/**
* OneMonth action creates the form for a one month membership payment call.
*
* @return Response
*/
public function OneMonthAction()
{
$user = ParseUser::getCurrentUser();
$email = $user->get('email');
$paybox = $this->get('lexik_paybox.request_handler');
$paybox->setParameters(array(
'PBX_CMD' => 'CMD-' . $user->getObjectId() . '-1490-' .time(),
'PBX_DEVISE' => '978',
'PBX_PORTEUR' => $email,
'PBX_RETOUR' => 'Mt:M;Ref:R;Auto:A;Erreur:E',
'PBX_TOTAL' => '190',
'PBX_TYPEPAIEMENT' => 'CARTE',
'PBX_TYPECARTE' => 'CB',
'PBX_EFFECTUE' => $this->generateUrl('lexik_paybox_membership_return', array('status' => 'success'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_REFUSE' => $this->generateUrl('lexik_paybox_membership_return', array('status' => 'denied'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_ANNULE' => $this->generateUrl('lexik_paybox_membership_return', array('status' => 'canceled'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_RUF1' => 'POST',
'PBX_REPONDRE_A' => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), UrlGeneratorInterface::ABSOLUTE_URL),
));
return $this->render(
'my_bundle/user/membershippayboxform.html.twig',
array(
'url' => $paybox->getUrl(),
'form' => $paybox->getForm()->createView(),
)
);
}
/**
* Return action for a confirmation payment page on which the user is sent
* after he seizes his payment informations on the Paybox's platform.
* This action might only containts presentation logic.
*
* @param Request $request
* @param string $status
*
* @return Response
*/
public function returnAction(Request $request, $status)
{
$request = Request::createFromGlobals();
$montantAbonnement = $request->query->get('Mt');
return $this->render('my_bundle/user/membershippayboxreturn.html.twig', array(
'status' => $status,
'parameters' => $request->query,
'montantAbonnement' => $montantAbonnement
));
}
}
src/AppBundle/Controller/MembershipIpnListener.php :
<?php
namespace AppBundle\Controller;
use Lexik\Bundle\PayboxBundle\Event\PayboxResponseEvent;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
/**
* Sample listener that create a file for each ipn call.
*
* @author Olivier Maisonneuve <[email protected]>
*/
class MembershipIpnListener
{
/**
* @var string
*/
private $rootDir;
/**
* @var Filesystem
*/
private $filesystem;
/**
* Constructor.
*
* @param string $rootDir
* @param Filesystem $filesystem
*/
public function __construct($rootDir, Filesystem $filesystem)
{
$this->rootDir = $rootDir;
$this->filesystem = $filesystem;
}
/**
* Creates a txt file containing all parameters for each IPN.
*
* @param PayboxResponseEvent $event
*/
public function onPayboxIpnResponse(PayboxResponseEvent $event)
{
$path = sprintf('%s/../data/%s', $this->rootDir, date('Y\/m\/d\/'));
$this->filesystem->mkdir($path);
$content = sprintf('Signature verification : %s%s', $event->isVerified() ? 'OK' : 'KO', PHP_EOL);
foreach ($event->getData() as $key => $value) {
$content .= sprintf("%s:%s%s", $key, $value, PHP_EOL);
}
file_put_contents(
sprintf('%s%s.txt', $path, time()),
$content
);
$firstname = 'firstname';
$lastname = 'lastname';
$email = 'email';
$montantFacture = "14,90";
$message = \Swift_Message::newInstance()
->setSubject('Abonnement')
->setFrom('[email protected]')
->setTo($email)
->setBcc(['[email protected]', '[email protected]'])
->setBody(
$this->renderView(
'my_bundle/user/membershipmessage.html.twig',
array('firstname' => $firstname, 'lastname' => $lastname, 'email' => $email, 'montantFacture' => $montantFacture)
),
'text/html'
);
$this->get('mailer')
->send($message);
}
}
The redirection to membershippayboxreturn.html.twig works fine after payment, and I get the right info displayed but the Listener should create txt file just like the sample, and send a mail. I get none of those.
I did not write variables yet for the e-mail content for testing purposes.
If I write the mail sending function in returnAction function in src/AppBundle/Controller/MembershipController.php it works fine.
Any idea on what I could have missed here please ? Where could I be wrong ?
Best regards,
David
Greetings,
I successfully used your bundle to implement payment features for my website but I will face soon an issue where I have to configure two different Paybox accounts.
In my case, I will have to redirect the user to an account to pay books, and another account to pay courses. But it looks like your bundle only handle one account.
I was thinking about implementing this as they did in CsaGuzzleBundle to use multiple guzzle clients.
Something like this :
lexik_paybox:
accounts:
books:
parameters:
production: false # Switches between Paybox test and production servers (preprod-tpe <> tpe)
site: '9999998' # Site number provided by the bank
rank: '98' # Rank number provided by the bank
login: '999999998' # Customer's login provided by Paybox
hmac:
key: 'FEDCBA...43210' # Key used to compute the hmac hash, provided by Paybox
courses:
parameters:
production: false # Switches between Paybox test and production servers (preprod-tpe <> tpe)
site: '9999999' # Site number provided by the bank
rank: '99' # Rank number provided by the bank
login: '999999999' # Customer's login provided by Paybox
hmac:
key: '01234...BCDEF' # Key used to compute the hmac hash, provided by Paybox
Any chance you would have any tips to implement this ? I will gracefully offer a pull request when finished ;)
[EDIT] Related to #34
Regards,
Guillaume SARRAMEGNA
2.4 throw an exception on dev environment when using the response handler. The third argument is now a TraceableEventDispatcher
ContextErrorException: Catchable Fatal Error: Argument 3 passed to
Lexik\Bundle\PayboxBundle\Paybox\System\Base\Response::__construct() must be an instance of
Symfony\Component\EventDispatcher\EventDispatcher, instance of
Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher given, called in
We must use the EventDispatcherInterface instead of EventDispatcher as type in the constructor of the Response (https://github.com/fabienpomerol/LexikPayboxBundle/blob/master/Paybox/System/Base/Response.php#L52)
hi are i can have response IPN in local server in test mode ?
Hi there!
In Paybox documentation, you can use these parameters "PBX_2MONT", "PBX_DELAIS", "PBX_FREQ", "PBX_NBPAIE", "PBX_QUAND" for subscription.
Is that planned to implement them in your bundle or do I need to fork your bundle?
Regards,
Nicolas
Do you think it's interesting to have default paybox request parameters in the config ? (like PBX_DEVISE, PBX_TYPEPAIEMENT, ...), this way we pass only changing parameters to the setParameters()
function.
Bonjour,
j'ai vu que le service E-transaction du Crédit Agricole est basé sur PayBox. Je peux utiliser ce bundle ?
merci
Hello there,
I'm working on an application that allows administrators to enable/disable currencies in a backoffice, but the problem is that the allowed currencies for paybox are set in the config.
What is the point of enforcing the list of currencies in the config file ?
Also, i couldn't find out which currencies are supported by paybox, any idea ?
Thanks for the great work !
Hello,
I'm trying to connect with PayBox Test platform but I get :
Problème d'identification du commerce. Accès refusé !
app/config/config.yml :
...
# Lexik Paybox Bundle
lexik_paybox:
parameters:
production: false
site: '********'
rank: '**'
login: '********'
currencies:
- '978'
hmac:
algorithm: SHA512
key: '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF'
vendor/lexik/paybox-bundle/Controller/SampleController.php :
<?php
namespace Lexik\Bundle\PayboxBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
/**
* Class SampleController
*
* @package Lexik\Bundle\PayboxBundle\Controller
*
* @author Lexik <[email protected]>
* @author Olivier Maisonneuve <[email protected]>
*/
class SampleController extends Controller
{
/**
* Index action creates the form for a payment call.
*
* @return Response
*/
public function indexAction()
{
$paybox = $this->get('lexik_paybox.request_handler');
$paybox->setParameters(array(
'PBX_CMD' => 'CMDWEBCAMHD'.time(),
'PBX_DEVISE' => '978',
'PBX_PORTEUR' => '[email protected]',
'PBX_RETOUR' => 'Mt:M;Ref:R;Auto:A;Erreur:E',
'PBX_TOTAL' => '1000',
'PBX_TYPEPAIEMENT' => 'CARTE',
'PBX_TYPECARTE' => 'CB',
'PBX_EFFECTUE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'success'), UrlGeneratorInterface::ABSOLUTE_PATH),
'PBX_REFUSE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'denied'), UrlGeneratorInterface::ABSOLUTE_PATH),
'PBX_ANNULE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'canceled'), UrlGeneratorInterface::ABSOLUTE_PATH),
'PBX_RUF1' => 'POST',
'PBX_REPONDRE_A' => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), UrlGeneratorInterface::ABSOLUTE_PATH),
));
return $this->render(
'LexikPayboxBundle:Sample:index.html.twig',
array(
'url' => $paybox->getUrl(),
'form' => $paybox->getForm()->createView(),
)
);
}
/**
* Return action for a confirmation payment page on which the user is sent
* after he seizes his payment informations on the Paybox's platform.
* This action might only containts presentation logic.
*
* @param Request $request
* @param string $status
*
* @return Response
*/
public function returnAction(Request $request, $status)
{
return $this->render('LexikPayboxBundle:Sample:return.html.twig', array(
'status' => $status,
'parameters' => $request->query,
));
}
}
My form source code shows :
<form action="https://preprod-tpeweb.paybox.com/cgi/MYchoix_pagepaiement.cgi" method="post">
<input type="hidden" name="PBX_ANNULE" value="/payment/return/canceled" />
<input type="hidden" name="PBX_CMD" value="CMD1501862323" />
<input type="hidden" name="PBX_DEVISE" value="978" />
<input type="hidden" name="PBX_EFFECTUE" value="/payment/return/success" />
<input type="hidden" name="PBX_HASH" value="SHA512" />
<input type="hidden" name="PBX_IDENTIFIANT" value="1686319" />
<input type="hidden" name="PBX_PORTEUR" value="[email protected]" />
<input type="hidden" name="PBX_RANG" value="32" />
<input type="hidden" name="PBX_REFUSE" value="/payment/return/denied" />
<input type="hidden" name="PBX_REPONDRE_A" value="/payment-ipn/1501862323" />
<input type="hidden" name="PBX_RETOUR" value="Mt:M;Ref:R;Auto:A;Erreur:E;Sign:K" />
<input type="hidden" name="PBX_RUF1" value="POST" />
<input type="hidden" name="PBX_SITE" value="1999888" />
<input type="hidden" name="PBX_TIME" value="2017-08-04T17:58:43+02:00" />
<input type="hidden" name="PBX_TOTAL" value="1000" />
<input type="hidden" name="PBX_TYPECARTE" value="CB" />
<input type="hidden" name="PBX_TYPEPAIEMENT" value="CARTE" />
<input type="hidden" name="PBX_HMAC" value="6AA01789164B30458DD38535B9902CD94501CA9D9DD057C48CFD1BFC653DE10F17104568A772264C571DFC8E394FAC1F49CBF2B660ACE0C3F43B393F6AA243EE" />
<input type="submit" />
</form>
Any idea on what I could have wrong here please ?
Best regards,
David
Hi all,
I'm using sf2.4 and i've been trying to make this bundle work with the paybox test parameters.
So, if you want to test your environment, here are the parameters i've been using :
app/config/config_dev.yml
lexik_paybox:
parameters:
# Site number provided by the bank
site: '1999888'
# Rank number provided by the bank
rank: '32'
# Customer's login provided by Paybox
login: '2'
hmac:
# Key used to compute the hmac hash, provided by Paybox
key: '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF'
YourBundle/Controller/DefaultController.php or whatever
public function callAction()
{
$paybox = $this->get('lexik_paybox.request_handler');
$paybox->setParameters(array(
'PBX_CMD' => 'CMD'.time(),
'PBX_DEVISE' => '978',
'PBX_PORTEUR' => '[email protected]',
'PBX_RETOUR' => 'Mt:M;Ref:R;Auto:A;Erreur:E',
'PBX_TOTAL' => '1000',
'PBX_TYPEPAIEMENT' => 'CARTE',
'PBX_TYPECARTE' => 'CB',
'PBX_EFFECTUE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'success'), true),
'PBX_REFUSE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'denied'), true),
'PBX_ANNULE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'canceled'), true),
'PBX_RUF1' => 'POST',
'PBX_REPONDRE_A' => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), true),
));
return $this->render(
'LexikPayboxBundle:Sample:index.html.twig',
array(
'url' => $paybox->getUrl(),
'form' => $paybox->getForm()->createView(),
)
);
}
For some reason, the bundle documentation uses :
'PBX_TYPECARTE' => 'CB,VISA,EUROCARD_MASTERCARD',
Leads to this error :
Erreur de protection. Nous regrettons de ne pouvoir donner une suite favorable à votre demande de paiement.
But it doesn't work with the paybox test parameters, so i've changed the line to :
'PBX_TYPECARTE' => 'CB',
This works. If you comment this line, you'll be prompted with a batch of payment methods (debit card, paypal, etc)
Hi,
Commit 152eade gives the public_key parameter a null value in Paybox/System/Base/Response.php 's verifySignature function. The default value set in the extension didn't work for me. I had to patch this by putting the default value back in the Configuration so my transactions would verify the signature correctly.
Can you update your bundle for Symfony 2.2.* compatibility please ?
I have the following error when I try php composer.phar update
:
Problem 1
- lexik/paybox-bundle v1.0.2 requires symfony/framework-bundle 2.1.*,<2.2-dev -> satisfiable by symfony/symfony v2.1.8, symfony/symfony v2.1.0, symfony/symfony v2.1.1, symfony/symfony v2.1.2, symfony/symfony v2.1.3, symfony/symfony v2.1.4, symfony/symfony v2.1.5, symfony/symfony v2.1.6, symfony/symfony v2.1.7, symfony/symfony v2.1.8, symfony/framework-bundle v2.1.0, symfony/framework-bundle v2.1.1, symfony/framework-bundle v2.1.2, symfony/framework-bundle v2.1.3, symfony/framework-bundle v2.1.4, symfony/framework-bundle v2.1.5, symfony/framework-bundle v2.1.6, symfony/framework-bundle v2.1.7, symfony/framework-bundle v2.1.8.
- lexik/paybox-bundle v1.0.0 requires symfony/framework-bundle 2.1.*,<2.2-dev -> satisfiable by symfony/symfony v2.1.8, symfony/symfony v2.1.0, symfony/symfony v2.1.1, symfony/symfony v2.1.2, symfony/symfony v2.1.3, symfony/symfony v2.1.4, symfony/symfony v2.1.5, symfony/symfony v2.1.6, symfony/symfony v2.1.7, symfony/symfony v2.1.8, symfony/framework-bundle v2.1.0, symfony/framework-bundle v2.1.1, symfony/framework-bundle v2.1.2, symfony/framework-bundle v2.1.3, symfony/framework-bundle v2.1.4, symfony/framework-bundle v2.1.5, symfony/framework-bundle v2.1.6, symfony/framework-bundle v2.1.7, symfony/framework-bundle v2.1.8.
- lexik/paybox-bundle v1.0.1 requires symfony/framework-bundle 2.1.*,<2.2-dev -> satisfiable by symfony/symfony v2.1.8, symfony/symfony v2.1.0, symfony/symfony v2.1.1, symfony/symfony v2.1.2, symfony/symfony v2.1.3, symfony/symfony v2.1.4, symfony/symfony v2.1.5, symfony/symfony v2.1.6, symfony/symfony v2.1.7, symfony/symfony v2.1.8, symfony/framework-bundle v2.1.0, symfony/framework-bundle v2.1.1, symfony/framework-bundle v2.1.2, symfony/framework-bundle v2.1.3, symfony/framework-bundle v2.1.4, symfony/framework-bundle v2.1.5, symfony/framework-bundle v2.1.6, symfony/framework-bundle v2.1.7, symfony/framework-bundle v2.1.8.
- lexik/paybox-bundle v1.0.2 requires symfony/framework-bundle 2.1.*,<2.2-dev -> satisfiable by symfony/symfony v2.1.8, symfony/symfony v2.1.0, symfony/symfony v2.1.1, symfony/symfony v2.1.2, symfony/symfony v2.1.3, symfony/symfony v2.1.4, symfony/symfony v2.1.5, symfony/symfony v2.1.6, symfony/symfony v2.1.7, symfony/symfony v2.1.8, symfony/framework-bundle v2.1.0, symfony/framework-bundle v2.1.1, symfony/framework-bundle v2.1.2, symfony/framework-bundle v2.1.3, symfony/framework-bundle v2.1.4, symfony/framework-bundle v2.1.5, symfony/framework-bundle v2.1.6, symfony/framework-bundle v2.1.7, symfony/framework-bundle v2.1.8.
- Can only install one of: symfony/symfony v2.2.0, symfony/symfony v2.1.8.
- Can only install one of: symfony/symfony v2.2.0, symfony/symfony v2.1.0.
- Can only install one of: symfony/symfony v2.2.0, symfony/symfony v2.1.1.
- Can only install one of: symfony/symfony v2.2.0, symfony/symfony v2.1.2.
- Can only install one of: symfony/symfony v2.2.0, symfony/symfony v2.1.3.
- Can only install one of: symfony/symfony v2.2.0, symfony/symfony v2.1.4.
- Can only install one of: symfony/symfony v2.2.0, symfony/symfony v2.1.5.
- Can only install one of: symfony/symfony v2.2.0, symfony/symfony v2.1.6.
- Can only install one of: symfony/symfony v2.2.0, symfony/symfony v2.1.7.
- Can only install one of: symfony/symfony v2.2.0, symfony/symfony v2.1.8.
- don't install symfony/framework-bundle v2.1.0|don't install symfony/symfony v2.2.0
- don't install symfony/framework-bundle v2.1.1|don't install symfony/symfony v2.2.0
- don't install symfony/framework-bundle v2.1.2|don't install symfony/symfony v2.2.0
- don't install symfony/framework-bundle v2.1.3|don't install symfony/symfony v2.2.0
- don't install symfony/framework-bundle v2.1.4|don't install symfony/symfony v2.2.0
- don't install symfony/framework-bundle v2.1.5|don't install symfony/symfony v2.2.0
- don't install symfony/framework-bundle v2.1.6|don't install symfony/symfony v2.2.0
- don't install symfony/framework-bundle v2.1.7|don't install symfony/symfony v2.2.0
- don't install symfony/framework-bundle v2.1.8|don't install symfony/symfony v2.2.0
- Installation request for symfony/symfony 2.2.* -> satisfiable by symfony/symfony v2.2.0.
- Installation request for lexik/paybox-bundle 1.0.* -> satisfiable by lexik/paybox-bundle v1.0.0, lexik/paybox-bundle v1.0.1, lexik/paybox-bundle v1.0.2.
Here, my composer.json file:
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"repositories": [
{
"type": "vcs",
"url": "http://git.code.sf.net/p/tcpdf/code"
}
],
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.2.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "1.2.*@beta",
"doctrine/doctrine-fixtures-bundle": "2.1.*@dev",
"doctrine/data-fixtures": "dev-master@dev",
"gedmo/doctrine-extensions": "2.3.*",
"twig/extensions": "1.0.*@dev",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.2.*",
"symfony/monolog-bundle": "2.2.*",
"sensio/distribution-bundle": "2.2.*",
"sensio/framework-extra-bundle": "2.2.*",
"sensio/generator-bundle": "2.2.*",
"jms/security-extra-bundle": "1.4.*",
"jms/di-extra-bundle": "1.3.*",
"kriswallsmith/assetic": "1.1.*@dev",
"gregwar/image-bundle": "1.0.*",
"mopa/bootstrap-bundle": "2.1.*@dev",
"mopa/composer-bridge": "v1.1.0",
"knplabs/knp-paginator-bundle": "2.3.*",
"knplabs/knp-menu-bundle": "1.1.*@dev",
"knplabs/knp-components": "1.2.*",
"lexik/paybox-bundle": "1.0.*",
"whiteoctober/breadcrumbs-bundle": "dev-master@dev",
"whiteoctober/tcpdf-bundle": "dev-master@dev",
"tecnick.com/tcpdf": "*@dev",
"friendsofsymfony/user-bundle": "1.3.*",
"sonata-project/admin-bundle": "2.2.*@dev",
"sonata-project/jquery-bundle": "1.8.*",
"sonata-project/exporter": "1.2.*",
"sonata-project/block-bundle": "2.2.*@dev",
"sonata-project/cache-bundle": "2.1.*",
"sonata-project/easy-extends-bundle": "2.1.*",
"sonata-project/doctrine-orm-admin-bundle": "2.2.*@dev",
"sonata-project/intl-bundle": "2.1.*",
"sonata-project/user-bundle": "2.1.*@dev",
"sonata-project/doctrine-extensions": "1.*",
"sonata-project/google-authenticator": "1.*",
"fabpot/goutte": "v0.1.0"
},
"scripts": {
"pre-update-cmd": [
"Nexy\\MainBundle\\Composer\\ScriptHandler::maintenanceLock"
],
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Nexy\\MainBundle\\Composer\\ScriptHandler::maintenanceunLock"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Nexy\\MainBundle\\Composer\\ScriptHandler::maintenanceunLock"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"branch-alias": {
"dev-master": "2.2-dev"
}
}
}
Thanks.
I see that your composer.json file is sf2.3 ready in master, can you push a stable version for it ?
Thanks.
The bundle currently accepts only 6 of the most common currencies.
It would be nice to be able to choose which ones are accepted without having to modify the bundle directly.
hi i try to make pre-prod test and i get alway :
[2016-07-13 11:16:25] request.INFO: Matched route "lexik_paybox_ipn". {"route_parameters":{"_controller":"Lexik\\Bundle\\PayboxBundle\\Controller\\DefaultController::ipnAction","_locale":"fr","time":"1468408561","_route":"lexik_paybox_ipn"},"request_uri":"http://www.xxxxxx.com/fr/payment-ipn/1468408561"} []
[2016-07-13 11:16:25] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2016-07-13 11:16:25] payment.INFO: New IPN call. [] []
[2016-07-13 11:16:25] payment.INFO: NumTr=8155105 [] []
[2016-07-13 11:16:25] payment.INFO: Mt=32600 [] []
[2016-07-13 11:16:25] payment.INFO: Ref=TPSa-44c079476f@1468408561 [] []
[2016-07-13 11:16:25] payment.INFO: Auto=XXXXXX [] []
[2016-07-13 11:16:25] payment.INFO: Erreur=00000 [] []
[2016-07-13 11:16:25] payment.INFO: Sign=hOoEFNHwbAF3X2IzLEO/XyiK67gTPysXglMyfb3Tnek56S1jRA9ihAt93sPyEUP/f8idmXx4MhYAfrJ0H37QouY5eFYZRnZQZ+BH4XlJaRUf3LAyYfT4Lg2mPXfRIG97Dl4QjY9YP7Gjho25BaHtR29FeufJ6U5LXg+TktZMPh0= [] []
[2016-07-13 11:16:25] payment.INFO: NumTr=8155105&Mt=32600&Ref=TPSa-44c079476f%401468408561&Auto=XXXXXX&Erreur=00000 [] []
[2016-07-13 11:16:25] payment.INFO: hOoEFNHwbAF3X2IzLEO/XyiK67gTPysXglMyfb3Tnek56S1jRA9ihAt93sPyEUP/f8idmXx4MhYAfrJ0H37QouY5eFYZRnZQZ+BH4XlJaRUf3LAyYfT4Lg2mPXfRIG97Dl4QjY9YP7Gjho25BaHtR29FeufJ6U5LXg+TktZMPh0= [] []
[2016-07-13 11:16:25] payment.ERROR: Signature is invalid. [] []
thank for help
Hello,
Lexik/paybox-bundle requires symfony >=2.1, <2.3-dev. I would like to use it on a project running Symfony 2.3.2. Is the bundle incompatible with it, or can the requirement be updated ?
Thank you.
Anyone interested with the creation of a new service to handle this service ?
Hi there,
Have you considered the integration of Paybox in Payum payment framework ?
We used to work with the JMSPayementCoreBundle and we already have a working but unreleased PayboxPlugin. We are now considering moving to PayumBundle for better maintainability.
Here is the original /Paybox/System/Base/ParameterResolver.php
<?php
namespace Lexik\Bundle\PayboxBundle\Paybox\System\Base;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\Options;
/**
* Paybox\System\ParameterResolver class.
*
* @author Olivier Maisonneuve <[email protected]>
*/
class ParameterResolver
{
/**
* @var array
*/
private $knownParameters;
/**
* @var array
*/
private $requiredParameters;
/**
* @var OptionsResolver
*/
private $resolver;
/**
* @var array
*/
private $currencies;
/**
* Constructor initialize all available parameters.
*
* @param array $currencies
*/
public function __construct(array $currencies)
{
$this->resolver = new OptionsResolver();
$this->currencies = $currencies;
$this->knownParameters = array(
'PBX_1EURO_CODEEXTER',
'PBX_1EURO_DATA',
'PBX_2MONTn',
'PBX_3DS',
'PBX_ANNULE',
'PBX_ARCHIVAGE',
'PBX_AUTOSEULE',
'PBX_CMD',
'PBX_CODEFAMILLE',
'PBX_CURRENCYDISPLAY',
'PBX_DATEn',
'PBX_DEVISE',
'PBX_DIFF',
'PBX_DISPLAY',
'PBX_EFFECTUE',
'PBX_EMPREINTE',
'PBX_ENTITE',
'PBX_ERRORCODETEST',
'PBX_HASH',
'PBX_HMAC',
'PBX_IDABT',
'PBX_IDENTIFIANT',
'PBX_INTRUM_DATA',
'PBX_LANGUE',
'PBX_MAXICHEQUE_DATA',
'PBX_NETRESERVE_DATA',
'PBX_ONEY_DATA',
'PBX_PAYPAL_DATA',
'PBX_PORTEUR',
'PBX_RANG',
'PBX_REFABONNE',
'PBX_REFUSE',
'PBX_REPONDRE_A',
'PBX_RETOUR',
'PBX_RUF1',
'PBX_SITE',
'PBX_SOURCE',
'PBX_TIME',
'PBX_TOTAL',
'PBX_TYPECARTE',
'PBX_TYPEPAIEMENT',
);
}
/**
* Resolves parameters for a payment call.
*
* @param array $parameters
*
* @return Options
*/
public function resolve(array $parameters)
{
$this->initParameters();
return $this->resolver->resolve($parameters);
}
/**
* Initialise required parameters for a payment call.
*/
protected function initParameters()
{
$this->requiredParameters = array(
'PBX_SITE',
'PBX_RANG',
'PBX_IDENTIFIANT',
'PBX_TOTAL',
'PBX_DEVISE',
'PBX_CMD',
'PBX_PORTEUR',
'PBX_RETOUR',
'PBX_HASH',
'PBX_TIME',
'PBX_HMAC',
);
$this->initResolver();
}
/**
* Initialize the OptionResolver with required/optionnal options and allowed values.
*/
protected function initResolver()
{
$this->resolver->setRequired($this->requiredParameters);
$this->resolver->setOptional(array_diff($this->knownParameters, $this->requiredParameters));
$this->initAllowed();
}
/**
* Initialize allowed values.
* @see http://www.fastwrite.com/resources/core/iso-currency-codes/index.php
*/
protected function initAllowed()
{
$this->resolver->setAllowedValues(array(
'PBX_DEVISE' => $this->currencies,
'PBX_RUF1' => array(
'GET',
'POST',
),
));
}
}
Only 3 multiple payments are allowed, it should be :
<?php
namespace Lexik\Bundle\PayboxBundle\Paybox\System\Base;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\Options;
/**
* Paybox\System\ParameterResolver class.
*
* @author Olivier Maisonneuve <[email protected]>
*/
class ParameterResolver
{
/**
* @var array
*/
private $knownParameters;
/**
* @var array
*/
private $requiredParameters;
/**
* @var OptionsResolver
*/
private $resolver;
/**
* @var array
*/
private $currencies;
/**
* Constructor initialize all available parameters.
*
* @param array $currencies
*/
public function __construct(array $currencies)
{
$this->resolver = new OptionsResolver();
$this->currencies = $currencies;
$this->knownParameters = array(
'PBX_1EURO_CODEEXTER',
'PBX_1EURO_DATA',
'PBX_2MONT1',
'PBX_2MONT2',
'PBX_2MONT3',
'PBX_3DS',
'PBX_ANNULE',
'PBX_ARCHIVAGE',
'PBX_AUTOSEULE',
'PBX_CMD',
'PBX_CODEFAMILLE',
'PBX_CURRENCYDISPLAY',
'PBX_DATE1',
'PBX_DATE2',
'PBX_DATE3',
'PBX_DEVISE',
'PBX_DIFF',
'PBX_DISPLAY',
'PBX_EFFECTUE',
'PBX_EMPREINTE',
'PBX_ENTITE',
'PBX_ERRORCODETEST',
'PBX_HASH',
'PBX_HMAC',
'PBX_IDABT',
'PBX_IDENTIFIANT',
'PBX_INTRUM_DATA',
'PBX_LANGUE',
'PBX_MAXICHEQUE_DATA',
'PBX_NETRESERVE_DATA',
'PBX_ONEY_DATA',
'PBX_PAYPAL_DATA',
'PBX_PORTEUR',
'PBX_RANG',
'PBX_REFABONNE',
'PBX_REFUSE',
'PBX_REPONDRE_A',
'PBX_RETOUR',
'PBX_RUF1',
'PBX_SITE',
'PBX_SOURCE',
'PBX_TIME',
'PBX_TOTAL',
'PBX_TYPECARTE',
'PBX_TYPEPAIEMENT',
);
}
/**
* Resolves parameters for a payment call.
*
* @param array $parameters
*
* @return Options
*/
public function resolve(array $parameters)
{
$this->initParameters();
return $this->resolver->resolve($parameters);
}
/**
* Initialise required parameters for a payment call.
*/
protected function initParameters()
{
$this->requiredParameters = array(
'PBX_SITE',
'PBX_RANG',
'PBX_IDENTIFIANT',
'PBX_TOTAL',
'PBX_DEVISE',
'PBX_CMD',
'PBX_PORTEUR',
'PBX_RETOUR',
'PBX_HASH',
'PBX_TIME',
'PBX_HMAC',
);
$this->initResolver();
}
/**
* Initialize the OptionResolver with required/optionnal options and allowed values.
*/
protected function initResolver()
{
$this->resolver->setRequired($this->requiredParameters);
$this->resolver->setOptional(array_diff($this->knownParameters, $this->requiredParameters));
$this->initAllowed();
}
/**
* Initialize allowed values.
* @see http://www.fastwrite.com/resources/core/iso-currency-codes/index.php
*/
protected function initAllowed()
{
$this->resolver->setAllowedValues(array(
'PBX_DEVISE' => $this->currencies,
'PBX_RUF1' => array(
'GET',
'POST',
),
));
}
}
Hi,
I have some questions about PayboxBundle.
In my local machine, I required it with composer : composer require lexik/paybox-bundle. My composer.json file contains this line : "lexik/paybox-bundle": "^2.1". But in my vendors, the file Resources/views/Macro/paybox.html.twig has an old version. The commit 4db3c56 (Fix support for Twig 2.*) seems not to be considered, and I doesn't understand how it is possible ! :)
And I have a second problem : when I try to release my project to production (Ubuntu 16.04 on a VPS), and 'composer update', I have this error : lexik/paybox-bundle v2.1.1 requires lib-curl >=7.10.0 -> the requested linked library curl has the wrong version installed or is missing from your system, make sure to have the extension providing it.
But the command 'curl -V' returns : curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
It seems the installed version is >=7.10.0, so I don't unerstand either ...
Could someone help me ? :)
Thanks a lot !
Hello,
I managed to have my own controller to be able to put the files in my app bundle.
I call the payment method in twig with :
{{ render(controller('AppBundle:Membership:OneYear')) }}
My MembershipController.php looks like :
...
class MembershipController extends Controller
{
/**
* OneYear action creates the form for a one year membership payment call.
*
* @return Response
*/
public function OneYearAction()
{
$paybox = $this->get('lexik_paybox.request_handler');
$paybox->setParameters(array(
'PBX_CMD' => 'CMD'.time(),
'PBX_DEVISE' => '978',
'PBX_PORTEUR' => '[email protected]',
'PBX_RETOUR' => 'Mt:M;Ref:R;Auto:A;Erreur:E',
'PBX_TOTAL' => '1490',
'PBX_TYPEPAIEMENT' => 'CARTE',
'PBX_TYPECARTE' => 'CB',
'PBX_EFFECTUE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'success'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_REFUSE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'denied'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_ANNULE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'canceled'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_RUF1' => 'POST',
'PBX_REPONDRE_A' => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), UrlGeneratorInterface::ABSOLUTE_URL),
));
return $this->render(
'my_bundle/user/membershippayboxform.html.twig',
array(
'url' => $paybox->getUrl(),
'form' => $paybox->getForm()->createView(),
)
);
}
/**
* OneMonth action creates the form for a one month membership payment call.
*
* @return Response
*/
public function OneMonthAction()
{
$paybox = $this->get('lexik_paybox.request_handler');
$paybox->setParameters(array(
'PBX_CMD' => 'CMD'.time(),
'PBX_DEVISE' => '978',
'PBX_PORTEUR' => '[email protected]',
'PBX_RETOUR' => 'Mt:M;Ref:R;Auto:A;Erreur:E',
'PBX_TOTAL' => '190',
'PBX_TYPEPAIEMENT' => 'CARTE',
'PBX_TYPECARTE' => 'CB',
'PBX_EFFECTUE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'success'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_REFUSE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'denied'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_ANNULE' => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'canceled'), UrlGeneratorInterface::ABSOLUTE_URL),
'PBX_RUF1' => 'POST',
'PBX_REPONDRE_A' => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), UrlGeneratorInterface::ABSOLUTE_URL),
));
return $this->render(
'my_bundle/user/membershippayboxform.html.twig',
array(
'url' => $paybox->getUrl(),
'form' => $paybox->getForm()->createView(),
)
);
}
/**
* Return action for a confirmation payment page on which the user is sent
* after he seizes his payment informations on the Paybox's platform.
* This action might only containts presentation logic.
*
* @param Request $request
* @param string $status
*
* @return Response
*/
public function returnAction(Request $request, $status)
{
return $this->render('my_bundle/user/membershippayboxreturn.html.twig', array(
'status' => $status,
'parameters' => $request->query
));
}
}
It all works fine until the response from PayBox, the script seems to still use the public function returnAction(Request $request, $status) from the SampleController.php and not from my MembershipController.php.
Any idea on what I could do wrong here or have forgotten please ?
Best regards,
David
Hello !
This is minor but could (probably) be easily changed. In the twitter Bootstrap 3 doc you can read :
Use .checkbox-inline or .radio-inline class to a series of checkboxes or radios for controls appear on the same line.
In Former, inline() method generates class="inline".
Thanks.
Xavier
Hi there !
I can not call the paybox payment page with LexikPayboxBundle.
Here is the error message: "Warning: DOMDocument :: loadHTML (): Empty string supplied as input".
Here is my configuration:
In config.yml
lexik_paybox:
parameters:
production: false
site: 'XXXXXXX'
rank: 'XXX'
login: 'XXXXXXXXX'
currencies:
- '978' # EUR
hmac:
algorithm: sha512
key: 'XXX...XXX'
signature_name: Sign
In my Controller php :
$paybox = $this->get('lexik_paybox.request_handler');
$paybox->setParameters(array(
'PBX_CMD' => 'CMD'.time(),
'PBX_DEVISE' => '978',
'PBX_PORTEUR' => '[email protected]',
'PBX_RETOUR' => 'Mt:M;Ref:R;Auto:A;Erreur:E',
'PBX_TOTAL' => '1000',
'PBX_TYPEPAIEMENT' => 'CARTE',
'PBX_TYPECARTE' => 'CB',
'PBX_EFFECTUE' => $this->generateUrl('paiementstatus', array('status' => 'success'), true),
'PBX_REFUSE' => $this->generateUrl('paiementstatus', array('status' => 'denied'), true),
'PBX_ANNULE' => $this->generateUrl('paiementstatus', array('status' => 'canceled'), true),
'PBX_RUF1' => 'POST',
'PBX_REPONDRE_A' => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), true),
));
return $this->render(
'LexikPayboxBundle:Sample:index.html.twig',
array(
'url' => $paybox->getUrl(),
'form' => $paybox->getForm()->createView(),
)
);
You can see my error in the screenshot in attach files.
Thank you in advance for your help !
Setting the propuction/prepoduction environment with a parameter in the config should be great.
This will allow us to use test mode for dev environment and production mode in the prod environment.
Hi,
I saw that you start working on Symfony 3.0 in the branch sf3.0 .
I wanted to know if it would be released soon ?
Or if I can help you on it.
Thanks.
In:
https://github.com/lexik/LexikPayboxBundle/blob/master/Transport/CurlTransport.php#L63
if (!in_array($responseCode, array(0, 200, 201, 204))) {
throw new \RuntimeException('cUrl returns some errors (cURL errno '.$curlErrorNumber.'): '.$curlErrorMessage.' (HTTP Code: '.$responseCode.')');
}
It doesn't throw an exception (even though curl_errno > 0
) if you don't have a HTTP responseCode, like this one:
var_dump($response, $curlErrorNumber, $curlErrorMessage, $responseCode)
boolean false
int 60
string 'SSL certificate problem: unable to get local issuer certificate' (length=63)
int 0
Possible fix:
if ($curlErrorNumber > 0 || !in_array($responseCode, array(0, 200, 201, 204))) {
throw new \RuntimeException('cUrl returns some errors (cURL errno '.$curlErrorNumber.'): '.$curlErrorMessage.' (HTTP Code: '.$responseCode.')');
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.