Commit 83bff170 authored by Łukasz Nowak's avatar Łukasz Nowak

Checkpoint: signature matches.

Non transmitted values shall result in ++
Empty (evaluated to None) values shall result in ++
parent ee7550e6
...@@ -47,7 +47,8 @@ else: ...@@ -47,7 +47,8 @@ else:
try: try:
v = getattr(data, k) v = getattr(data, k)
except AttributeError: except AttributeError:
pass # not transmitted: just add +
signature += '+'
else: else:
if k in ['transmissionDate', 'presentationDate', 'cardExpirationDate', if k in ['transmissionDate', 'presentationDate', 'cardExpirationDate',
'markDate', 'authDate', 'captureDate']: 'markDate', 'authDate', 'captureDate']:
...@@ -55,8 +56,13 @@ else: ...@@ -55,8 +56,13 @@ else:
if isinstance(v, datetime.datetime): if isinstance(v, datetime.datetime):
v = v.strftime('%Y%m%d') v = v.strftime('%Y%m%d')
else: else:
v = time.strftime('%Y%m%d', time.strptime(str(v), '%Y-%m-%d %H:%M:%S')) v = time.strftime('%Y%m%d', time.strptime(str(v),
'%Y-%m-%d %H:%M:%S'))
if v is not None:
v = str(v) v = str(v)
else:
# empty transmitted: just add +
v = ''
signature += v + '+' signature += v + '+'
signature += self.getServicePassword() signature += self.getServicePassword()
signature = hashlib.sha1(signature).hexdigest() signature = hashlib.sha1(signature).hexdigest()
......
32 33
\ No newline at end of file \ 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