ccavenue get payment status from response url - c#

I am using iframe approach in a .net mvc app and we are setting one return url while sending the request.
My question is how can i know the payment status & ccavenue payment reference no and other payment related params from response url
My retun url action is something like this
[HttpGet]
public ActionResult ResponseCCPayment()
{
//but how to read reposne params from here
return Content("got response frm ccveue");
}
From CCAvenue documentation i can see
redirect_url CCAvenue will post the status of the order along with the parameters to this URL
But no details on what parameters. Can someone help to get this

Login to the merchant account. There you have an option to download the relevant documents about the returned parameters list. (Merchant Account : https://login.ccavenue.com/jsp/merchant/merchantLogin.jsp)
In the Merchant Account you can configure a url to which a asynchronous response will be sent when a customer has made a payment. In this asynchronous response, you can get those payment related info.
There is also a separate REST api method, that takes the order id as argument and return payment related details.
Hope this helps.

Related

Is there a way in Postman to store multiple values for one key?

I am working on side-project using ASP.Net Core web api. I am currently using Postman so I can interact with custom middleware. As you can see in the picture I have a User id and would like the request header to have more than one value for the user id key. Everytime I debug the api, the request header only counts one value instead of two values. I have looked at the Postman help page but it doesn't really cover any material regarding my issue. So to condense my question, is there a way in Postman that a key (For my scenario, User Id) can hold more than one value.
Your question doesn't really make sense. Postman will send the data you put, to the server. The data you put is "1,2". At the server end, if you pull the userId value and split it on the comma, you have your two values, no?
I find it incredibly unlikely that when you pull userId at the server, the value of the header is "1" and the other id has disappeared. If the web did that loads of headers (such as your gzip, deflate, br there) would get lost and stuff wouldn't work properly
In java with spring boot framework i have idea about it we have to send List userIds from request controller method this method you have to take as post method and send that data into body part with
#PostMapping("/listUsers")
public String getList(#RequestBody List<Integer> userIds) {
// call service method
return "page";
}
Json Request from postman
{
1,2,3,4,5............
}
In dot net core
[Produces("application/json")]
[Route("api/accounts")]
public class AccountsController : Controller
{
[HttpGet]
[Route("servicesbycategoryids")]
public IActionResult ServicesByCategoryIds([FromQuery] int[] ids)
{
return Ok();
}
}

Read the URL parameter which is set after the hash symbol using ASP.NET Core MVC

Let's say we have a controller like this:
public class HomeController : Controller
{
[HttpGet]
public IActionResult Foo(string token)
{
return RedirectToAction(nameof(Index));
}
}
When I type the following URL address in the webbrowser:
https://localhost:44348/home/foo#dsfdsf
I would like to be able to read the dsfdsf after the hash symbol and bind it to the token variable.
Now I'm receiving null value. I'm getting such URL from the 3rd party app and I need to consume the response somehow and read the data from the query string.
I played with [FromQuery] attribute but I haven't managed it to work so far.
Any ideas?
Cheers
I have a work around for you, but first of all lets get more into the problem.
The strings after the hash symbol which are called Fragment values are not query parameters but they are strings to be read by the client-side (living in the browser) and the server cannot read them because they are not sent to the server by the browser.
Some authentication providers like Google and Azure send the access token as Fragment value for security reasons so that they are not transferred over the internet after they get sent as direct response from the authentication provider.
The only way you can come around that is to use javascript to convert the fragment values to query parameters by replacing the '#' with '?' and redirecting to the endpoint in your server controller.
I suppose the easiest way is to handle all that from server, meaning you get get the request in server, send a javascript code to the browser on the fly, that replaces the '#' into '?' and redirects to your second endpoint which reads the token as strong parameter.
Here how you can do it in ASP.NET Core 3.1:
[AllowAnonymous]
[HttpGet("authredirect")]
[Produces("text/html")]
public virtual ContentResult ConvertUrlFragmentToQueryParamThenRedirect()
{
return Content("<html><script>window.location.href=window.location.href.replace('#', '?').replace('authredirect', 'authparams')</script></html>", "text/html");
}
[AllowAnonymous]
[HttpGet("authparams")]
public virtual void GetAccessToken([FromQuery] string access_token)
{
// now you have your access token server side here
}
Please remember to set your redirectUrl to the correct one, in this case 'YOUR REDIRECT URL/authredirect'.

In MVC, how do I pass in form data as query strings?

I want to make it so that when people search for something, what they searched gets added to the url of the next page. So they can favorite the page, and then access the page again without filling in the form again. All the posts I can fine assume I want to pass in hard coded query string parameters.
When you send an HTTP POST request, the data that the client send to the server are stored in the request's body.
While, when you send an HTTP GET request, you can send data to the client that are in the query string (after the question mark, ?, in form of key/value pairs, ?name=test&age=21) of your url.
That being said, you have to add a filter to your ActionResult method in your controller that allows only HTTP GET request to reach it. For instance, you need something like this:
public class HomeController : Controller
{
[HttpGet]
public ActionResult ActionName(string name, int age)
{
}
}
Then the client can make a GET request using the following url:
www.domain/Home/ActionName?name=test&age=21

create listener to http post request in asp.net mvc 4

I have to receive 'call back' from interfax API. When a user (having account) on interfax receives a fax, it gives a call back to the account holder on a specified URL that must be able to receive Http Post request.
The guidance is here Accepting incoming fax notifications by callback.
I created a a controller and action "Index" as
public string Index()
{
try
{
Ifax ifax = new Fax();
ifax.UserId = Convert.ToString(Request.QueryString["userId"]);
ifax.Id = Convert.ToInt32(Request.QueryString["id"]);
---
---
ifax.Save()
}
}
catch(Exception ex)
{
//handle exception
}
//Just saving to db 'true' or 'false', to know if callback receive.
//SaveFlag();
}
When I receive fax in my interfax account, I get call back on my webserver.
But the problem is that I am not getting data. I get every variable null or empty.
Am I using a correct way to receive http post request from any client api?
As I understand Interfax sends a Post request to your application.
since its a post request you should be able to read posted values Request["phoneNumber"]
How to retrieve form values from HTTPPOST, dictionary or?

