since 2.903 problems checking out to sagePay v3 with a promotion


https://forum.kartris.com/Topic6432.aspx
Print Topic | Close Window

By holtcomp - Fri 15 Apr 2016
Since upgrading to 2.9003 I can't checkout to sagePay v3 if a promotion is present on order.

When I click the final proceed button on checkout.aspx instead of going to sagepay screen it just loops back. If I remove the promotion it works.

I've tried with different promotions and the same thing happens.
By holtcomp - Fri 15 Apr 2016
I have since discovered it's nothing to do wih sagepay, it happens even with invoice payment method.
By Paul - Thu 5 May 2016
We've been looking into this. It seems there is a problem with the XMLserialization of the basket object when promotions are present. The basket BLL was reworked somewhat in 2.9. Ideally the elegant solution would be to identify the issue serializing the promotions, but that's proving difficult.

However there is a good workaround. The primary purpose for serializing the basket object to XML is to store it with the order so that if you edit an order from the back end, Kartris has precise information about the basket contents to restore them - by deserialization the XML. For this purpose, the promotions aren't really required, because it will simply restore the basket items and then the basket logic will apply any promotions that are valid. Since the checkout works fine when there are no promotions, a workaround is to clear promotions from the basket object just prior to where serialization occurs. Add this code into a couple of places:

objBasket.objPromotions.Clear()
objBasket.objPromotionsDiscount.Clear()


In ordersBLL.vb, search for 'Payment.Serialize(objBasket)' - should find it around line 730-740. Just before this 'with' section, add in the two lines.

Also in checkout.aspx.vb, there is this line around 1560:

OrdersBLL.DataUpdate(O_ID, Session("objOrder") & "|||" & Payment.Serialize(objBasket) & "|||" & UC_BasketView.SelectedShippingID)


Add the same two lines just before this.

I've run some test orders and it doesn't seem to cause any problems. The orders now pass, the promotions still show, and if you edit the order in the back end, you can recover the basket fine.