summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSerghei Mihai <smihai@entrouvert.com>2016-10-25 08:27:07 (GMT)
committerSerghei Mihai <smihai@entrouvert.com>2016-10-25 10:03:38 (GMT)
commit11ba668f42333cc3f595be6a54910992d8f42111 (patch)
treedc21f2a710f8f4c4e6835762723a668467cc4475 /tests
parent0432124e0a93c25a6217c265fabd436c5e4ba9cb (diff)
downloadeopayment-11ba668f42333cc3f595be6a54910992d8f42111.zip
eopayment-11ba668f42333cc3f595be6a54910992d8f42111.tar.gz
eopayment-11ba668f42333cc3f595be6a54910992d8f42111.tar.bz2
ogone: fix response parameters encoding (#13728)v1.16
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ogone.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/test_ogone.py b/tests/test_ogone.py
index ba7e8d7..f13aa6e 100644
--- a/tests/test_ogone.py
+++ b/tests/test_ogone.py
@@ -49,14 +49,30 @@ class OgoneTests(TestCase):
self.assertIn(name, values)
self.assertEqual(node.attrib['value'], values[name])
- def test_response(self):
+ def test_unicode_response(self):
ogone_backend = eopayment.Payment('ogone', BACKEND_PARAMS)
order_id = 'myorder'
- data = {'orderid': order_id + eopayment.common.ORDERID_TRANSACTION_SEPARATOR + 'RtEpMXZn4dX8k1rYbwLlby',
- 'payid': '32100123', 'status': 9, 'ncerror': 0}
+ data = {'orderid': u'myorder', 'status': u'9', 'payid': u'3011229363',
+ 'cn': u'Usér', 'ncerror': u'0',
+ 'trxdate': u'10/24/16', 'acceptance': u'test123',
+ 'currency': u'eur', 'amount': u'7.5',
+ 'shasign': u'3EE0CF69B5A8514962C9CF8A545861F0CA1C6891'}
+ # uniformize to utf-8 first
+ for k in data:
+ data[k] = eopayment.common.force_byte(data[k])
response = ogone_backend.response(urllib.urlencode(data))
+ assert response.signed
self.assertEqual(response.order_id, order_id)
+ def test_iso_8859_1_response(self):
+ ogone_backend = eopayment.Payment('ogone', BACKEND_PARAMS)
+ order_id = 'lRXK4Rl1N2yIR3R5z7Kc'
+ backend_response = 'orderID=lRXK4Rl1N2yIR3R5z7Kc&currency=EUR&amount=7%2E5&PM=CreditCard&ACCEPTANCE=test123&STATUS=9&CARDNO=XXXXXXXXXXXX9999&ED=0118&CN=Miha%EF+Serghe%EF&TRXDATE=10%2F24%2F16&PAYID=3011228911&NCERROR=0&BRAND=MasterCard&IP=80%2E12%2E92%2E47&SHASIGN=435D5E36E1F4B17739C1054FFD204218E65C15AB'
+ response = ogone_backend.response(backend_response)
+ assert response.signed
+ self.assertEqual(response.order_id, order_id)
+
+
def test_bad_response(self):
ogone_backend = eopayment.Payment('ogone', BACKEND_PARAMS)
order_id = 'myorder'