Page 1 of 1

Setting line DiscountPercentage via API

PostPosted: Wed Sep 30, 2020 5:13 pm
by mike.waugh
Hi

How do we set a SalesOrder line's DiscountPercentage without explicitly setting PriceExGst or DiscountedPrice?

In our own project's code before we patch the order to Jiwa7Api, we set the line's discount like this myJiwaSalesOrderLineObj.DiscountPercentage=15 as we want to have that line's discount to be set to 15%. We do not explicitly set the line's PriceExGst or DiscountedPrice property.

After we patch it, in Jiwa, the line's DiscountPercentage is reset by JiwaApi to 100% and the DiscountedPrice is set to 0.

Thanks.

Re: Setting line DiscountPercentage via API

PostPosted: Wed Sep 30, 2020 5:25 pm
by Mike.Sheen
We don't deserialise the DiscountedPercentage or DiscountGiven properties of the sales order line DTO. We do serialise them out, but when deserialising we require at least one of the following price properties to be set:

  • DiscountedPrice
  • PriceExGst
  • PriceIncGst

DiscountedPercentage and DiscountGiven are ignored.

If you provide both the DiscountedPrice and the PriceExGst or PriceIncGst properties, we'll work out the DiscountPercentage and DiscountGiven properties based on that.