From 3b3f63907d7ba309b55e69c5eeda38076664de95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 16 Feb 2016 20:38:03 +0100 Subject: [PATCH] sips2: fix seal check (#10008) --- eopayment/sips2.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eopayment/sips2.py b/eopayment/sips2.py index c9ac20a..71896a2 100644 --- a/eopayment/sips2.py +++ b/eopayment/sips2.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import collections import urlparse import string from decimal import Decimal @@ -126,7 +127,7 @@ class Payment(PaymentCommon): return s def get_data(self): - data = {} + data = collections.OrderedDict() data['merchantId'] = self.merchand_id data['keyVersion'] = self.key_version data['normalReturnUrl'] = self.normal_return_url @@ -180,7 +181,7 @@ class Payment(PaymentCommon): def decode_data(self, data): data = data.split('|') data = [map(unicode, p.split('=')) for p in data] - return dict(data) + return collections.OrderedDict(data) def check_seal(self, data, seal): return seal == self.seal_data(data) @@ -197,7 +198,7 @@ class Payment(PaymentCommon): assert 'Seal' in form assert 'InterfaceVersion' in form data = self.decode_data(form['Data'][0]) - seal = form['Seal'] + seal = form['Seal'][0] self.logger.debug('parsed response %r seal %r', data, seal) signed = self.check_seal(data, seal) response_code = data['responseCode']