@@ -425,16 +425,27 @@ fn simple_bolt12_send_receive() {
425
425
426
426
let expected_amount_msat = 100_000_000 ;
427
427
let offer = node_b. bolt12_payment ( ) . receive ( expected_amount_msat, "asdf" ) . unwrap ( ) ;
428
- let payment_id = node_a. bolt12_payment ( ) . send ( & offer, None , None ) . unwrap ( ) ;
428
+ let quantity = Some ( 1 ) ;
429
+ let payer_note = Some ( "Test" . to_string ( ) ) ;
430
+ let payment_id = node_a. bolt12_payment ( ) . send ( & offer, quantity, payer_note. clone ( ) ) . unwrap ( ) ;
429
431
430
432
expect_payment_successful_event ! ( node_a, Some ( payment_id) , None ) ;
431
433
let node_a_payments = node_a. list_payments ( ) ;
432
434
assert_eq ! ( node_a_payments. len( ) , 1 ) ;
433
435
match node_a_payments. first ( ) . unwrap ( ) . kind {
434
- PaymentKind :: Bolt12Offer { hash, preimage, secret : _, offer_id, .. } => {
436
+ PaymentKind :: Bolt12Offer {
437
+ hash,
438
+ preimage,
439
+ secret : _,
440
+ offer_id,
441
+ quantity : ref qty,
442
+ payer_note : ref note,
443
+ } => {
435
444
assert ! ( hash. is_some( ) ) ;
436
445
assert ! ( preimage. is_some( ) ) ;
437
446
assert_eq ! ( offer_id, offer. id( ) ) ;
447
+ assert_eq ! ( & quantity, qty) ;
448
+ assert_eq ! ( payer_note. unwrap( ) , note. clone( ) . unwrap( ) . 0 ) ;
438
449
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
439
450
//API currently doesn't allow to do that.
440
451
} ,
@@ -465,23 +476,34 @@ fn simple_bolt12_send_receive() {
465
476
let less_than_offer_amount = offer_amount_msat - 10_000 ;
466
477
let expected_amount_msat = offer_amount_msat + 10_000 ;
467
478
let offer = node_b. bolt12_payment ( ) . receive ( offer_amount_msat, "asdf" ) . unwrap ( ) ;
479
+ let quantity = Some ( 1 ) ;
480
+ let payer_note = Some ( "Test" . to_string ( ) ) ;
468
481
assert ! ( node_a
469
482
. bolt12_payment( )
470
483
. send_using_amount( & offer, less_than_offer_amount, None , None )
471
484
. is_err( ) ) ;
472
485
let payment_id = node_a
473
486
. bolt12_payment ( )
474
- . send_using_amount ( & offer, expected_amount_msat, None , None )
487
+ . send_using_amount ( & offer, expected_amount_msat, quantity , payer_note . clone ( ) )
475
488
. unwrap ( ) ;
476
489
477
490
expect_payment_successful_event ! ( node_a, Some ( payment_id) , None ) ;
478
491
let node_a_payments = node_a. list_payments_with_filter ( |p| p. id == payment_id) ;
479
492
assert_eq ! ( node_a_payments. len( ) , 1 ) ;
480
493
let payment_hash = match node_a_payments. first ( ) . unwrap ( ) . kind {
481
- PaymentKind :: Bolt12Offer { hash, preimage, secret : _, offer_id, .. } => {
494
+ PaymentKind :: Bolt12Offer {
495
+ hash,
496
+ preimage,
497
+ secret : _,
498
+ offer_id,
499
+ quantity : ref qty,
500
+ payer_note : ref note,
501
+ } => {
482
502
assert ! ( hash. is_some( ) ) ;
483
503
assert ! ( preimage. is_some( ) ) ;
484
504
assert_eq ! ( offer_id, offer. id( ) ) ;
505
+ assert_eq ! ( & quantity, qty) ;
506
+ assert_eq ! ( payer_note. unwrap( ) , note. clone( ) . unwrap( ) . 0 ) ;
485
507
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
486
508
//API currently doesn't allow to do that.
487
509
hash. unwrap ( )
@@ -511,8 +533,12 @@ fn simple_bolt12_send_receive() {
511
533
512
534
// Now node_b refunds the amount node_a just overpaid.
513
535
let overpaid_amount = expected_amount_msat - offer_amount_msat;
514
- let refund =
515
- node_b. bolt12_payment ( ) . initiate_refund ( overpaid_amount, 3600 , None , None ) . unwrap ( ) ;
536
+ let quantity = Some ( 1 ) ;
537
+ let payer_note = Some ( "Test" . to_string ( ) ) ;
538
+ let refund = node_b
539
+ . bolt12_payment ( )
540
+ . initiate_refund ( overpaid_amount, 3600 , quantity, payer_note. clone ( ) )
541
+ . unwrap ( ) ;
516
542
let invoice = node_a. bolt12_payment ( ) . request_refund_payment ( & refund) . unwrap ( ) ;
517
543
expect_payment_received_event ! ( node_a, overpaid_amount) ;
518
544
@@ -526,9 +552,17 @@ fn simple_bolt12_send_receive() {
526
552
let node_b_payments = node_b. list_payments_with_filter ( |p| p. id == node_b_payment_id) ;
527
553
assert_eq ! ( node_b_payments. len( ) , 1 ) ;
528
554
match node_b_payments. first ( ) . unwrap ( ) . kind {
529
- PaymentKind :: Bolt12Refund { hash, preimage, secret : _, .. } => {
555
+ PaymentKind :: Bolt12Refund {
556
+ hash,
557
+ preimage,
558
+ secret : _,
559
+ quantity : ref qty,
560
+ payer_note : ref note,
561
+ } => {
530
562
assert ! ( hash. is_some( ) ) ;
531
563
assert ! ( preimage. is_some( ) ) ;
564
+ assert_eq ! ( & quantity, qty) ;
565
+ assert_eq ! ( payer_note. unwrap( ) , note. clone( ) . unwrap( ) . 0 )
532
566
//TODO: We should eventually set and assert the secret sender-side, too, but the BOLT12
533
567
//API currently doesn't allow to do that.
534
568
} ,
0 commit comments