Skip to content

Commit

Permalink
Merge pull request #39 from invopop/esigibilita
Browse files Browse the repository at this point in the history
Esigibilita dell'IVA
  • Loading branch information
cavalle authored Oct 21, 2024
2 parents f4d4ead + 616d1aa commit ff1b203
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22
toolchain go1.22.5

require (
github.com/invopop/gobl v0.202.0
github.com/invopop/gobl v0.203.0
github.com/invopop/xmldsig v0.8.0
github.com/lestrrat-go/libxml2 v0.0.0-20240521004304-a75c203ac627
github.com/spf13/cobra v1.8.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/invopop/gobl v0.202.0 h1:iUKk7FCKHbEKzuK7qAIxRkZAuh/8g09F9+Ufvs7aWbM=
github.com/invopop/gobl v0.202.0/go.mod h1:DmPohPel8b3ta4nDKnXRNzWQlB89cN74e0/WwPUEZUU=
github.com/invopop/gobl v0.203.0 h1:41aIW+gZfyVcP0G0kz+IX4w8AMSx9EgbnALpn0s9CzA=
github.com/invopop/gobl v0.203.0/go.mod h1:DmPohPel8b3ta4nDKnXRNzWQlB89cN74e0/WwPUEZUU=
github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI=
github.com/invopop/jsonschema v0.12.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
github.com/invopop/validation v0.7.0 h1:NBPLqvYGmLZLQuk5jh0PbaBBetJW7f2VEk/BTWJkGBU=
Expand Down
2 changes: 2 additions & 0 deletions items.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type datiRiepilogo struct {
Natura string `xml:",omitempty"`
ImponibileImporto string
Imposta string
EsigibilitaIVA string `xml:"EsigibilitaIVA,omitempty"`
RiferimentoNormativo string `xml:",omitempty"`
}

Expand Down Expand Up @@ -96,6 +97,7 @@ func generateTaxSummary(inv *bill.Invoice) []*datiRiepilogo {
Natura: exemptExtensionCode(rateTotal.Ext),
ImponibileImporto: formatAmount(&rateTotal.Base),
Imposta: formatAmount(&rateTotal.Amount),
EsigibilitaIVA: rateTotal.Ext[sdi.ExtKeyVATLiability].String(),
RiferimentoNormativo: findRiferimentoNormativo(rateTotal),
})
}
Expand Down
1 change: 1 addition & 0 deletions items_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func TestDatiRiepilogo(t *testing.T) {
dr = doc.FatturaElettronicaBody[0].DatiBeniServizi.DatiRiepilogo[1]

assert.Equal(t, "N2.2", dr.Natura)
assert.Equal(t, "S", dr.EsigibilitaIVA)
assert.Equal(t, "Non soggette - altri casi", dr.RiferimentoNormativo)
})
}
8 changes: 5 additions & 3 deletions test/data/invoice-simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"uuid": "679a2f25-7483-11ec-9722-7ea2cb436ff6",
"dig": {
"alg": "sha256",
"val": "308a3db3311dbfee897317f2d7ce0248613a1863c1a8ef3c48a318126cea37a3"
"val": "8847b795133eae7756b0aa2905df3b065d5f8bde1b8d593ccc988d2196489fc3"
}
},
"doc": {
Expand Down Expand Up @@ -149,7 +149,8 @@
"cat": "VAT",
"rate": "exempt",
"ext": {
"it-sdi-exempt": "N2.2"
"it-sdi-exempt": "N2.2",
"it-sdi-vat-liability": "S"
}
}
],
Expand Down Expand Up @@ -201,7 +202,8 @@
{
"key": "exempt",
"ext": {
"it-sdi-exempt": "N2.2"
"it-sdi-exempt": "N2.2",
"it-sdi-vat-liability": "S"
},
"base": "100.00",
"amount": "0.00"
Expand Down
5 changes: 3 additions & 2 deletions test/data/out/invoice-simple.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
<Natura>N2.2</Natura>
<ImponibileImporto>100.00</ImponibileImporto>
<Imposta>0.00</Imposta>
<EsigibilitaIVA>S</EsigibilitaIVA>
<RiferimentoNormativo>Non soggette - altri casi</RiferimentoNormativo>
</DatiRiepilogo>
</DatiBeniServizi>
Expand All @@ -132,7 +133,7 @@
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512"></ds:DigestMethod>
<ds:DigestValue>afVc/dLmBshNk73aKEWZoEqvj0ori61V31Moy9pRSph1r7o6LP0fc4HAt0oB4BlHE235RinSa511O1/s3Ymylg==</ds:DigestValue>
<ds:DigestValue>kXFHHbaDi8rueCqtC/b3RGTAdhY4juP38/QTO/lSe5P4X4X/NePVKWfr1M7DzHN/vt1FDIn72fauxTbZsK2/hQ==</ds:DigestValue>
</ds:Reference>
<ds:Reference URI="#Certificate-679a2f25-7483-11ec-9722-7ea2cb436ff6">
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512"></ds:DigestMethod>
Expand All @@ -143,7 +144,7 @@
<ds:DigestValue>7Tj/Vr2iDe5KuUvZfrT8ntgjkAtz6zIeztpC/liVkbigGbZLGFHcMpSsVtsRc+WIqqwsB7AwFVjqjSIKIDI3uw==</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue Id="Signature-679a2f25-7483-11ec-9722-7ea2cb436ff6-SignatureValue">eGlesXdqlAmvek6lJ05ZAEh2ahm7Awwi9DdrKr+GzqpFVB2cgjGczxkmpu921URG94h6AiPFIbZNurOC/mEIGlloB74+kXNCn8grC0Ld6PMzqbu9YVOSZGqfHDhJWQUcPucjMIdJt7EbN17YOjLJKJML23o5B/SytHPJU8s+l8ZUMv8Frv+91mCyGbhGNSIDXHAHDfC5hkrqrLbDUFnwMWw7IZKNiRt6akMhFEjMc/st/yrkcUKGiGdVzwhIDsOlTRXERzBn1AwjXtdh8vQt3f/hvXg0NQ1H8GjhwOWP3j8yzlqh4JK4jzUzRlBRyxzy1jXu6BAvv1sh0Ip5cgBrgQ==</ds:SignatureValue>
<ds:SignatureValue Id="Signature-679a2f25-7483-11ec-9722-7ea2cb436ff6-SignatureValue">Wb6DhXTJsVbf7cCG1ByyTtuLs09dUKjisYdIijtfIiiV9XxZ2s5CyaUjhcX98J5uhI2GtZslCOMXaaqCDM1SQa3+xN8MV8KBEa/+pKXmTt9PY0JJws1uYF3fzaGPWTbj82AoXt/d6Fk8oD0I/D+OSvODbaZNnq6+aXojvHmp3r6H15XIhblE3mYS206MJkNRL+mQO2FkzS5/heHWJln3ac5kUJ1dtTlXBst+xqsRsJS2j/6++en5/FsM7mxV4Pka6KKvJ3WXXY8tGwD7OaykJI8yM1+4DjwGP3ndWSj6ahW5yyqPDUnFCHNGptDJdS5AAlGYO4Rf0cw/i/FautfcFw==</ds:SignatureValue>
<ds:KeyInfo Id="Certificate-679a2f25-7483-11ec-9722-7ea2cb436ff6">
<ds:X509Data>
<ds:X509Certificate>MIIHhjCCBm6gAwIBAgIQSOSlyjvRFUlfo/hUFNAvqDANBgkqhkiG9w0BAQsFADBLMQswCQYDVQQGEwJFUzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRkwFwYDVQQDDBBBQyBGTk1UIFVzdWFyaW9zMB4XDTIwMTEwNTEzMDQyMFoXDTI0MTEwNTEzMDQyMFowgYUxCzAJBgNVBAYTAkVTMRgwFgYDVQQFEw9JRENFUy05OTk5OTk5OVIxEDAOBg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