Developer forum

Forum » Integration » LiveIntegration v1, NAV and GiftCards

LiveIntegration v1, NAV and GiftCards

Kenneth Radoor


We have a shop where it is posible to buy a giftcard at any amount > 200.

When a customer buys a giftcard we have to change the OrderLineType (in ProcessResponse) to OrderLineType.GiftCard, otherwise it will not be created in DW. 

So far so good, it seems to work and the order gets created both in DW and in NAV.

The problem is when the Customer wants to redeem the giftcard, then we get some strange behaivor.

We have enabled the "LiveSalesDiscountProvider", so when we submit the order with the giftcard-code the ordertotal is subtracted with the right amount.

If we then update the order, we get the one more orderline with the giftcard as a product and as a discount.

We havn't been able to find any documentation or advice on how to handle this in a best practice way, so please advice !!

We are using a pretty standard LiveIntegration v1, and are looking for sample code or stuff like that, on how to handle this senario in DW and in NAV.

Regards and thanks in advance



Dmitriy Benyuk

Hi Kenneth,
You can try to made some changes in the OrderHandler.cs ProcessResponse method:
order.DisableDiscountCalculation = true;
after the line:
order.AllowOverridePrices = true;

Best regards, Dmitrij

Kenneth Radoor

Hi Dmitrij

That didn't help :(

The thing is that DW has to handle the Giftcard, and send the info to NAV. 

I can see that when a giftcard is redeemed, it is created as a orderdiscount, so my thought is that it would be send this discount as an orderline to NAV. Then the order gets calculated in NAV and it looks ok.

As we are using a single step cart, it is posible to change the amount of products to be purchased. if we change the amount then the orderdiscount disappears from the cart and the database.
But it is stille send via the xml to NAV, thats wierd.

Another problem is that we have an "apply button" below the giftcardcode field, and would like to have the cart updated when its clicked. That works fine for the DW part, but as there is no notification we can hook into, the order is not sent to NAV, unless we do something that trickers the LiveIntegration to run.
In this case i have added observers for AfterPaymentMethodIsChanged and AfterShippingMethodIsChanged, so entering a giftcardcode and changing eg. the paymentmethod does the trick. But just entering a giftcardcode does nothing.

I have tried different other notifications but can't find any that is usefull, my best guess would be AfterDefaultPropertiesValueIsChanged and then check for propertyname "GiftCardCode", but it does'nt do anything.

I need advice on what to do in the LiveIntegration code, to send the proper data to NAV, and what changed that needs to be done in the NAV codeunit, so that i can advise the NAV-consultant on what to do.

Any suggestions will be much appriciated.

I have attached the OrderHandler from my project, and if you like i can send you the complete project. All additions i have made to the code is enclosed in a regions called CustomCodes, and there is a few comments on why they are there

Regards Kenneth


You must be logged in to post in the forum