Forums » SEPHP Help and Tips

Add a new gateway to Social Engine

    • 36 posts
    September 3, 2017 2:14 PM EDT

    I am trying to add a new gateway to Social Engine. I'm able to add the code to /application/libraries/Engine/Service/Bpm.php which begins like `class Engine_Service_Bpm extends Zend_Service_Abstract {` to direct the user to my PSP's payment page, but with dummy data that I have hard-coded, rather than the real value like good's price, order id, etc. 

    Which variables does Social Engine gateway use to keep track of these values in stores? I checked $_POST but it is empty. Then where can I retrieve cart's value, order id, etc. and send them to my PSP's payment service? 

     

    I hope the following snippet shows what I mean:  

    `$parameters = array( 'terminalId'=> $terminalId, 'userName'=>$userName, 'userPassword'=>$userPassword, 'orderId' => $orderId, 'amount' => $amount, 'localDate' => $localDate, 'localTime' => $localTime, 'additionalData' => $additionalData, 'callBackUrl' => $callBackUrl, 'payerId' => $payerId ); echo " parameters: "; print_r($parameters); $result = $client->call('bpPayRequest',$parameters,$namespace);`


    In the above code, I have given dummy values to parameters like order id and amount. How do I access the such properties of the current item being shopped by the user?


    This post was edited by Donna at September 3, 2017 3:48 PM EDT
    • Moderator
    • 5057 posts
    September 3, 2017 3:52 PM EDT

    I edited your post instead of deleting it. Our terms mention not to post code without using the code tags and we did give examples of the proper button to push to use the code tags via the tinymce editor above each post. Please ensure to always put codes in code tags. Thank you.

  • September 9, 2017 2:45 AM EDT

    Welcome to the community, mehdi!

    You may wish to ask how third party developers use this to create their own gateways as several who have successfully done so are here. Social Engine Add Ons and Radcodes seems to be the most approachable. I'd ask Social Engine Add Ons for help on this as it seems to be the most direct way of getting the answers you need for this particular issue.

    I hope you are able to get the problem fixed soon. If this doesn't work, try emailing support@socialengine.com to see if a developer can get back to you on this. I'd give you the answer if I had it, but I'm not a developer so I can't tell you the code you need. Sorry about that.

    Feel free to get back to us if you have an update, as it would be nice to know. If you need anything just ask. I'm happy to help in any way I can. I hope that pointing you in to the right direction will give you some piece of mind. Thanks for your post, it is an interesting one.

    • 36 posts
    September 9, 2017 6:02 AM EDT
    Elshara Silverheart said:

    Welcome to the community, mehdi!

    You may wish to ask how third party developers use this to create their own gateways as several who have successfully done so are here. Social Engine Add Ons and Radcodes seems to be the most approachable.

     

    Thanks Elshara I was able to write the code for my gateway inside the processTransaction method within the Engine_Payment_Gateway_Bpm class which is located at "application/libraries/Engine/Payment/Gateway/Bpm.php". I am using data from 

    $transaction->getRawData();

    to retrieve values like order id

    <pre>(vender_order_id)</pre>

    and order amount

    <pre>(AMT)</pre>

     

    $orderId = $rawData['vendor_order_id']; $amount = $rawData['AMT'];

    Now, I am redirecting the user to my PSP's secure payment page and then get the results back to a custom page I have created, to show the results. So far so good, but there is a problem here: 


    This only works on Desktop browser. When doing purchase from a mobile phone browser, this "processTransaction" method does not seem to be called. It jumps right to the page with message that the order was placed.

    So, does the gateway mechanism work differently in SE depending on whether it is run on Desktop or mobile browser? 

    Which files affect payment gateway behavior? I have noticed that for each gateway, one is under

    <pre>application/libraries/Engine/Service</pre>

    and another under

    <pre>application/libraries/Engine/Payment/Gateway</pre>