Skip to content

Commit 0906deb

Browse files
committed
feat: add support for other tax special categories
1 parent 194c24e commit 0906deb

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

src/ksef/models/invoice_rows.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,48 @@
11
"""Models for individual invoice rows/positions."""
22

3-
from typing import Sequence
3+
from typing import Literal, Sequence
44

55
from pydantic import BaseModel
66

7+
# KSeF tax rate constants for the P_12 field (TStawkaPodatku in FA(3) schema)
8+
TAX_23 = 23
9+
TAX_22 = 22
10+
TAX_8 = 8
11+
TAX_7 = 7
12+
TAX_5 = 5
13+
TAX_4 = 4
14+
TAX_3 = 3
15+
TAX_0_KR = "0 KR" # 0% domestic
16+
TAX_0_WDT = "0 WDT" # 0% intra-Community supply
17+
TAX_0_EX = "0 EX" # 0% export of goods
18+
TAX_ZW = "zw" # exempt from tax
19+
TAX_OO = "oo" # reverse charge
20+
TAX_NP_I = "np I" # not subject to taxation — supply outside country territory
21+
TAX_NP_II = "np II" # not subject to taxation — services per art. 100(1)(4)
22+
23+
TaxRate = Literal[
24+
23,
25+
22,
26+
8,
27+
7,
28+
5,
29+
4,
30+
3,
31+
"0 KR",
32+
"0 WDT",
33+
"0 EX",
34+
"zw",
35+
"oo",
36+
"np I",
37+
"np II",
38+
]
39+
740

841
class InvoiceRow(BaseModel):
942
"""Single individual invoice position."""
1043

1144
name: str # P_7, nazwa (rodzaj) towaru lub usługi
12-
tax: int # P_12, stawka podatku
45+
tax: TaxRate # P_12, tax rate
1346

1447

1548
class InvoiceRows(BaseModel):

0 commit comments

Comments
 (0)