@@ -1400,9 +1400,14 @@ impl BillService {
1400
1400
. await ?;
1401
1401
1402
1402
if !sent {
1403
- let current_identity = IdentityPublicData :: new ( self . identity_store . get ( ) . await ?) ;
1403
+ let identity = self . identity_store . get ( ) . await ?;
1404
+ let current_identity = IdentityPublicData :: new ( identity. clone ( ) ) ;
1404
1405
let participants = chain. get_all_nodes_from_bill ( & bill_keys) ?;
1405
1406
let mut recipient_options = vec ! [ current_identity] ;
1407
+ let bill = self
1408
+ . get_last_version_bill ( & chain, & bill_keys, & identity)
1409
+ . await ?;
1410
+
1406
1411
for node_id in participants {
1407
1412
let contact: Option < IdentityPublicData > =
1408
1413
self . contact_store . get ( & node_id) . await ?. map ( |c| c. into ( ) ) ;
@@ -1415,7 +1420,12 @@ impl BillService {
1415
1420
. collect :: < Vec < IdentityPublicData > > ( ) ;
1416
1421
1417
1422
self . notification_service
1418
- . send_request_to_action_timed_out_event ( bill_id, action. to_owned ( ) , recipients)
1423
+ . send_request_to_action_timed_out_event (
1424
+ bill_id,
1425
+ Some ( bill. sum ) ,
1426
+ action. to_owned ( ) ,
1427
+ recipients,
1428
+ )
1419
1429
. await ?;
1420
1430
1421
1431
// remember we have sent the notification
@@ -1709,25 +1719,37 @@ impl BillService {
1709
1719
self . notification_service
1710
1720
. send_request_to_action_rejected_event (
1711
1721
bill_id,
1722
+ Some ( bill. sum ) ,
1712
1723
ActionType :: AcceptBill ,
1713
1724
recipients,
1714
1725
)
1715
1726
. await ?;
1716
1727
}
1717
1728
BillOpCode :: RejectToBuy => {
1718
1729
self . notification_service
1719
- . send_request_to_action_rejected_event ( bill_id, ActionType :: BuyBill , recipients)
1730
+ . send_request_to_action_rejected_event (
1731
+ bill_id,
1732
+ Some ( bill. sum ) ,
1733
+ ActionType :: BuyBill ,
1734
+ recipients,
1735
+ )
1720
1736
. await ?;
1721
1737
}
1722
1738
BillOpCode :: RejectToPay => {
1723
1739
self . notification_service
1724
- . send_request_to_action_rejected_event ( bill_id, ActionType :: PayBill , recipients)
1740
+ . send_request_to_action_rejected_event (
1741
+ bill_id,
1742
+ Some ( bill. sum ) ,
1743
+ ActionType :: PayBill ,
1744
+ recipients,
1745
+ )
1725
1746
. await ?;
1726
1747
}
1727
1748
BillOpCode :: RejectToPayRecourse => {
1728
1749
self . notification_service
1729
1750
. send_request_to_action_rejected_event (
1730
1751
bill_id,
1752
+ Some ( bill. sum ) ,
1731
1753
ActionType :: RecourseBill ,
1732
1754
recipients,
1733
1755
)
@@ -2525,7 +2547,7 @@ impl BillServiceApi for BillService {
2525
2547
RecourseReason :: Pay ( _, _) => ActionType :: PayBill ,
2526
2548
} ;
2527
2549
self . notification_service
2528
- . send_recourse_action_event ( bill_id, action_type, recoursee)
2550
+ . send_recourse_action_event ( bill_id, Some ( sum ) , action_type, recoursee)
2529
2551
. await ?;
2530
2552
2531
2553
Ok ( blockchain)
@@ -2605,7 +2627,7 @@ impl BillServiceApi for BillService {
2605
2627
. await ?;
2606
2628
2607
2629
self . notification_service
2608
- . send_bill_recourse_paid_event ( bill_id, & recoursee)
2630
+ . send_bill_recourse_paid_event ( bill_id, Some ( payment_info . sum ) , & recoursee)
2609
2631
. await ?;
2610
2632
2611
2633
return Ok ( blockchain) ;
@@ -2765,7 +2787,7 @@ impl BillServiceApi for BillService {
2765
2787
. await ?;
2766
2788
2767
2789
self . notification_service
2768
- . send_offer_to_sell_event ( bill_id, & buyer)
2790
+ . send_offer_to_sell_event ( bill_id, Some ( sum ) , & buyer)
2769
2791
. await ?;
2770
2792
2771
2793
return Ok ( blockchain) ;
@@ -2849,7 +2871,7 @@ impl BillServiceApi for BillService {
2849
2871
. await ?;
2850
2872
2851
2873
self . notification_service
2852
- . send_bill_is_sold_event ( bill_id, & buyer)
2874
+ . send_bill_is_sold_event ( bill_id, Some ( payment_info . sum ) , & buyer)
2853
2875
. await ?;
2854
2876
2855
2877
return Ok ( blockchain) ;
@@ -5417,7 +5439,7 @@ pub mod tests {
5417
5439
// Request to sell event should be sent
5418
5440
notification_service
5419
5441
. expect_send_offer_to_sell_event ( )
5420
- . returning ( |_, _| Ok ( ( ) ) ) ;
5442
+ . returning ( |_, _, _ | Ok ( ( ) ) ) ;
5421
5443
5422
5444
let service = get_service_base (
5423
5445
storage,
@@ -5558,7 +5580,7 @@ pub mod tests {
5558
5580
// Request to sell event should be sent
5559
5581
notification_service
5560
5582
. expect_send_bill_is_sold_event ( )
5561
- . returning ( |_, _| Ok ( ( ) ) ) ;
5583
+ . returning ( |_, _, _ | Ok ( ( ) ) ) ;
5562
5584
5563
5585
let service = get_service_base (
5564
5586
storage,
@@ -5647,7 +5669,7 @@ pub mod tests {
5647
5669
// Sold event should be sent
5648
5670
notification_service
5649
5671
. expect_send_bill_is_sold_event ( )
5650
- . returning ( |_, _| Ok ( ( ) ) ) ;
5672
+ . returning ( |_, _, _ | Ok ( ( ) ) ) ;
5651
5673
5652
5674
let service = get_service_base (
5653
5675
storage,
@@ -5711,7 +5733,7 @@ pub mod tests {
5711
5733
// Request to sell event should be sent
5712
5734
notification_service
5713
5735
. expect_send_bill_is_sold_event ( )
5714
- . returning ( |_, _| Ok ( ( ) ) ) ;
5736
+ . returning ( |_, _, _ | Ok ( ( ) ) ) ;
5715
5737
5716
5738
let service = get_service_base (
5717
5739
storage,
@@ -6197,7 +6219,7 @@ pub mod tests {
6197
6219
let mut notification_service = MockNotificationServiceApi :: new ( ) ;
6198
6220
notification_service
6199
6221
. expect_send_bill_is_sold_event ( )
6200
- . returning ( |_, _| Ok ( ( ) ) ) ;
6222
+ . returning ( |_, _, _ | Ok ( ( ) ) ) ;
6201
6223
6202
6224
let service = get_service_base (
6203
6225
storage,
@@ -6293,7 +6315,7 @@ pub mod tests {
6293
6315
let mut notification_service = MockNotificationServiceApi :: new ( ) ;
6294
6316
notification_service
6295
6317
. expect_send_bill_is_sold_event ( )
6296
- . returning ( |_, _| Ok ( ( ) ) ) ;
6318
+ . returning ( |_, _, _ | Ok ( ( ) ) ) ;
6297
6319
6298
6320
let service = get_service_base (
6299
6321
storage,
@@ -6559,16 +6581,22 @@ pub mod tests {
6559
6581
. expect_send_request_to_action_timed_out_event ( )
6560
6582
. with (
6561
6583
eq ( "1234" ) ,
6584
+ always ( ) ,
6562
6585
eq ( ActionType :: AcceptBill ) ,
6563
6586
recipient_check. clone ( ) ,
6564
6587
)
6565
- . returning ( |_, _, _| Ok ( ( ) ) ) ;
6588
+ . returning ( |_, _, _, _ | Ok ( ( ) ) ) ;
6566
6589
6567
6590
// send pay timeout notification
6568
6591
notification_service
6569
6592
. expect_send_request_to_action_timed_out_event ( )
6570
- . with ( eq ( "4321" ) , eq ( ActionType :: PayBill ) , recipient_check)
6571
- . returning ( |_, _, _| Ok ( ( ) ) ) ;
6593
+ . with (
6594
+ eq ( "4321" ) ,
6595
+ always ( ) ,
6596
+ eq ( ActionType :: PayBill ) ,
6597
+ recipient_check,
6598
+ )
6599
+ . returning ( |_, _, _, _| Ok ( ( ) ) ) ;
6572
6600
6573
6601
// marks accept bill timeout as sent
6574
6602
notification_service
@@ -7224,8 +7252,8 @@ pub mod tests {
7224
7252
let mut notification_service = MockNotificationServiceApi :: new ( ) ;
7225
7253
notification_service
7226
7254
. expect_send_request_to_action_rejected_event ( )
7227
- . with ( eq ( "1234" ) , eq ( ActionType :: AcceptBill ) , always ( ) )
7228
- . returning ( |_, _, _| Ok ( ( ) ) ) ;
7255
+ . with ( eq ( "1234" ) , always ( ) , eq ( ActionType :: AcceptBill ) , always ( ) )
7256
+ . returning ( |_, _, _, _ | Ok ( ( ) ) ) ;
7229
7257
7230
7258
let service = get_service_base (
7231
7259
storage,
@@ -7314,8 +7342,8 @@ pub mod tests {
7314
7342
let mut notification_service = MockNotificationServiceApi :: new ( ) ;
7315
7343
notification_service
7316
7344
. expect_send_request_to_action_rejected_event ( )
7317
- . with ( eq ( "1234" ) , eq ( ActionType :: BuyBill ) , always ( ) )
7318
- . returning ( |_, _, _| Ok ( ( ) ) ) ;
7345
+ . with ( eq ( "1234" ) , always ( ) , eq ( ActionType :: BuyBill ) , always ( ) )
7346
+ . returning ( |_, _, _, _ | Ok ( ( ) ) ) ;
7319
7347
7320
7348
let service = get_service_base (
7321
7349
storage,
@@ -7400,8 +7428,8 @@ pub mod tests {
7400
7428
let mut notification_service = MockNotificationServiceApi :: new ( ) ;
7401
7429
notification_service
7402
7430
. expect_send_request_to_action_rejected_event ( )
7403
- . with ( eq ( "1234" ) , eq ( ActionType :: PayBill ) , always ( ) )
7404
- . returning ( |_, _, _| Ok ( ( ) ) ) ;
7431
+ . with ( eq ( "1234" ) , always ( ) , eq ( ActionType :: PayBill ) , always ( ) )
7432
+ . returning ( |_, _, _, _ | Ok ( ( ) ) ) ;
7405
7433
7406
7434
let service = get_service_base (
7407
7435
storage,
@@ -7489,8 +7517,8 @@ pub mod tests {
7489
7517
let mut notification_service = MockNotificationServiceApi :: new ( ) ;
7490
7518
notification_service
7491
7519
. expect_send_request_to_action_rejected_event ( )
7492
- . with ( eq ( "1234" ) , eq ( ActionType :: RecourseBill ) , always ( ) )
7493
- . returning ( |_, _, _| Ok ( ( ) ) ) ;
7520
+ . with ( eq ( "1234" ) , always ( ) , eq ( ActionType :: RecourseBill ) , always ( ) )
7521
+ . returning ( |_, _, _, _ | Ok ( ( ) ) ) ;
7494
7522
7495
7523
let service = get_service_base (
7496
7524
storage,
@@ -7582,7 +7610,7 @@ pub mod tests {
7582
7610
let mut notification_service = MockNotificationServiceApi :: new ( ) ;
7583
7611
notification_service
7584
7612
. expect_send_bill_recourse_paid_event ( )
7585
- . returning ( |_, _| Ok ( ( ) ) ) ;
7613
+ . returning ( |_, _, _ | Ok ( ( ) ) ) ;
7586
7614
7587
7615
let service = get_service_base (
7588
7616
storage,
@@ -7677,7 +7705,7 @@ pub mod tests {
7677
7705
let mut notification_service = MockNotificationServiceApi :: new ( ) ;
7678
7706
notification_service
7679
7707
. expect_send_bill_recourse_paid_event ( )
7680
- . returning ( |_, _| Ok ( ( ) ) ) ;
7708
+ . returning ( |_, _, _ | Ok ( ( ) ) ) ;
7681
7709
7682
7710
let service = get_service_base (
7683
7711
storage,
@@ -7784,7 +7812,7 @@ pub mod tests {
7784
7812
// Request to recourse event should be sent
7785
7813
notification_service
7786
7814
. expect_send_recourse_action_event ( )
7787
- . returning ( |_, _, _| Ok ( ( ) ) ) ;
7815
+ . returning ( |_, _, _, _ | Ok ( ( ) ) ) ;
7788
7816
7789
7817
let service = get_service_base (
7790
7818
storage,
@@ -7904,7 +7932,7 @@ pub mod tests {
7904
7932
// Request to recourse event should be sent
7905
7933
notification_service
7906
7934
. expect_send_recourse_action_event ( )
7907
- . returning ( |_, _, _| Ok ( ( ) ) ) ;
7935
+ . returning ( |_, _, _, _ | Ok ( ( ) ) ) ;
7908
7936
7909
7937
let service = get_service_base (
7910
7938
storage,
@@ -7996,7 +8024,7 @@ pub mod tests {
7996
8024
// Recourse paid event should be sent
7997
8025
notification_service
7998
8026
. expect_send_bill_recourse_paid_event ( )
7999
- . returning ( |_, _| Ok ( ( ) ) ) ;
8027
+ . returning ( |_, _, _ | Ok ( ( ) ) ) ;
8000
8028
8001
8029
let service = get_service_base (
8002
8030
storage,
0 commit comments