@@ -313,7 +313,9 @@ impl Bolt12Payment {
313313 }
314314
315315 /// Returns a [`Refund`] object that can be used to offer a refund payment of the amount given.
316- pub fn initiate_refund ( & self , amount_msat : u64 , expiry_secs : u32 ) -> Result < Refund , Error > {
316+ pub fn initiate_refund (
317+ & self , amount_msat : u64 , quantity : Option < u64 > , expiry_secs : u32 ,
318+ ) -> Result < Refund , Error > {
317319 let mut random_bytes = [ 0u8 ; 32 ] ;
318320 rand:: thread_rng ( ) . fill_bytes ( & mut random_bytes) ;
319321 let payment_id = PaymentId ( random_bytes) ;
@@ -337,6 +339,7 @@ impl Bolt12Payment {
337339 log_error ! ( self . logger, "Failed to create refund builder: {:?}" , e) ;
338340 Error :: RefundCreationFailed
339341 } ) ?
342+ . quantity ( quantity. unwrap_or ( 1 ) )
340343 . build ( )
341344 . map_err ( |e| {
342345 log_error ! ( self . logger, "Failed to create refund: {:?}" , e) ;
@@ -350,7 +353,7 @@ impl Bolt12Payment {
350353 preimage : None ,
351354 secret : None ,
352355 payer_note : refund. payer_note ( ) . map ( |note| UntrustedString ( note. to_string ( ) ) ) ,
353- quantity : refund . quantity ( ) ,
356+ quantity,
354357 } ;
355358 let payment = PaymentDetails :: new (
356359 payment_id,
0 commit comments