ogone: use force_text

This commit is contained in:
Frédéric Péters 2018-03-26 10:11:52 +02:00
parent c028af586b
commit fd6566a4ca
1 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import hashlib
import string
import six
from six.moves.urllib import parse as urlparse
from decimal import Decimal, ROUND_HALF_UP
@ -499,7 +500,7 @@ class Payment(PaymentCommon):
# arrondi comptable francais
amount = amount.quantize(Decimal('1.'), rounding=ROUND_HALF_UP)
params = {
'AMOUNT': unicode(amount),
'AMOUNT': force_text(amount),
'ORDERID': reference,
'PSPID': self.pspid,
'LANGUAGE': language,
@ -533,7 +534,10 @@ class Payment(PaymentCommon):
return reference, FORM, form
def response(self, query_string, **kwargs):
params = urlparse.parse_qs(query_string, True)
if six.PY3:
params = urlparse.parse_qs(query_string, True, encoding='iso-8859-1')
else:
params = urlparse.parse_qs(query_string, True)
params = dict((key.upper(), params[key][0]) for key in params)
if not set(params) >= set(['ORDERID', 'PAYID', 'STATUS', 'NCERROR']):
raise ResponseError()