Developer forum

Forum » Development » Checkout handler post callback (again)

Checkout handler post callback (again)

Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

We experience the same problems as described here:
http://doc.dynamicweb.com/forum/development/checkout-handler-post-callback?PID=1605

The payment provider return a POST request to the callback URL. But when we try to retrieve data from Request.InputStream, in the Redirect(Order order) override method, inside the CheckoutHandler, the body is null.

If we handle the callback ourselves through a NotificationSubscriber, we do get access to the data in the Request.InputStream. But we do not want to go this way, since we would rather use the order methods inside the base class of CheckoutHandler.

Nicolai's suggestion to use Redirect=false did not work either, we thought that was fixed in a later hot fix, since the post was from 2019, but that might not be the case?

Do you have any other good suggestions?


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Martin,

It's strange that the InputStream should be null in the CheckoutHandler if it's not null at another point in the request lifecycle.However, it's difficult to determine what's going on just from this description. So, can you provide a little more information?

  • Which version of Dynamicweb are you using?
    Specifically, the Dynamicweb.Ecommerce package.
  • Are you able to get the Request.InputStream in any notification subscriber or are you using a specific one, e.g., PageLoad?
  • Are you using Dynamicweb.Context.Current.Request.InputStream?
    If so, do you get anything using System.Web.HttpContext.Current.Request.InputStream instead?

- Jeppe

 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

Hi Jeppe, thanks for your reply!

  • Using DW9.10 with Dynamicweb.Ecommerce 1.10.2
  • NotificationSubscriber on [Subscribe(Standard.Application.AuthenticateRequest)] receives the request as a POST request. 
    But when public override string Redirect(Order order) on the CheckoutHandler is hit the request is changed to a GET request with all body data removed.
  • Both contexts give the same result.
 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Martin,

I've tried to reproduce the issue locally, and I can't get into a fail state when adhering to all the given information. Most scenarios work as expected: POST with a multi-part body and with a form-urlencoded. Even if I post a file along with the payment information, everything works as expected. Even without "redirect=false".

I can only reproduce a similar result to yours if the url is formatted like this: "/Default.aspx?ID=<ID>&..." and the "redirect=false" parameter is omitted and the POST request has Content-Type = "application/octet-stream". If the url is using the friendly url format, I can't get it to fail at all.

I would suspect the flow of the failing case is similar to this:

  1. The gateway makes a POST request to Dynamicweb
  2. Dynamicweb returns a response of 200 - OK, and not a 301 (redirect to friendly url) as expected
  3. The gateway accepts this as acknowledgement of the transaction
  4. The gateway redirects the user
  5. The CheckoutHandler is triggered by the redirect which is a GET without an InputStream

This only thing I can think of is that the gateway doesn't send the "redirect=false" as part of the querystring, and, since the Content-Type is binary, there are no form fields which effectively means that the "redirect=false" parameter is left out.

There's not much more I can think to try, so if this doesn't lead to a solution, you have to create a  support case to get the issue investigated further.

- Jeppe

 

You must be logged in to post in the forum