Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line total _ does not match the expected line total _ #2

Open
vasaf opened this issue Oct 4, 2023 · 2 comments
Open

Line total _ does not match the expected line total _ #2

vasaf opened this issue Oct 4, 2023 · 2 comments

Comments

@vasaf
Copy link

vasaf commented Oct 4, 2023

Hey Leslie,

Thanks for this, very much appreciated.

I find that a lot of my invoices can't be voided as I keep hitting an error such as The line total 2098.30 does not match the expected line total 2098.36.

No payments have been applied to these invoices.

I thought perhaps the CSV exported by Xero had some mismatched totals, but after taking a look at your code and the Xero API documentation, I can see only the invoice number and status is being posted in the API call.

Have you happened to run into an issue like this? I have no issues deleting these invoices manually. 🤦‍♂️

Thanks!

@vasaf
Copy link
Author

vasaf commented Oct 5, 2023

Managed to fix this.

In my case:

The errors are occurring due to a validation being performed, the invoices in question have a discount on some line items, this is being validated against the DiscountRate field (instead of the DiscountAmount field) as such the rounding is different.

To workaround the issue:

  1. Make a GET call to the invoices endpoint to retrieve the invoice.
  2. From each LineItem change the "DiscountRate" field to 0
  3. Update the status to "VOIDED"
  4. Make a POST call to update the invoice

I'll make a PR once I clean up some code..

@leslie-alldridge
Copy link
Owner

Awesome I look forward to it, thanks for the investigation 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants