Harish Batchu

Harish Batchu

  • NA
  • 255
  • 70.4k

Integrate CCAvenanu Payment Gateway to Dot net core api 2.0?

Sep 12 2019 3:35 AM
HI folks,
 
I would like to integrate ccavenue payment gateway to andriod application. For request and response processing we are using backend dot net core web api 2.1. But I did't find any reference for dot net core application. Can any one help me out to get out of this.
 
I will add the code what they are give for request and respose processing files.
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Web;  
  4. using System.Web.UI;  
  5. using System.Web.UI.WebControls;  
  6. using System.Collections;  
  7. using System.Collections.Specialized;  
  8. using CCA.Util;  
  9. public partial class ResponseHandler : System.Web.UI.Page  
  10. {  
  11. protected void Page_Load(object sender, EventArgs e)  
  12. {  
  13. string workingKey = "6D108E9180E34A8B9FA6350B59108071";//put in the 32bit alpha numeric key in the quotes provided here  
  14. CCACrypto ccaCrypto = new CCACrypto();  
  15. string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"],workingKey);  
  16. NameValueCollection Params = new NameValueCollection();  
  17. string[] segments = encResponse.Split('&');  
  18. foreach (string seg in segments)  
  19. {  
  20. string[] parts = seg.Split('=');  
  21. if (parts.Length > 0)  
  22. {  
  23. string Key = parts[0].Trim();  
  24. string Value = parts[1].Trim();  
  25. Params.Add(Key, Value);  
  26. }  
  27. }  
  28. for (int i = 0; i < Params.Count; i++)  
  29. {  
  30. Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>");  
  31. }  
  32. }  
  33. }  
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Web;  
  5. using System.Web.UI;  
  6. using System.Web.UI.WebControls;  
  7. using System.Net;  
  8. using System.IO;  
  9. using CCA.Util;  
  10. using System.Collections.Specialized;  
  11. using System.Xml;  
  12. namespace GetRSA_Kit  
  13. {  
  14. public partial class GetRSA : System.Web.UI.Page  
  15. {  
  16. protected void Page_Load(object sender, EventArgs e)  
  17. {  
  18. try  
  19. {  
  20. string queryUrl = "https://secure.ccavenue.com/transaction/getRSAKey";  
  21. string vParams = "";  
  22. foreach (string key in Request.Params.AllKeys){  
  23. vParams += key + "=" + Request[key] + "&";  
  24. }  
  25. // Url Connection  
  26. String message = postPaymentRequestToGateway(queryUrl, vParams);  
  27. Response.Write(message);  
  28. }  
  29. catch (Exception exp){  
  30. Response.Write("Exception " + exp);  
  31. }  
  32. }  
  33. private string postPaymentRequestToGateway(String queryUrl, String urlParam)  
  34. {  
  35. String message = "";  
  36. try  
  37. {  
  38. StreamWriter myWriter = null;// it will open a http connection with provided url  
  39. WebRequest objRequest = WebRequest.Create(queryUrl);//send data using objxmlhttp object  
  40. objRequest.Method = "POST";  
  41. //objRequest.ContentLength = TranRequest.Length;  
  42. objRequest.ContentType = "application/x-www-form-urlencoded";//to set content type  
  43. myWriter = new System.IO.StreamWriter(objRequest.GetRequestStream());  
  44. myWriter.Write(urlParam);//send data  
  45. myWriter.Close();//closed the myWriter object  
  46. // Getting Response  
  47. System.Net.HttpWebResponse objResponse = (System.Net.HttpWebResponse)objRequest.GetResponse();//receive the responce from objxmlhttp object  
  48. using (System.IO.StreamReader sr = new System.IO.StreamReader(objResponse.GetResponseStream()))  
  49. {  
  50. message = sr.ReadToEnd();  
  51. }  
  52. }  
  53. catch (Exception exception)  
  54. {  
  55. Console.Write("Exception occured while connection." + exception);  
  56. }  
  57. return message;  
  58. }  
  59. }  
  60. }  
Thanks in advance