From b4072b95daf1c7fe793cf047dc361c7438190a95 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Fri, 25 Nov 2022 16:06:40 -0800 Subject: [PATCH] Small fixes missing finalization time and unit trade_satoshis response --- api/logics.py | 3 +++ api/views.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/api/logics.py b/api/logics.py index f2b229a7e..ab2e5ad90 100644 --- a/api/logics.py +++ b/api/logics.py @@ -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 ) diff --git a/api/views.py b/api/views.py index 457ba9adc..d32dea19f 100644 --- a/api/views.py +++ b/api/views.py @@ -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 [