@@ -8,12 +8,12 @@ use payjoin::persist::OptionalTransitionOutcome;
88use payjoin:: receive:: v2:: {
99 replay_event_log as replay_receiver_event_log, HasReplyableError , Initialized ,
1010 MaybeInputsOwned , MaybeInputsSeen , OutputsUnknown , PayjoinProposal , ProvisionalProposal ,
11- ReceiveSession , Receiver , ReceiverBuilder , UncheckedOriginalPayload , WantsFeeRange ,
12- WantsInputs , WantsOutputs ,
11+ ReceiveSession , Receiver , ReceiverBuilder , SessionOutcome as ReceiverSessionOutcome ,
12+ UncheckedOriginalPayload , WantsFeeRange , WantsInputs , WantsOutputs ,
1313} ;
1414use payjoin:: send:: v2:: {
1515 replay_event_log as replay_sender_event_log, PollingForProposal , SendSession , Sender ,
16- SenderBuilder , WithReplyKey ,
16+ SenderBuilder , SessionOutcome as SenderSessionOutcome , WithReplyKey ,
1717} ;
1818use payjoin:: { ImplementationError , PjParam , Uri } ;
1919use tokio:: sync:: watch;
@@ -52,7 +52,11 @@ impl StatusText for SendSession {
5252 SendSession :: WithReplyKey ( _) | SendSession :: PollingForProposal ( _) =>
5353 "Waiting for proposal" ,
5454 SendSession :: ProposalReceived ( _) => "Proposal received" ,
55- SendSession :: TerminalFailure => "Session failure" ,
55+ SendSession :: Closed ( session_outcome) => match session_outcome {
56+ SenderSessionOutcome :: Failure => "Session failure" ,
57+ SenderSessionOutcome :: Success => "Session success" ,
58+ SenderSessionOutcome :: Cancel => "Session cancelled" ,
59+ } ,
5660 }
5761 }
5862}
@@ -70,7 +74,13 @@ impl StatusText for ReceiveSession {
7074 | ReceiveSession :: WantsFeeRange ( _)
7175 | ReceiveSession :: ProvisionalProposal ( _) => "Processing original proposal" ,
7276 ReceiveSession :: PayjoinProposal ( _) => "Payjoin proposal sent" ,
73- ReceiveSession :: HasReplyableError ( _) => "Session failure" ,
77+ ReceiveSession :: HasReplyableError ( _) =>
78+ "Session failure, waiting to post error response" ,
79+ ReceiveSession :: Closed ( session_outcome) => match session_outcome {
80+ ReceiverSessionOutcome :: Failure => "Session failure" ,
81+ ReceiverSessionOutcome :: Success => "Session success" ,
82+ ReceiverSessionOutcome :: Cancel => "Session cancelled" ,
83+ } ,
7484 }
7585 }
7686}
@@ -523,6 +533,7 @@ impl App {
523533 self . send_payjoin_proposal ( proposal, persister) . await ,
524534 ReceiveSession :: HasReplyableError ( error) =>
525535 self . handle_error ( error, persister) . await ,
536+ ReceiveSession :: Closed ( _) => return Err ( anyhow ! ( "Session closed" ) ) ,
526537 }
527538 } ;
528539 res
0 commit comments