Skip to content

Commit

Permalink
Don't set AllowanceTotalAmount and ChargeTotalAmount if zero
Browse files Browse the repository at this point in the history
  • Loading branch information
printesoi committed Apr 2, 2024
1 parent fee4f72 commit 2be8105
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,13 +782,17 @@ func (b InvoiceBuilder) Build() (retInvoice Invoice, err error) {
Amount: lineExtensionAmount,
CurrencyID: b.documentCurrencyID,
}
invoice.LegalMonetaryTotal.AllowanceTotalAmount = &AmountWithCurrency{
Amount: allowanceTotalAmount,
CurrencyID: b.documentCurrencyID,
if !allowanceTotalAmount.IsZero() {
invoice.LegalMonetaryTotal.AllowanceTotalAmount = &AmountWithCurrency{
Amount: allowanceTotalAmount,
CurrencyID: b.documentCurrencyID,
}
}
invoice.LegalMonetaryTotal.ChargeTotalAmount = &AmountWithCurrency{
Amount: chargeTotalAmount,
CurrencyID: b.documentCurrencyID,
if !chargeTotalAmount.IsZero() {
invoice.LegalMonetaryTotal.ChargeTotalAmount = &AmountWithCurrency{
Amount: chargeTotalAmount,
CurrencyID: b.documentCurrencyID,
}
}
invoice.LegalMonetaryTotal.TaxExclusiveAmount = AmountWithCurrency{
Amount: taxExclusiveAmount,
Expand Down

0 comments on commit 2be8105

Please sign in to comment.