Skip to content

Commit

Permalink
Fixed a bug related to the dumps envelope
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadsheikhian committed Jun 9, 2019
1 parent 24b8e28 commit 2f99320
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion iso8583/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ def dumps(self):
continue
parts.append(self.elements[i].dumps())

self.bitmap.set(ignore[0])
body = b'%04d%s%s' % (
self.mti,
int(self.mti),
self.bitmap.to_hexstring(),
b''.join(parts)
)
Expand Down
7 changes: 7 additions & 0 deletions iso8583/tests/test_envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ def test_envelope_load_dump():
assert dumped == SAMPLE


def test_envelope_dumps():
mac_key = binascii.unhexlify(MAC_KEY)
envelope = Envelope('0200', mac_key)
envelope.set(24, b'222')
assert b'00390200000001000000000122267863F25F30A06B7' == envelope.dumps()


MAC_KEY = b'1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C1C'
SAMPLE = \
b'027111006030050008E100011662802314007513' \
Expand Down

0 comments on commit 2f99320

Please sign in to comment.