stackin-python-sdk 0.8.0__tar.gz → 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stackin-python-sdk
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: Python SDK for issuing, consulting and cancelling electronic invoices.
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -137,7 +137,7 @@ invoice = client.issue(
137
137
  document_type=DocumentType.NFSE,
138
138
  client_name="John Doe",
139
139
  tax_id="00000000000",
140
- items=[Product(description="Software development", amount=5000.00)],
140
+ items=[Product(description="Software development", unit_price=Decimal("5000.00"))],
141
141
  )
142
142
 
143
143
  status = client.consult("ACCESS_KEY...", document_type=DocumentType.NFSE)
@@ -194,13 +194,15 @@ burned, and undoing it means cancelling, which has a deadline.
194
194
  Pass `idempotency_key` to make the retry safe:
195
195
 
196
196
  ```python
197
+ from decimal import Decimal
198
+
197
199
  key = str(uuid.uuid4())
198
200
 
199
201
  result = invoice.issue(
200
202
  document_type=DocumentType.NFSE,
201
203
  client_name="Maria Silva",
202
204
  tax_id="12345678909",
203
- items=[Product(description="Consultoria", amount=1500.00)],
205
+ items=[Product(description="Consultoria", unit_price=Decimal("1500.00"))],
204
206
  idempotency_key=key,
205
207
  )
206
208
  ```
@@ -108,7 +108,7 @@ invoice = client.issue(
108
108
  document_type=DocumentType.NFSE,
109
109
  client_name="John Doe",
110
110
  tax_id="00000000000",
111
- items=[Product(description="Software development", amount=5000.00)],
111
+ items=[Product(description="Software development", unit_price=Decimal("5000.00"))],
112
112
  )
113
113
 
114
114
  status = client.consult("ACCESS_KEY...", document_type=DocumentType.NFSE)
@@ -165,13 +165,15 @@ burned, and undoing it means cancelling, which has a deadline.
165
165
  Pass `idempotency_key` to make the retry safe:
166
166
 
167
167
  ```python
168
+ from decimal import Decimal
169
+
168
170
  key = str(uuid.uuid4())
169
171
 
170
172
  result = invoice.issue(
171
173
  document_type=DocumentType.NFSE,
172
174
  client_name="Maria Silva",
173
175
  tax_id="12345678909",
174
- items=[Product(description="Consultoria", amount=1500.00)],
176
+ items=[Product(description="Consultoria", unit_price=Decimal("1500.00"))],
175
177
  idempotency_key=key,
176
178
  )
177
179
  ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "stackin-python-sdk"
3
- version = "0.8.0"
3
+ version = "0.9.0"
4
4
  authors = [
5
5
  { name = "Fernando Celmer", email = "email@fernandocelmer.com" },
6
6
  ]
@@ -45,7 +45,7 @@ Changelog = "https://github.com/stackin-io/stackin-python-sdk/releases"
45
45
 
46
46
  [tool.poetry]
47
47
  name = "stackin-python-sdk"
48
- version = "0.8.0"
48
+ version = "0.9.0"
49
49
  description = "Python SDK for issuing, consulting and cancelling electronic invoices."
50
50
  authors = ["Fernando Celmer <email@fernandocelmer.com>"]
51
51
  readme = "README.md"
@@ -1,6 +1,6 @@
1
1
  """Invoice __init__ module."""
2
2
 
3
- __version__ = "0.8.0"
3
+ __version__ = "0.9.0"
4
4
  __description__ = (
5
5
  "Python SDK for issuing, consulting and cancelling electronic invoices."
6
6
  )
@@ -1,6 +1,6 @@
1
1
  """Brazil-specific document fields."""
2
2
 
3
- from stackin.br.product import PresumedCredit, Product
3
+ from stackin.br.product import IbsCbs, PresumedCredit, Product
4
4
  from stackin.br.tax import (
5
5
  CofinsAliq,
6
6
  CofinsNt,
@@ -42,6 +42,7 @@ from stackin.br.tax import (
42
42
 
43
43
  __all__ = [
44
44
  "Product",
45
+ "IbsCbs",
45
46
  "PresumedCredit",
46
47
  "Tax",
47
48
  "Icms00",
@@ -10,6 +10,17 @@ from pydantic import BaseModel, Field
10
10
  from stackin.br.tax import Tax
11
11
 
12
12
 
13
+ class IbsCbs(BaseModel):
14
+ """The Reforma Tributária group for one item."""
15
+
16
+ cst: str = Field(pattern=r"^\d{3}$")
17
+ classification: str = Field(pattern=r"^\d{6}$")
18
+ base: float | None = Field(default=None, gt=0)
19
+ rate_state: float = Field(ge=0)
20
+ rate_city: float = Field(ge=0)
21
+ rate_federal: float = Field(ge=0)
22
+
23
+
13
24
  class PresumedCredit(BaseModel):
14
25
  """A presumed tax credit applied to this item."""
15
26
 
@@ -33,6 +44,7 @@ _BR_FIELDS = {
33
44
  "import_content_control_number",
34
45
  "recopi_number",
35
46
  "extra_groups",
47
+ "ibs_cbs",
36
48
  "tax",
37
49
  }
38
50
 
@@ -80,6 +92,7 @@ class Product(BaseModel):
80
92
  ),
81
93
  )
82
94
  recopi_number: str | None = Field(default=None, pattern=r"^\d{20}$")
95
+ ibs_cbs: IbsCbs | None = Field(default=None)
83
96
  extra_groups: dict[str, Any] | None = Field(default=None)
84
97
  tax: Tax | dict[str, Any] | None = Field(default=None)
85
98