take into account line_items with negative quantity #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes it so that secretariat accepts an invoice like this:
and then turning the invoice item to "-1x 100€", so the resulting e-invoice passes validations.
Also added a small change: invoice_items with an amount of 0 but a non 0 tax rate, e.g.
title: booking, amount: 0€, tax_rate: 19%, tax_amount: 0€
will be sent as having a tax_rate of 0%, otherwise they don't get accepted by the standard as is.
fix #21
Background: Zugferd doesn't allow invoice items with negative amounts; it has no problems with negative amounts for invoices. By accepting an invoice with attributes like "1x -100€" and then turning them into "-1x 100€" we stay standard conformant.
I decided to do it like this, and not make this gem's api expect the "-1x 100€" format because I think this is more straight forward and what most people using this gem will already use internally. But I can switch it around and put the burden on the gem-user if you prefer.
Can be reviewed @halfbyte :)