Developer forum

Forum » Development » CheckoutHandlers - GatewayResult is cleared

CheckoutHandlers - GatewayResult is cleared

Diogo Lino
Reply

Hello,

When creating a Checkout handler, on the Redirect function, I need to store a GatewayResult xml received from a webservice.

I tried to change the order before and after the SetOrderComplete() call but with no success.

        public override string Redirect(Order order)
        {
                /* if I set GatewayResult here, the SetOrderComplete() cleans it */

                SetOrderComplete(order);

                order.GatewayResult = "some result string here"
                order.Save();

                // Checkout done
                CheckoutDone(order);

                /* here the order has the GatewayResult value but after calling RedirectToCart() it cleans it and saves "<result />" string */

                // Redirect to cart
                RedirectToCart(order);

        }

 

How can I save the gateway result on the order?

 

Thanks,

Diogo


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
This post has been marked as an answer

Hi Diogo,

 

After you set GatewayResult on the order, you need to call order.UpdateGatewayResult() rather than Save(). The Save method does not actually persist the GatewayResult, only UpdateGatewayResult does that. This method also has an overload which you can call, if you want to be explicit, however it doesn't really matter. The Order will not be reverted to "Not Complete" if you specify "False" or use the overload without parameters.

 

Hope this helps :)

 

- Jeppe

Votes for this answer: 1

 

You must be logged in to post in the forum