## SP XML
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Build Status](https://travis-ci.org/timgabets/sp-xml.svg?branch=master)](https://travis-ci.org/timgabets/sp-xml)
Rust community library for serializaing/deserializing IBM Safer Payments® XML messages.
### Usage
```toml
[dependencies]
sp-xml = "0.1"
```
```rust
use sp_xml::{SPRequest, SPResponse};
let s = r#"
iddqd
aaaa
231231
54656456
127
bbbbb
ccccc
ddddd
eee
2020-04-27 12:00:00
36028797018963968
"#;
// Deserializing request
let req = SPRequest::new(s.as_bytes());
println!("{:?}", req);
// Applying logic on deserialized request, e.g. generating and assinging Message ID:
req.gen_message_id();
// Serializing request
let msg : String = req.serialize().unwrap();
// Sending the data over TCP stream:
s.write_all(&msg.as_bytes()).await?;
```
```rust
let s = r##"
"##;
// Deserializing response
let resp = SPResponse::new(s.as_bytes());
println!("{:?}", resp);
// Applying logic on deserialized response, e.g. checking message ID:
println!("{:?}", resp.message_id);
// Serializing Response
let serialized = res.serialize().unwrap();
println!("{:?}", serialized);
// Sending serialized response in HTTP payload
Ok(HttpResponse::Ok()
.content_type("text/xml")
.body(serialized))
```
Check [lakgves](https://github.com/timgabets/lakgves) for more examples.