Xero-OpenAPI icon indicating copy to clipboard operation
Xero-OpenAPI copied to clipboard

LineItem: Setting a DiscountAmount of 0 on a negative UnitAmount results in validation error

Open timwiel opened this issue 4 years ago • 0 comments

If via the API you post a new invoice with a DiscountAmount of 0 when the UnitAmount is negative a validation error occurs:

The discount rate '0.00' is invalid. Discount must not be greater than the line total.

However when setting a DiscountRate of 0 when the UnitAmount is negative no validation error occurs.

Expected Behavior

As a DiscountAmount of 0 actually is the same as a DiscountRate of 0 the API should allow the 0 amount to be submitted and accepted.

Also if a DiscountAmount higher than 0 on a negative UnitAmount is not allowed then why can invoices in the Xero Application with negative UnitAmounts allow DiscountRates to be added to them. Surely this should also match in the API but this could be another issue.

Note: A validation error is generated in both API explorer and via xeroapi/xero-php-oauth2 so it is the API that has the issue

timwiel avatar Jul 02 '21 04:07 timwiel