I successfully made payment request to CCAvenue payment gateway using my Angular App. Now I need to capture response received from CCAvenue in my Angular App and need to send it to my server side for further processing. How will I accomplish this using a Typescript file?
From the CCAvenue integration document we need to submit redirect URL along with our other input parameters and CCAvenue will post the status of the order along with the parameters to this URL.
And from their sample asp.net implementation document, to deal the response they have coding like this-
protected void Page_Load(object sender, EventArgs e)
{
string workingKey = "";//put in the 32bit alpha numeric key in the quotes provided
here
CCACrypto ccaCrypto = new CCACrypto();
string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"],workingKey);
NameValueCollection Params = new NameValueCollection();
string[] segments = encResponse.Split('&');
foreach (string seg in segments)
{
string[] parts = seg.Split('=');
if (parts.Length > 0)
{
string Key = parts[0].Trim();
string Value = parts[1].Trim();
Params.Add(Key, Value);
}
}
for (int i = 0; i < Params.Count; i++)
{
Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>");
}
}
And what i am trying to accomplish in my angular app's typescript file is-
In my app's typescript file i will receive call back from CCAvenue and need to send this response data received after processing the payment to my Server side using http call and in my server side i will do the decryption and will respond to my client with appropriate output message.
I already wrote something like this
ngOnInit(): void {
this.dataservice.postFeed("paymentresponse", (req,res) => {
const { encResp } = req.body;
});
}
With the above code i am getting response back from CCAvenue to my ngOnInit method, but i need to pass or get its response data for sending it to my server side. So how will get this response data from CCAAvenue call back in angular app's typescript?