@@ -1076,6 +1076,8 @@ impl BillService {
1076
1076
Ok ( BitcreditBillToReturn {
1077
1077
id : bill. id ,
1078
1078
time_of_drawing,
1079
+ time_of_maturity : util:: date:: date_string_to_i64_timestamp ( & bill. maturity_date , None )
1080
+ . unwrap_or ( 0 ) as u64 ,
1079
1081
country_of_issuing : bill. country_of_issuing ,
1080
1082
city_of_issuing : bill. city_of_issuing ,
1081
1083
drawee : bill. drawee ,
@@ -1121,29 +1123,20 @@ impl BillService {
1121
1123
. get_last_version_bill ( & chain, & bill_keys, identity)
1122
1124
. await ?;
1123
1125
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
1127
1137
{
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 ?;
1147
1140
}
1148
1141
}
1149
1142
Ok ( ( ) )
@@ -3221,6 +3214,8 @@ pub struct LightBitcreditBillToReturn {
3221
3214
pub sum : String ,
3222
3215
pub currency : String ,
3223
3216
pub issue_date : String ,
3217
+ pub time_of_drawing : u64 ,
3218
+ pub time_of_maturity : u64 ,
3224
3219
}
3225
3220
3226
3221
impl From < BitcreditBillToReturn > for LightBitcreditBillToReturn {
@@ -3235,6 +3230,9 @@ impl From<BitcreditBillToReturn> for LightBitcreditBillToReturn {
3235
3230
sum : value. sum ,
3236
3231
currency : value. currency ,
3237
3232
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 ,
3238
3236
}
3239
3237
}
3240
3238
}
@@ -3243,6 +3241,7 @@ impl From<BitcreditBillToReturn> for LightBitcreditBillToReturn {
3243
3241
pub struct BitcreditBillToReturn {
3244
3242
pub id : String ,
3245
3243
pub time_of_drawing : u64 ,
3244
+ pub time_of_maturity : u64 ,
3246
3245
pub country_of_issuing : String ,
3247
3246
pub city_of_issuing : String ,
3248
3247
/// The party obliged to pay a Bill
0 commit comments