Skip to content

Commit

Permalink
Small fixes missing finalization time and unit trade_satoshis response
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Nov 26, 2022
1 parent 192dced commit b4072b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/logics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,9 @@ def summarize_trade(cls, order, user):
)
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
)
Expand Down
5 changes: 5 additions & 0 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,14 @@ def get(self, request, format=None):
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 [
Expand Down

0 comments on commit b4072b9

Please sign in to comment.