Setting line DiscountPercentage via API

Discussions relating to the REST API of Jiwa 7.

Setting line DiscountPercentage via API

Postby mike.waugh » Wed Sep 30, 2020 5:13 pm

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.
mike.waugh
Occasional Contributor
Occasional Contributor
 
Posts: 10
Joined: Wed Feb 26, 2020 1:36 pm

Re: Setting line DiscountPercentage via API

Postby Mike.Sheen » Wed Sep 30, 2020 5:25 pm

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.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756


Return to REST API

Who is online

Users browsing this forum: No registered users and 1 guest

cron