Skip to content

Commit

Permalink
Merge pull request #3 from tulimaki/fix-unicode-problems
Browse files Browse the repository at this point in the history
Fix unicode problems (SHOOP-2586)
  • Loading branch information
Pikkupomo committed May 29, 2016
2 parents f98a84c + ed4d6c6 commit 6033f03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions shoop_checkoutfi/checkoutfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()

0 comments on commit 6033f03

Please sign in to comment.