Private
Public Access
1
0
This commit is contained in:
2024-12-26 15:23:09 +01:00
parent 275b5f382a
commit dd14f1eef7
4 changed files with 8 additions and 3 deletions

View File

@@ -37,9 +37,11 @@ def get_country_id(code):
def idoklad_token():
try:
token = iDokladToken.objects.get(id=1)
token = iDokladToken.objects.all().order_by('-updated_at')[0]
except iDokladToken.DoesNotExist:
return None
except KeyError:
return None
if token.updated_at + datetime.timedelta(seconds=token.expires_in) < timezone.now():
headers = {
@@ -189,6 +191,7 @@ def create_invoice(rower, amount, braintreeid, dosend=True, contact_id=None, nam
post_data['ItemsTextSuffix'] = 'This invoice was already paid. Please do not pay it again.'
post_data['Items'][0]['VatRate'] = 0.0
post_data['Items'][0]['VatRateType'] = 2
post_data['Items'][0]['PaymentOptionId'] = 2
post_data['Items'][0]['VatCodeId'] = 3
post_data['CurrencyId'] = 2
post_data['ReportLanguage'] = 3