diff --git a/src/core/pay.rs b/src/core/pay.rs index a2003d5..0498101 100644 --- a/src/core/pay.rs +++ b/src/core/pay.rs @@ -12,6 +12,7 @@ pub struct Query { pub comment_size: Option, pub min: u64, pub max: u64, + pub metadata_raw: Option, } impl std::str::FromStr for Query { @@ -76,6 +77,7 @@ impl std::str::FromStr for Query { }); Ok(Query { + metadata_raw: Some(p.metadata), callback: p.callback.0.into_owned(), comment_size: p.comment_allowed, min: p.min_sendable, @@ -275,7 +277,7 @@ mod tests { let input = r#" { "callback": "https://yuri?o=callback", - "metadata": "[[\"text/plain\", \"boneco do steve magal\"]]", + "metadata": "[[\"text/plain\", \"boneco do steve magal\"],[\"text/crazy\", \"👋🇧🇴💾\"]]", "maxSendable": 315, "minSendable": 314 } @@ -285,6 +287,10 @@ mod tests { assert_eq!(parsed.callback.to_string(), "https://yuri/?o=callback"); assert_eq!(parsed.short_description, "boneco do steve magal"); + assert_eq!( + parsed.metadata_raw.unwrap(), + "[[\"text/plain\", \"boneco do steve magal\"],[\"text/crazy\", \"👋🇧🇴💾\"]]" + ); assert_eq!(parsed.min, 314); assert_eq!(parsed.max, 315); @@ -389,6 +395,7 @@ mod tests { max: 315, identifier: None, email: None, + metadata_raw: None, }; assert_eq!( @@ -410,6 +417,7 @@ mod tests { max: 315, identifier: None, email: None, + metadata_raw: None, }; assert_eq!( @@ -431,6 +439,7 @@ mod tests { max: 315, identifier: None, email: None, + metadata_raw: None, }; assert_eq!( @@ -452,6 +461,7 @@ mod tests { max: 315, identifier: None, email: None, + metadata_raw: None, }; assert_eq!( @@ -473,6 +483,7 @@ mod tests { max: 315, identifier: Some(String::from("steve@magal.brutal")), email: None, + metadata_raw: None, }; assert_eq!( @@ -494,6 +505,7 @@ mod tests { max: 315, identifier: None, email: Some(String::from("steve@magal.brutal")), + metadata_raw: None, }; assert_eq!( diff --git a/tests/lud06.rs b/tests/lud06.rs index 371cd69..33c8d43 100644 --- a/tests/lud06.rs +++ b/tests/lud06.rs @@ -25,6 +25,7 @@ async fn test() { max: 315, identifier: None, email: None, + metadata_raw: None, }) } }, diff --git a/tests/lud09.rs b/tests/lud09.rs index ed700c7..71df45e 100644 --- a/tests/lud09.rs +++ b/tests/lud09.rs @@ -25,6 +25,7 @@ async fn test() { max: 315, identifier: None, email: None, + metadata_raw: None, }) } }, diff --git a/tests/lud11.rs b/tests/lud11.rs index 4f6506d..18f6743 100644 --- a/tests/lud11.rs +++ b/tests/lud11.rs @@ -25,6 +25,7 @@ async fn test() { max: 315, identifier: None, email: None, + metadata_raw: None, }) } }, diff --git a/tests/lud12.rs b/tests/lud12.rs index 280a456..226e5e8 100644 --- a/tests/lud12.rs +++ b/tests/lud12.rs @@ -25,6 +25,7 @@ async fn test() { max: 315, identifier: None, email: None, + metadata_raw: None, }) } }, diff --git a/tests/lud16.rs b/tests/lud16.rs index 7514cb1..d522591 100644 --- a/tests/lud16.rs +++ b/tests/lud16.rs @@ -24,6 +24,7 @@ async fn test() { max: 315, identifier: identifier.clone().filter(|i| i.starts_with('n')), email: identifier.filter(|i| i.starts_with('j')), + metadata_raw: None, }) } },