ISO8583 library written in Rust
(This project is mostly WIP)
``` rust
extern crate lazy_static; extern crate hex; extern crate byteorder;
extern crate log; extern crate simplelog;
use std::time::Duration; use crate::iso8583::server::IsoServer;
pub mod iso8583;
fn main(){
std::env::set_var("SPEC_FILE","sample_spec\\sample_spec.yaml");
let _ = simplelog::SimpleLogger::init(simplelog::LevelFilter::Debug, simplelog::Config::default());
let iso_spec = crate::iso8583::iso_spec::spec("");
info!("starting iso server for spec {} at port {}", iso_spec.name(), 6666);
let server: IsoServer = match crate::iso8583::server::new("localhost:6666".to_string(), iso_spec) {
Ok(server) => {
server
}
Err(e) => {
panic!(e)
}
};
server.start().join();
}
```
``
Finished dev [unoptimized + debuginfo] target(s) in 1.77s
Running
target\debug\iso8583rs.exe`
13:37:09 [INFO] starting iso server for spec SampleSpec at port 6666
16:58:07 [DEBUG] (2) iso8583rs::iso8583::server: Accepted new connection .. Ok(V6([::1]:59818))
16:58:07 [DEBUG] (4) iso8583rs::iso8583::server: received request len = 54 : data = 313130307024000000000000313231323334353637383931303130303430303030303030303030303031393937373935383132323034
16:58:07 [DEBUG] (4) iso8583rs::iso8583::isospec: computed header value for incoming message = 1100
16:58:07 [DEBUG] (4) iso8583rs::iso8583::isospec: parsing field : messagetype
16:58:07 [DEBUG] (4) iso8583rs::iso8583::isospec: parsing field : bitmap
16:58:07 [DEBUG] (4) iso8583rs::iso8583::bitmap: parsing field - pan
16:58:07 [DEBUG] (4) iso8583rs::iso8583::bitmap: parsing field - proccode
16:58:07 [DEBUG] (4) iso8583rs::iso8583::bitmap: parsing field - amount
16:58:07 [DEBUG] (4) iso8583rs::iso8583::bitmap: parsing field - stan
16:58:07 [DEBUG] (4) iso8583rs::iso8583::bitmap: parsing field - expirationdate
16:58:07 [DEBUG] (4) iso8583rs::iso8583::msg_processor: parsed incoming request - message = "Authorization Request - 1100" successfully.
: parsed message:
amount : 000000000199 stan : 779581 messagetype : 1100 expirationdate : 2204 bitmap : 7024000000000000 pan : 123456789101 proc_code : 004000
16:58:07 [DEBUG] (4) iso8583rs::iso8583::msgprocessor: amount = 199 16:58:07 [DEBUG] (4) iso8583rs::iso8583::isospec: echoing .. 2: 123456789101 16:58:07 [DEBUG] (4) iso8583rs::iso8583::isospec: echoing .. 3: 004000 16:58:07 [DEBUG] (4) iso8583rs::iso8583::isospec: echoing .. 4: 000000000199 16:58:07 [DEBUG] (4) iso8583rs::iso8583::isospec: echoing .. 11: 779581 16:58:07 [DEBUG] (4) iso8583rs::iso8583::isospec: echoing .. 14: 2204 16:58:07 [DEBUG] (4) iso8583rs::iso8583::server: isoresponse raw:: 313131307024000002000000313231323334353637383931303130303430303030303030303030303031393937373935383132323034313030, parsed::
amount : 000000000199 proccode : 004000 expirationdate : 2204 actioncode : 100 messagetype : 1110 stan : 779581 pan : 123456789101
16:58:07 [INFO] client socket closed : [::1]:59818
```
Now run src/iso8583/test.rs:32
```
Testing started at 22:27 ... raw iso msg = 0036313130307024000000000000313231323334353637383931303130303430303030303030303030303031393937373935383132323034 received response: "313131307024000002000000313231323334353637383931303130303430303030303030303030303031393937373935383132323034313030" with 57 bytes. parsed iso-response "Authorization Response - 1110"
expirationdate : 2204 amount : 000000000199 proccode : 004000 bitmap : 7024000002000000 stan : 779581 messagetype : 1110 pan : 123456789101 actioncode : 100
```