@@ -35,7 +35,9 @@ use bcr_ebill_core::bill::{
35
35
BillIssueData , BillValidateActionData , PastPaymentDataPayment , PastPaymentDataRecourse ,
36
36
PastPaymentDataSell , PastPaymentResult , PastPaymentStatus , PaymentState ,
37
37
} ;
38
- use bcr_ebill_core:: blockchain:: bill:: block:: BillParticipantBlockData ;
38
+ use bcr_ebill_core:: blockchain:: bill:: block:: {
39
+ BillParticipantBlockData , BillRequestRecourseBlockData ,
40
+ } ;
39
41
use bcr_ebill_core:: blockchain:: bill:: create_bill_to_share_with_external_party;
40
42
use bcr_ebill_core:: company:: { Company , CompanyKeys } ;
41
43
use bcr_ebill_core:: constants:: {
@@ -215,6 +217,7 @@ impl BillService {
215
217
let bill_keys = self . store . get_keys ( bill_id) . await ?;
216
218
let latest_ts = chain. get_latest_block ( ) . timestamp ;
217
219
let contacts = self . contact_store . get_map ( ) . await ?;
220
+ let mut recoursee = None ;
218
221
219
222
if let Some ( action) = match chain. get_latest_block ( ) . op_code {
220
223
BillOpCode :: RequestToPay | BillOpCode :: OfferToSell
@@ -226,6 +229,12 @@ impl BillService {
226
229
Some ( ActionType :: AcceptBill )
227
230
}
228
231
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
+ }
229
238
Some ( ActionType :: RecourseBill )
230
239
}
231
240
_ => None ,
@@ -256,6 +265,9 @@ impl BillService {
256
265
. get_last_version_bill ( & chain, & bill_keys, & identity, & contacts)
257
266
. await ?;
258
267
268
+ let holder = bill. endorsee . as_ref ( ) . unwrap_or ( & bill. payee ) . node_id ( ) ;
269
+ let drawee = & bill. drawee . node_id ;
270
+
259
271
for node_id in participants {
260
272
if let Some ( contact) = self . contact_store . get ( & node_id) . await ? {
261
273
recipient_options. push ( Some ( contact. try_into ( ) ?) ) ;
@@ -269,11 +281,14 @@ impl BillService {
269
281
270
282
self . notification_service
271
283
. 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?
273
285
bill_id,
274
286
Some ( bill. sum ) ,
275
287
action. to_owned ( ) ,
276
288
recipients,
289
+ & holder,
290
+ drawee,
291
+ & recoursee,
277
292
)
278
293
. await ?;
279
294
@@ -934,6 +949,7 @@ impl BillServiceApi for BillService {
934
949
debug ! ( "getting file {} for bill with id: {bill_id}" , file. name) ;
935
950
validate_bill_id_network ( bill_id) ?;
936
951
let nostr_relays = get_config ( ) . nostr_config . relays . clone ( ) ;
952
+ // TODO(multi-relay): don't default to first
937
953
if let Some ( nostr_relay) = nostr_relays. first ( ) {
938
954
let file_bytes = self
939
955
. file_upload_client
@@ -1028,6 +1044,7 @@ impl BillServiceApi for BillService {
1028
1044
& bill_action,
1029
1045
& identity. identity ,
1030
1046
& contacts,
1047
+ & signer_public_data. node_id ( ) ,
1031
1048
)
1032
1049
. await ?;
1033
1050
0 commit comments