Skip to content

Commit

Permalink
Parse MTIs other than 0300.
Browse files Browse the repository at this point in the history
  • Loading branch information
xclud committed Jun 10, 2024
1 parent 0b252bb commit c4fe58e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.4

* Parse MTIs other than 0300.

## 0.3.3

* Cleanup ISO-9797 code.
Expand Down
6 changes: 5 additions & 1 deletion lib/src/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ class Message {

/// Parses a [Message] from the input byte-array.
factory Message.parse(Uint8List data) {
final mti = hex.encode(data.take(2).toList()).toUpperCase();

final bitmap = data.sublist(2, 10);
final hexmap = hex.encode(bitmap);
final v = int.parse(hexmap, radix: 16);
final pb = v.toRadixString(2).padLeft(64, '0');
final message = Message('0300');
final message = Message(mti);

final parser = _MessageParser(data);

Expand Down Expand Up @@ -273,6 +275,8 @@ class Message {
Map<String, Object> toJson() {
final map = <String, Object>{};

map['MTI'] = mti;

for (var i = 1; i <= 64; i++) {
final f = _data[i];

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pos
description: Dart Implementation of the ISO-8583 banking protocol for Point of Sale (POS) Devices.
version: 0.3.3
version: 0.3.4
repository: https://github.com/xclud/dart_pos
homepage: https://pwa.ir

Expand Down

0 comments on commit c4fe58e

Please sign in to comment.