Commit 991950c5 authored by Łukasz Nowak's avatar Łukasz Nowak

Simplify calculation and reformat dates.

Dates in signature have to be in %Y%m%d format.

Note: Signatures still do not match.
parent bb4db5fe
......@@ -42,11 +42,17 @@ else:
'refundDevise', 'timestamp']
signature = ''
for k in received_sorted_keys:
v = getattr(data, k, None)
if v is not None:
signature += str(v) + '+'
try:
v = getattr(data, k)
except AttributeError:
pass
else:
signature += '+'
if k in ['transmissionDate', 'presentationDate', 'cardExpirationDate',
'markDate', 'authDate', 'captureDate']:
# crazyiness again
v = time.strftime('%Y%m%d', time.strptime(str(v), '%Y-%m-%d %H:%M:%S'))
v = str(v)
signature += v + '+'
signature += self.getServicePassword()
signature = hashlib.sha1(signature).hexdigest()
return signature == data.signature
......
25
\ No newline at end of file
26
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment