Complete get_tax_rate() method on EUVAT class
This commit is contained in:
parent
054df92134
commit
eec28e2697
1 changed files with 9 additions and 2 deletions
|
@ -71,8 +71,6 @@ class EUVAT:
|
|||
|
||||
return cls(COUNTRIES, COMMENTS)
|
||||
|
||||
|
||||
|
||||
@classmethod
|
||||
def from_net(cls, date=datetime.today().date()):
|
||||
payload = dict()
|
||||
|
@ -96,3 +94,12 @@ class EUVAT:
|
|||
xlsx = urlopen(EXPORT_URL, urlencode(payload).encode()).read()
|
||||
|
||||
return cls.from_excel(BytesIO(xlsx))
|
||||
|
||||
def get_tax_rate(self, country, category="E-Services", ratetype="STANDARD", default=Decimal(0), fallback=True):
|
||||
for c in self.countries:
|
||||
if country in (c.name, c.code):
|
||||
if rate := c.get_tax_rate(category, ratetype, fallback):
|
||||
return rate
|
||||
break
|
||||
|
||||
return default
|
Loading…
Reference in a new issue