PHP code example of snowbaha / etransactions-bundle
1. Go to this page and download the library: Download snowbaha/etransactions-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
snowbaha / etransactions-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Snowbaha\EtransactionsBundle\SnowbahaEtransactionsBundle(),
);
}
// YOUR CONTROLLER
/**
* THIS ROUTE have to be public to allow the bank access, it is the URL you will provide to your account
* @Route("/payment/verification")
* @param Request $request
*/
public function paymentVerificationAction(Request $request)
{
// ...
$responseBank = $this->get('snowbaha.etransactions')->responseBankServer($request);
$id_order = (int)$responseBank['ref'];
$Order = $this->get('app.provider.order')->getOneByID( $id_order );
// Success
if($responseBank['sucessPayment'] === true && !is_null($Order)) :
$Order->setState("order.state.success_payment");
$Order->setPaymentError(0);
// Email notification
$this->get('app.mailing.order')->sendNewOrderNotif($Order);
elseif( !is_null($Order) ) :
// Error
$Order->setState('order.state.success_payment_error');
$Order->setPaymentError($responseBank['error']);
endif;
//...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.