From f5416af1558fa6728590b7b7bf35bd123c59e3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Panu=20Tulim=C3=A4ki?= Date: Sun, 29 May 2016 14:06:27 -0700 Subject: [PATCH 1/2] Encode payment data with utf-8 instead of ascii Refs SHOOP-2586 --- shoop_checkoutfi/checkoutfi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shoop_checkoutfi/checkoutfi.py b/shoop_checkoutfi/checkoutfi.py index c6cd757..5d446b8 100644 --- a/shoop_checkoutfi/checkoutfi.py +++ b/shoop_checkoutfi/checkoutfi.py @@ -299,7 +299,7 @@ def _calculate_payment_md5(self, params, merchant_secret): params["CURRENCY"], params["DEVICE"], params["CONTENT"], params["TYPE"], params["ALGORITHM"], params["DELIVERY_DATE"], params["FIRSTNAME"], params["FAMILYNAME"], params["ADDRESS"], params["POSTCODE"], params["POSTOFFICE"], merchant_secret] - base = join_as_bytes("+", fields) + base = join_as_bytes("+", fields, encoding="utf-8") return hashlib.md5(base).hexdigest().upper() def validate_payment_return(self, mac, version, order_number, order_reference, payment, status, algorithm): @@ -325,6 +325,6 @@ def validate_payment_return(self, mac, version, order_number, order_reference, p GET parameter 'ALGORITHM'. """ fields = [version, order_number, order_reference, payment, status, algorithm] - base = join_as_bytes("&", fields) + base = join_as_bytes("&", fields, encoding="utf-8") key = text_type(self.merchant_secret).encode("ascii") return mac == hmac.new(key, base, hashlib.sha256).hexdigest().upper() From ed4d6c674f15425aad424ed6d49dfc2ec363728a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Panu=20Tulim=C3=A4ki?= Date: Sun, 29 May 2016 14:10:23 -0700 Subject: [PATCH 2/2] Bump version to 0.3.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 16396ea..5a055dd 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ if __name__ == '__main__': setuptools.setup( name="shoop-checkoutfi", - version="0.3.0", + version="0.3.1", description="Shoop Checkout.fi Integration", packages=setuptools.find_packages(), include_package_data=True,