You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SDK you're using (please complete the following information):
xero-node version: 9.2.0
Node.js version: 16.20.2
Describe the bug
When using unitdp: 4 with line items that have a total amount less than $0.01 and no tax, unexpected validation errors are thrown. This occurs even when the account code and tax type are valid.
☝️ Update: This condition appears to be triggered when the invoice status is set to AUTHORISED. If the invoice is set to DRAFT it is created as expected.
To Reproduce
Steps to reproduce the behavior:
Create a new invoice object with a line item that has the following shape:
{
"Description": "Email messages delivery",
"UnitAmount": 0.001,
"TaxAmount": 0,
"LineAmount": 0,
"Tracking": [],
"Quantity": 2,
"LineItemID": "b5275db3-9817-40d9-9dd4-d50f22ed03d0",
"ValidationErrors": [
{
"Message": "Account must be valid."
},
{
"Message": "Tax rate must be valid."
}
]
}
However, when I change the line item's unitAmount to be "0.1" it works as expected.
Expected behavior
The Xero API and SDK should allow creation of invoices with line items having four decimal places, no tax, and total amounts less than $0.01, without throwing validation errors.
Additional context
Here's a minimal, complete example that reproduces the issue:
Thanks for raising an issue, a ticket has been created to track your request
r0yfire
changed the title
Critical: Invoice creation fails for micro-transactions (< $0.01) with unitdp: 4
Invoice creation fails for micro-transactions (< $0.01) with unitdp: 4
Sep 4, 2024
SDK you're using (please complete the following information):
Describe the bug
When using
unitdp: 4
with line items that have a total amount less than $0.01 and no tax, unexpected validation errors are thrown. This occurs even when the account code and tax type are valid.☝️ Update: This condition appears to be triggered when the invoice status is set to
AUTHORISED
. If the invoice is set toDRAFT
it is created as expected.To Reproduce
Steps to reproduce the behavior:
createInvoices
method and setunitdp: 4
, like so:However, when I change the line item's
unitAmount
to be "0.1" it works as expected.Expected behavior
The Xero API and SDK should allow creation of invoices with line items having four decimal places, no tax, and total amounts less than $0.01, without throwing validation errors.
Additional context
Here's a minimal, complete example that reproduces the issue:
40113
is a "Sales" account type.The text was updated successfully, but these errors were encountered: