mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Fixed #119 -- Explicitly set decimal rounding mode
This commit is contained in:
@@ -3,6 +3,8 @@ import tempfile
|
||||
import time
|
||||
from decimal import Decimal
|
||||
|
||||
from pretix.base.decimal import round_decimal
|
||||
|
||||
|
||||
def hbci_transactions(event, conf):
|
||||
try:
|
||||
@@ -92,7 +94,7 @@ def hbci_transactions(event, conf):
|
||||
num = int(parts[0])
|
||||
denom = int(parts[1])
|
||||
value = Decimal(num) / Decimal(denom)
|
||||
value = str(value.quantize(Decimal('.01')))
|
||||
value = str(round_decimal(value))
|
||||
data.append({
|
||||
'payer': "\n".join(payer),
|
||||
'reference': trans.find('purpose').find('value').text,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import io
|
||||
from decimal import Decimal
|
||||
|
||||
import mt940
|
||||
|
||||
from pretix.base.decimal import round_decimal
|
||||
|
||||
|
||||
def parse(file):
|
||||
data = file.read()
|
||||
@@ -20,7 +21,7 @@ def parse(file):
|
||||
'reference': "\n".join([
|
||||
t.data.get(f) for f in ('transaction_details', 'customer_reference', 'bank_reference',
|
||||
'extra_details') if t.data.get(f, '')]),
|
||||
'amount': str(t.data['amount'].amount.quantize(Decimal('.01'))),
|
||||
'amount': str(round_decimal(t.data['amount'].amount)),
|
||||
'date': t.data['date'].isoformat()
|
||||
})
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user