Skip to content

Commit 8b8dd06

Browse files
committed
fix: redundant imports
1 parent 86cc035 commit 8b8dd06

File tree

3 files changed

+37
-15
lines changed

3 files changed

+37
-15
lines changed

README.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ Fiscguy provides the following REST API endpoints:
153153

154154
#### Example API Requests
155155

156-
**Open a Fiscal Day:**
157-
```bash
158-
curl -X POST http://localhost:8000/api/open_day/ \
159-
-H "Content-Type: application/json"
160-
```
156+
## Notes on Credit and Debit Notes
157+
158+
- A person can also submit a credit note.
159+
- Debit notes are not mandatory.
160+
- A credit note can have negative values.
161161

162162
**Submit a Receipt:**
163163
```bash
@@ -179,6 +179,32 @@ curl -X POST http://localhost:8000/api/receipts/ \
179179
}'
180180
```
181181

182+
**Submit a Credit Note:**
183+
```bash
184+
curl -X POST http://localhost:8000/api/receipts/ \
185+
-H "Content-Type: application/json" \
186+
-d '{
187+
"receipt_type": "creditnote",
188+
"currency": "USD",
189+
"total_amount": "-100.00",
190+
"payment_terms": "cash",
191+
"lines": [
192+
{
193+
"product": "Test Item",
194+
"quantity": 1,
195+
"unit_price": "-100.00",
196+
"tax_name": "standard rated 15.5%"
197+
}
198+
]
199+
}'
200+
```
201+
202+
**Open a Fiscal Day:**
203+
```bash
204+
curl -X POST http://localhost:8000/api/open_day/ \
205+
-H "Content-Type: application/json"
206+
```
207+
182208
**Get Device Status:**
183209
```bash
184210
curl -X GET http://localhost:8000/api/status/ \

fiscguy/management/commands/init_device.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from django.db import transaction
77
from loguru import logger
88

9-
from fiscguy.models import Certs, Configuration, Device, Taxes
9+
from fiscguy.models import Certs, Device, Taxes
1010
from fiscguy.zimra_crypto import ZIMRACrypto
1111
from fiscguy.services.configuration_service import create_or_update_config
1212

@@ -275,8 +275,6 @@ def get_config(
275275
cert_path = temp_dir / "client_cert.pem"
276276
key_path = temp_dir / "client_key.pem"
277277

278-
from fiscguy.models import Certs
279-
280278
cert = Certs.objects.first()
281279
cert_path.write_text(cert.certificate)
282280
key_path.write_text(cert.certificate_key)
@@ -291,9 +289,10 @@ def get_config(
291289
response.raise_for_status()
292290
res = response.json()
293291

292+
# config business
294293
create_or_update_config(res)
294+
295295
logger.info(f"Configuration for device {device_id} updated successfully.")
296-
return res
297296
except requests.RequestException as e:
298297
logger.error(f"Error fetching config: {e}")
299298
return None
@@ -311,9 +310,8 @@ def register_device(
311310
if env
312311
else f"https://fdmsapitest.zimra.co.zw/Public/v1/{device_id}"
313312
)
314-
print(csr)
315-
csr = csr.replace("\n", "")
316-
print(csr)
313+
314+
csr = csr.replace("\n", "") # remove newline escape charaters
317315

318316
payload = {
319317
"activationKey": activation_key,
@@ -338,8 +336,6 @@ def register_device(
338336
signed_certificate = response.json().get("certificate")
339337

340338
if signed_certificate:
341-
from fiscguy.models import Certs
342-
343339
cert = Certs.objects.first()
344340
cert.certificate = signed_certificate
345341
cert.save()

fiscguy/zimra_crypto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def generate_key_and_csr(device_sn: str, device_id: int, env: bool = True):
271271
csr_request = crypto.X509Req()
272272
subject = csr_request.get_subject()
273273

274-
# Subject fields (ZIMRA style)
274+
# Subject fields ZIMRA way
275275
subject.C = "ZW"
276276
subject.ST = "Zimbabwe"
277277
subject.L = "Harare"

0 commit comments

Comments
 (0)