TempData and Fiddler

public ActionResult Index()
{
TempData["msg"] = "Test";
return RedirectToAction("About");
}
public ActionResult About()
{
var msg = TempData["msg"];
return View();
}
A simple question. I am sure I will slap my forehead when I see the answer to it.
Navigating to the Index action in the browser results in a redirect to the About action and the TempData value is correct.
Why when I navigate to the Index action using the Fiddler composer it results in a redirect to the About action but the TempData value is lost and null?
I think the answer is found here (http://msdn.microsoft.com/en-us/library/ms178581(v=vs.100).aspx):
"Sessions are identified by a unique identifier that can be read by using the SessionID property. When session state is enabled for an ASP.NET application, each request for a page in the application is examined for a SessionID value sent from the browser. If no SessionID value is supplied, ASP.NET starts a new session and the SessionID value for that session is sent to the browser with the response."
When I add this line to the beginning of each Action:
Debug.Write(string.Format("SessionId: {0}\r\n", HttpContext.Session.SessionID));
I see that when you run from a browser the sessionid is the same. When run from the Fiddler composer they are different.
Therefore, TempData is going to be reset using the default TempDataProvider (which stores the TempData in session state).
If requests are the same than results should be the same. Most likely you are not making exact copy of first request when composing fake one. Note that in case of tempData your composed request will work (get tempData) only if it is the first request with this data - so you have to make "copy" of request that is not yet send by application, you can't replay ones that rely on tempData.
The temp data be stored in the session state and wiped out after first request, so as result it will be invalid/missing if you are not correctly sending it information hand/via Fiddler composer OR (as in your case) making second request with the same information to the same controller.
See also other related questions on the same topic.

Categories