![]() |
|
sfPaymentCICPlugin - 0.5.0CIC/Crédit Mutuel payment module integration into Symfony |
|
The sfPaymentCIC is a symfony plugin that provides P@iementCIC module for Symfony applications.
Additional checkings and return code handling are done to provide a better comfort with API calls.
Install the plugin
symfony plugin-install http://plugins.symfony-project.com/sfPaymentCICPlugin
Clear your cache
symfony cc
Edit the app.yml and add these parameters with your information :
the bank HTTPS page provided
the currency
the Electronic Payment Gateway (TPE) information
all:
cic_payment:
request_url: https://ssl.paiement.cic-banques.fr/test/paiement.cgi
return_url: http://example.org/index.php
passphrase: PassPhraseHere
currencies: [EUR]
submit_label: Go to payment
tpe:
number: 1234567
key: YourKeyHere
company: mycompany
Symfony specific
The plugin provides the ability to redirect to your own actions once the payment return has been checked.
In your app.yml, simply add the module/action for both return cases (good or error) and user redirection after payment :
all:
cic_payment:
response_ok: mymodule/mybankok
response_nok: mymodule/mybanknok
user_return: mymodule/myactionok
user_cancel: mymodule/myactionnok
Once you're ready to transfer information to the payment, set a redirect to sfPaymentSIPS/request in your module and provide three parameters through sfUser object :
$this->getUser()->setParameter('amount', '14.00', 'cic_payment');
$this->getUser()->setParameter('currency', 'EUR', 'cic_payment');
$this->getUser()->setParameter('order_id', '145', 'cic_payment');
$this->forward('sfPaymentCIC', 'request');
sfPaymentCIC/response handles the bank return code and transfers to the module/Action you have specified. In your custom action, it is possible to get the instance of the sfPaymentCIC class containing the detailed bank information, with ability to get a verbose message as specified in the original documentation.
$cicPayment = $this->getUser()->getParameter('payment', null, 'cic_payment');
Please refer to the CIC documentation provided by Crédit Mutuel / CIC.