dev-master
9999999-dev http://github.com/jr-k/JRKPaymentSipsBundlepaymentsips bundle for symfony2
MIT GNU GPL v2
The Requires
- php >=5.3.2
- symfony/framework-bundle 2.*
- ext-curl *
payment card credit sips jrk atos paymentsips
paymentsips bundle for symfony2
JRKPaymentSipsBundle requires the ATOS api folder, (*1)
Add jrk/paymentsips-bundle as a dependency in your project's composer.json file:, (*2)
{ "require": { "jrk/paymentsips-bundle": "dev-master" } }
Update composer, (*3)
php composer update or php composer.phar update
``` php Install assets ``` php app/console assets:install ``` > Generate pathfile assets - You'll have to specify param's path directory (by default use [app/config/sips/param]) ``` php app/console jrk:sips:install ``` For example, with default values of the bundle, you can extract the API like this: . |-- app | `-- config | `-- sips | `-- bin | `-- static | `-- request | `-- response | `-- param | `-- certif.XXXXXXXXXXXX | `-- parmcom.XXXXXXXXXXXX | `-- parmcom.mercanet # if you are using mercanet for example | `-- pathfile # generated | `-- Version.txt Usage ----- - Using service Open your controller and call the service. ``` php get('jrk_paymentsips')->get_sips_request( array( "amount" => 10, "currency_code" => 978 // Override params if you need "order_id" => 12 ), $YourTransactionEntityExample ); ?>, (*4)
The bundle forward an array with the server response in a multidimensionnal array : In your response action, if you call this : `$structuredData = $request->attributes->get('response_data')`; the variable structuredData will contain the following data : - code - error - merchant_id - merchant_country - amount - transaction_id - payment_means - transmission_date - payment_time - payment_date - response_code - payment_certificate - authorisation_id - currency_code - card_number - cvv_flag - cvv_response_code - bank_response_code - complementary_code - complementary_info - return_context - caddie - receipt_complement - merchant_language - language - customer_id - order_id - customer_email - customer_ip_address - capture_day - capture_mode - data - order_validity - transaction_condition - statement_reference - card_validity - score_value - score_color - score_info - score_threshold - score_profile Attributes "code" and "response_code" will give you more informations about the state of the payment. You can now use the "sips_route_response" method in your controller ``` php attributes->get('response_data'); $orderId = $responseData['order_id']; // Get your order entity $order = $this ->getDoctrine() ->getEntityManager() ->getRepository('YourBundle:YourEntity') ->find($orderId) ; // Update your entity data, for exemple order state $order->setState("ACCEPTED"); $em=$this->getDoctrine()->getEntityManager(); $em->persist($order); $em->flush(); ?>
Controller example, (*5)
``` php get('jrk_paymentsips')->get_sips_request( array( 'amount' => $price, 'order_id' => $order->getId() ), $order ); // Render your payment page, you can render the sips form like that for twig : {{ sips_form }} return $this->render('ShopFrontBundle:MyController:paymentpage.html.twig', array( "sips_form"=>$paymentForm ) ); } // Controller set in your config.yml : my_sips_response parameter public function my_sips_responseAction() { $responseData = $request->attributes->get('response_data'); $orderId = $responseData['order_id']; // Find your order in your database $order = $this ->getDoctrine() ->getEntityManager() ->getRepository('YourBundle:YourEntity') ->find($orderId) ; // Store your transaction entity in database for example, or attributes. $order->setState("ACCEPTED"); $em = $this->getEntityManager(); $em->persist($order); $em->flush(); // Notify the user by mail for example /* ... */ // Redirect the user in his history orders for example return $this->redirect($this->generateUrl("user_history_orders")); } } ?>, (*6)
View (twig example)
Order page : {{ sips_form|raw }} ```, (*7)
paymentsips bundle for symfony2
MIT GNU GPL v2
payment card credit sips jrk atos paymentsips