@@ -1076,6 +1076,8 @@ impl BillService {
10761076 Ok ( BitcreditBillToReturn {
10771077 id : bill. id ,
10781078 time_of_drawing,
1079+ time_of_maturity : util:: date:: date_string_to_i64_timestamp ( & bill. maturity_date , None )
1080+ . unwrap_or ( 0 ) as u64 ,
10791081 country_of_issuing : bill. country_of_issuing ,
10801082 city_of_issuing : bill. city_of_issuing ,
10811083 drawee : bill. drawee ,
@@ -1121,29 +1123,20 @@ impl BillService {
11211123 . get_last_version_bill ( & chain, & bill_keys, identity)
11221124 . await ?;
11231125
1124- // We only check payment, if the maturity date hasn't expired
1125- if let Some ( maturity_date_timestamp) =
1126- util:: date:: date_string_to_i64_timestamp ( & bill. maturity_date , None )
1126+ let holder_public_key = match bill. endorsee {
1127+ None => & bill. payee . node_id ,
1128+ Some ( ref endorsee) => & endorsee. node_id ,
1129+ } ;
1130+ let address_to_pay = self
1131+ . bitcoin_client
1132+ . get_address_to_pay ( & bill_keys. public_key , holder_public_key) ?;
1133+ if let Ok ( ( paid, sum) ) = self
1134+ . bitcoin_client
1135+ . check_if_paid ( & address_to_pay, bill. sum )
1136+ . await
11271137 {
1128- if maturity_date_timestamp
1129- > ( util:: date:: now ( ) . timestamp ( ) - PAYMENT_DEADLINE_SECONDS as i64 )
1130- {
1131- let holder_public_key = match bill. endorsee {
1132- None => & bill. payee . node_id ,
1133- Some ( ref endorsee) => & endorsee. node_id ,
1134- } ;
1135- let address_to_pay = self
1136- . bitcoin_client
1137- . get_address_to_pay ( & bill_keys. public_key , holder_public_key) ?;
1138- if let Ok ( ( paid, sum) ) = self
1139- . bitcoin_client
1140- . check_if_paid ( & address_to_pay, bill. sum )
1141- . await
1142- {
1143- if paid && sum > 0 {
1144- self . store . set_to_paid ( bill_id, & address_to_pay) . await ?;
1145- }
1146- }
1138+ if paid && sum > 0 {
1139+ self . store . set_to_paid ( bill_id, & address_to_pay) . await ?;
11471140 }
11481141 }
11491142 Ok ( ( ) )
@@ -3221,6 +3214,8 @@ pub struct LightBitcreditBillToReturn {
32213214 pub sum : String ,
32223215 pub currency : String ,
32233216 pub issue_date : String ,
3217+ pub time_of_drawing : u64 ,
3218+ pub time_of_maturity : u64 ,
32243219}
32253220
32263221impl From < BitcreditBillToReturn > for LightBitcreditBillToReturn {
@@ -3235,6 +3230,9 @@ impl From<BitcreditBillToReturn> for LightBitcreditBillToReturn {
32353230 sum : value. sum ,
32363231 currency : value. currency ,
32373232 issue_date : value. issue_date ,
3233+ time_of_drawing : value. time_of_drawing ,
3234+ time_of_maturity : util:: date:: date_string_to_i64_timestamp ( & value. maturity_date , None )
3235+ . unwrap_or ( 0 ) as u64 ,
32383236 }
32393237 }
32403238}
@@ -3243,6 +3241,7 @@ impl From<BitcreditBillToReturn> for LightBitcreditBillToReturn {
32433241pub struct BitcreditBillToReturn {
32443242 pub id : String ,
32453243 pub time_of_drawing : u64 ,
3244+ pub time_of_maturity : u64 ,
32463245 pub country_of_issuing : String ,
32473246 pub city_of_issuing : String ,
32483247 /// The party obliged to pay a Bill
0 commit comments