Open Payment Gateway API Response Parsing Hook Guideline

Question: Open Payment Gateway API Response Parsing Hook Guideline for Hosting Controller v10
 
Guide for witting Response Parser for a new Gateway Integration
 
Attached is the sample project used as an the example in this document : HookMyNewGateway.zip
 
  • This document assumes that you have already added (as below ss) a new payment gateway in HC and now just want to write its response parser
 
 
  • This document also assumes that you know how to code in C# and are familiar with Visual Studio 2015 (or later)
  1. Create a New class library type project in Visual Studio

     
  2. Add reference to the assembly “HC.Common.Hooks.Interfaces.dll” from /Components folder from HC Installation location
     
       3. Implement the interface “IGatewaysBase” from the above added HC assembly. Say your implementation(class) name is “MyNewGateway”

 
The interface contains two methods to implement;
 
Parse Response
  • This method must always return a string “Approved” if payment is successful. And, “Failed” if there is any error.
  • The first param “response” contains the response returned by the gateway
  • The second param “inputJson” contain additional data related to the transaction and the gateway. For example, GatewayId, TransactionId and custom variables added from the gateway integration page in HC10.
Append with Request
  • This method is can be used to append some additional data with the request. Each request contain data in the query string key/value format, so anything returned by this method will be append with the existing request Url.
  • The only param to this method contains custom variables added from the gateway integration page in HC10
 
4. Once the implementation is complete, add a new NuGet Package “Autofac” in the project
 
5. Now you need to add a new class a write the following in it;
 

Here you are just naming (MyNewGateway in this case) your implementation (MyNewGateway in this case) of IGatewaysBase.

Please note the name must match the gateway name enter in the new gateway integration page in HC10. Highlighted the first image.

 

6.  Just build the project and place the end assembly in the /Component directory of HC10. Please also note that you assembly must start with the string “Hook” e.g HookMyNewGateway.dll

 

That’s it, restart HC API app pool and you are good to test your new integration.

 

Add Feedback