Skip to content

Commit

Permalink
Updated README to specify VATPercentages
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Schillemans committed Sep 17, 2021
1 parent 240d329 commit 5fed17d
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ REDIRECT_URI = 'https://any-url-will-do.com/callback/'
api = ExactOnlineAPI(CLIENTID, CLIENTSECRET)

authUrl = api.authHandler.getAuthURL(REDIRECT_URI)
print(authUrl)
print('visit url: ', authUrl)

response = input('paste response: ')
token = api.authHandler.retrieveToken(response, redirectUri=REDIRECT_URI)
Expand Down Expand Up @@ -176,6 +176,28 @@ exactEntry = api.salesEntries.create(salesEntry)
print(exactEntry.EntryID, exactEntry.InvoiceNumber, exactEntry.AmountDC)
```

## Retrieving VATPercentages

VATCodes have VATPercentages linked to them. By default, these percentages are not given when requesting a list of VAT Codes.

```python
vatCodes = api.vatCodes.list()

for entry in vatCodes.items():
for perc in entry.VATPercentages.items():
# This will contain an empty VATPercentage object
print(vars(perc))
```

To get the VATPercentages for a VATCode, you need to make a new GET request for that specific VATCode. You can then loop over all the available percentages.

```python
entry = api.vatCodes.get(UID)

for perc in entry.VATPercentages.items():
print(vars(perc))
```

## Error handling

Basic error handling has been added.
Expand Down

0 comments on commit 5fed17d

Please sign in to comment.