Skip to content

Commit

Permalink
Merge pull request #18 from wirelane/feature/add_extended_error_code
Browse files Browse the repository at this point in the history
add extended_error_code + bump version
  • Loading branch information
curdbecker authored Oct 15, 2024
2 parents 662bc81 + 9934afe commit f179162
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ecrterm/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.7'
__version__ = '1.0.8'
1 change: 1 addition & 0 deletions ecrterm/packets/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ def __get__(self, instance, objtype=None) -> TLV:
0x1f00: BEIntField(name='file_size', length=4),
0x1f10: FlagByteField(name="cardholder_identification", data_type=CardholderIdentification),
0x1f11: FlagByteField(name='online_tag', data_type=OnlineTag),
0x1F16: BCDVariableLengthField(name="extended_error_code"),
0x1F17: StringField(name="extended_error_text", character_set=CharacterSet.ZVT_8BIT),
0x1F40: StringField(name="device_name", character_set=CharacterSet.ASCII_7BIT),
0x1F41: StringField(name="software_version", character_set=CharacterSet.ASCII_7BIT),
Expand Down
24 changes: 24 additions & 0 deletions ecrterm/tests/test_parsing_abort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from unittest import TestCase, main

from ecrterm.ecr import parse_represented_data
from ecrterm.packets.base_packets import Abort


class TestParsingAbort(TestCase):

def test_abort_by_external_command(self):
packet = '061e2e6c062b1f1605ff000014411f1720416262727563682064757263682065787465726e6573204b6f6d6d616e646f21'
parsed = parse_represented_data(packet)

print(parsed)

self.assertIsInstance(parsed, Abort)
self.assertEqual(108, parsed.result_code)
tlv = parsed.get('tlv')
self.assertIsNotNone(tlv)
extended_error_code = tlv.get_value('extended_error_code')
self.assertEqual('ff00001441', extended_error_code)


if __name__ == '__main__':
main()

0 comments on commit f179162

Please sign in to comment.