Skip to content

Commit

Permalink
Additional test case for EN16931 rate key with reverse charge
Browse files Browse the repository at this point in the history
  • Loading branch information
samlown committed Oct 25, 2024
1 parent c8f364b commit e59a696
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions addons/eu/en16931/tax_combo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,28 @@ func TestTaxComboNormalization(t *testing.T) {
func TestTaxComboValidation(t *testing.T) {
ad := tax.AddonForKey(en16931.V2017)
t.Run("standard VAT rate", func(t *testing.T) {
p := num.MakePercentage(19, 2)
c := &tax.Combo{
Category: tax.CategoryVAT,
Rate: tax.RateStandard,
Percent: &p,
Percent: num.NewPercentage(19, 2),
}
ad.Normalizer(c)
assert.NoError(t, ad.Validator(c))
assert.Equal(t, "S", c.Ext[untdid.ExtKeyTaxCategory].String())
assert.Equal(t, "19%", c.Percent.String())
})

t.Run("exempt reverse charge", func(t *testing.T) {
c := &tax.Combo{
Category: tax.CategoryVAT,
Rate: tax.RateExempt.With(tax.TagReverseCharge),
}
ad.Normalizer(c)
assert.NoError(t, ad.Validator(c))
assert.Equal(t, "AE", c.Ext[untdid.ExtKeyTaxCategory].String())
assert.Nil(t, c.Percent)
})

t.Run("nil", func(t *testing.T) {
var tc *tax.Combo
err := ad.Validator(tc)
Expand Down

0 comments on commit e59a696

Please sign in to comment.