From 5fed17d16680687a2f31b76373898a8f652d0b46 Mon Sep 17 00:00:00 2001 From: Alexander Schillemans Date: Fri, 17 Sep 2021 16:50:46 +0200 Subject: [PATCH] Updated README to specify VATPercentages --- README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c2be54..74fae03 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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.