File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -309,11 +309,6 @@ impl PaymentRequestPayload {
309309 Ok ( Arc :: new ( PaymentRequestPayload { inner } ) )
310310 }
311311
312- /// Encode PaymentRequestPayload to JSON string
313- pub fn to_string ( & self ) -> Result < String , FfiError > {
314- Ok ( serde_json:: to_string ( & self . inner ) ?)
315- }
316-
317312 /// Get the ID
318313 pub fn id ( & self ) -> Option < String > {
319314 self . inner . id . clone ( )
@@ -340,6 +335,16 @@ impl PaymentRequestPayload {
340335 }
341336}
342337
338+ impl std:: fmt:: Display for PaymentRequestPayload {
339+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
340+ write ! (
341+ f,
342+ "{}" ,
343+ serde_json:: to_string( & self . inner) . map_err( |_| std:: fmt:: Error :: default ( ) ) ?
344+ )
345+ }
346+ }
347+
343348#[ cfg( test) ]
344349mod tests {
345350 use super :: * ;
@@ -385,7 +390,7 @@ mod tests {
385390
386391 let payload = PaymentRequestPayload { inner } ;
387392
388- let json = payload. to_string ( ) . unwrap ( ) ;
393+ let json = payload. to_string ( ) ;
389394 let decoded = PaymentRequestPayload :: from_string ( json) . unwrap ( ) ;
390395
391396 assert_eq ! ( decoded. id( ) , payload. id( ) ) ;
You can’t perform that action at this time.
0 commit comments