mirror of
https://github.com/pretix/pretix.git
synced 2026-08-07 10:17:49 +00:00
Bankimport: Handle thousand seperator
This commit is contained in:
@@ -65,7 +65,14 @@ def _get_unknown_transactions(event: Event, job: BankImportJob, data: list):
|
||||
|
||||
transactions = []
|
||||
for row in data:
|
||||
amount = amount_pattern.sub("", row['amount'].replace(",", "."))
|
||||
amount = row['amount']
|
||||
if ',' in amount and '.' in amount:
|
||||
# Handle thousand-seperator , or .
|
||||
if amount.find(',') < amount.find('.'):
|
||||
amount = amount.replace(',', '')
|
||||
else:
|
||||
amount = amount.replace('.', '')
|
||||
amount = amount_pattern.sub("", amount.replace(',', '.'))
|
||||
try:
|
||||
amount = Decimal(amount)
|
||||
except:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from datetime import timedelta
|
||||
from decimal import Decimal
|
||||
|
||||
import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
@@ -133,3 +134,17 @@ def test_autocorrection(env, job):
|
||||
}])
|
||||
env[2].refresh_from_db()
|
||||
assert env[2].status == Order.STATUS_PAID
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_huge_amount(env, job):
|
||||
env[2].total = Decimal('23000.00')
|
||||
env[2].save()
|
||||
process_banktransfers(env[0].pk, job, [{
|
||||
'payer': 'Karla Kundin',
|
||||
'reference': 'Bestellung DUMMY12345',
|
||||
'amount': '23.000,00',
|
||||
'date': '2016-01-26',
|
||||
}])
|
||||
env[2].refresh_from_db()
|
||||
assert env[2].status == Order.STATUS_PAID
|
||||
|
||||
Reference in New Issue
Block a user