@@ -35,7 +35,9 @@ use bcr_ebill_core::bill::{
3535 BillIssueData , BillValidateActionData , PastPaymentDataPayment , PastPaymentDataRecourse ,
3636 PastPaymentDataSell , PastPaymentResult , PastPaymentStatus , PaymentState ,
3737} ;
38- use bcr_ebill_core:: blockchain:: bill:: block:: BillParticipantBlockData ;
38+ use bcr_ebill_core:: blockchain:: bill:: block:: {
39+ BillParticipantBlockData , BillRequestRecourseBlockData ,
40+ } ;
3941use bcr_ebill_core:: blockchain:: bill:: create_bill_to_share_with_external_party;
4042use bcr_ebill_core:: company:: { Company , CompanyKeys } ;
4143use bcr_ebill_core:: constants:: {
@@ -215,6 +217,7 @@ impl BillService {
215217 let bill_keys = self . store . get_keys ( bill_id) . await ?;
216218 let latest_ts = chain. get_latest_block ( ) . timestamp ;
217219 let contacts = self . contact_store . get_map ( ) . await ?;
220+ let mut recoursee = None ;
218221
219222 if let Some ( action) = match chain. get_latest_block ( ) . op_code {
220223 BillOpCode :: RequestToPay | BillOpCode :: OfferToSell
@@ -226,6 +229,12 @@ impl BillService {
226229 Some ( ActionType :: AcceptBill )
227230 }
228231 BillOpCode :: RequestRecourse if ( latest_ts + RECOURSE_DEADLINE_SECONDS <= now) => {
232+ if let Ok ( recourse_block) = chain
233+ . get_latest_block ( )
234+ . get_decrypted_block :: < BillRequestRecourseBlockData > ( & bill_keys)
235+ {
236+ recoursee = Some ( recourse_block. recoursee . node_id ( ) ) ;
237+ }
229238 Some ( ActionType :: RecourseBill )
230239 }
231240 _ => None ,
@@ -256,6 +265,9 @@ impl BillService {
256265 . get_last_version_bill ( & chain, & bill_keys, & identity, & contacts)
257266 . await ?;
258267
268+ let holder = bill. endorsee . as_ref ( ) . unwrap_or ( & bill. payee ) . node_id ( ) ;
269+ let drawee = & bill. drawee . node_id ;
270+
259271 for node_id in participants {
260272 if let Some ( contact) = self . contact_store . get ( & node_id) . await ? {
261273 recipient_options. push ( Some ( contact. try_into ( ) ?) ) ;
@@ -269,11 +281,14 @@ impl BillService {
269281
270282 self . notification_service
271283 . send_request_to_action_timed_out_event (
272- & identity. node_id ,
284+ & identity. node_id , // TODO(company-notifications): how to handle jobs as company participant?
273285 bill_id,
274286 Some ( bill. sum ) ,
275287 action. to_owned ( ) ,
276288 recipients,
289+ & holder,
290+ drawee,
291+ & recoursee,
277292 )
278293 . await ?;
279294
@@ -934,6 +949,7 @@ impl BillServiceApi for BillService {
934949 debug ! ( "getting file {} for bill with id: {bill_id}" , file. name) ;
935950 validate_bill_id_network ( bill_id) ?;
936951 let nostr_relays = get_config ( ) . nostr_config . relays . clone ( ) ;
952+ // TODO(multi-relay): don't default to first
937953 if let Some ( nostr_relay) = nostr_relays. first ( ) {
938954 let file_bytes = self
939955 . file_upload_client
@@ -1028,6 +1044,7 @@ impl BillServiceApi for BillService {
10281044 & bill_action,
10291045 & identity. identity ,
10301046 & contacts,
1047+ & signer_public_data. node_id ( ) ,
10311048 )
10321049 . await ?;
10331050
0 commit comments