Small fixes missing finalization time and unit trade_satoshis response

This commit is contained in:
Reckless_Satoshi 2022-11-25 16:06:40 -08:00
parent 192dcedbc4
commit b4072b95da
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 8 additions and 0 deletions

View File

@ -1720,6 +1720,9 @@ class Logics:
)
if order.last_satoshis_time is not None:
platform_summary["contract_timestamp"] = order.last_satoshis_time
if order.contract_finalization_time is None:
order.contract_finalization_time = timezone.now()
order.save()
platform_summary["contract_total_time"] = (
order.contract_finalization_time - order.last_satoshis_time
)

View File

@ -441,9 +441,14 @@ class OrderView(viewsets.ViewSet):
if order.payout.status == LNPayment.Status.EXPIRE:
data["invoice_expired"] = True
# Add invoice amount once again if invoice was expired.
# Start deprecate after v0.3.1
data["invoice_amount"] = Logics.payout_amount(order, request.user)[1][
"invoice_amount"
]
# End deprecate
data["trade_satoshis"] = Logics.payout_amount(order, request.user)[1][
"invoice_amount"
]
# 10) If status is 'Expired', "Sending", "Finished" or "failed routing", add info for renewal:
elif order.status in [