diff --git a/api/logics.py b/api/logics.py
index 4edb0c09..307a382a 100644
--- a/api/logics.py
+++ b/api/logics.py
@@ -125,16 +125,12 @@ class Logics():
elif order.status == Order.Status.WFB:
order.status = Order.Status.EXP
cls.cancel_bond(order.maker_bond)
- order.maker = None # TODO with the new validate_already_maker_taker there is no need to kick out participants on expired orders.
- order.taker = None
order.save()
return True
elif order.status == Order.Status.PUB:
cls.return_bond(order.maker_bond)
order.status = Order.Status.EXP
- order.maker = None
- order.taker = None
order.save()
return True
@@ -153,8 +149,6 @@ class Logics():
cls.settle_bond(order.taker_bond)
cls.cancel_escrow(order)
order.status = Order.Status.EXP
- order.maker = None
- order.taker = None
order.save()
return True
@@ -166,8 +160,6 @@ class Logics():
cls.return_bond(order.taker_bond)
cls.cancel_escrow(order)
order.status = Order.Status.EXP
- order.maker = None
- order.taker = None
order.save()
return True
@@ -192,8 +184,6 @@ class Logics():
cls.return_bond(order.taker_bond)
cls.return_escrow(order)
order.status = Order.Status.EXP
- order.maker = None
- order.taker = None
order.save()
return True
@@ -369,7 +359,6 @@ class Logics():
'''The order never shows up on the book and order
status becomes "cancelled". That's it.'''
if order.status == Order.Status.WFB and order.maker == user:
- order.maker = None
order.status = Order.Status.UCA
order.save()
return True, None
@@ -380,7 +369,6 @@ class Logics():
elif order.status == Order.Status.PUB and order.maker == user:
#Settle the maker bond (Maker loses the bond for cancelling public order)
if cls.settle_bond(order.maker_bond):
- order.maker = None
order.status = Order.Status.UCA
order.save()
return True, None
@@ -405,7 +393,6 @@ class Logics():
#Settle the maker bond (Maker loses the bond for canceling an ongoing trade)
valid = cls.settle_bond(order.maker_bond)
if valid:
- order.maker = None
order.status = Order.Status.UCA
order.save()
return True, None
diff --git a/api/views.py b/api/views.py
index 2efcded3..10f0381f 100644
--- a/api/views.py
+++ b/api/views.py
@@ -95,10 +95,6 @@ class OrderView(viewsets.ViewSet):
# This is our order.
order = order[0]
- # 1) If order has expired
- if order.status == Order.Status.EXP:
- return Response({'bad_request':'This order has expired'},status.HTTP_400_BAD_REQUEST)
-
# 2) If order has been cancelled
if order.status == Order.Status.UCA:
return Response({'bad_request':'This order has been cancelled by the maker'},status.HTTP_400_BAD_REQUEST)
@@ -166,14 +162,14 @@ class OrderView(viewsets.ViewSet):
data['escrow_locked'] = False
# If both bonds are locked, participants can see the final trade amount in sats.
- # if order.taker_bond:
- # if order.maker_bond.status == order.taker_bond.status == LNPayment.Status.LOCKED:
- # # Seller sees the amount he sends
- # if data['is_seller']:
- # data['trade_satoshis'] = order.last_satoshis
- # # Buyer sees the amount he receives
- # elif data['is_buyer']:
- # data['trade_satoshis'] = Logics.buyer_invoice_amount(order, request.user)[1]['invoice_amount']
+ if order.taker_bond:
+ if order.maker_bond.status == order.taker_bond.status == LNPayment.Status.LOCKED:
+ # Seller sees the amount he sends
+ if data['is_seller']:
+ data['trade_satoshis'] = order.last_satoshis
+ # Buyer sees the amount he receives
+ elif data['is_buyer']:
+ data['trade_satoshis'] = Logics.buyer_invoice_amount(order, request.user)[1]['invoice_amount']
# 5) If status is 'waiting for maker bond' and user is MAKER, reply with a MAKER hold invoice.
if order.status == Order.Status.WFB and data['is_maker']:
diff --git a/frontend/src/components/TradeBox.js b/frontend/src/components/TradeBox.js
index 89f0cd8a..1d3c6e72 100644
--- a/frontend/src/components/TradeBox.js
+++ b/frontend/src/components/TradeBox.js
@@ -513,6 +513,18 @@ handleRatingChange=(e)=>{
)
}
+ showOrderExpired(){
+ return(
+
+
+
+ The order has expired
+
+
+
+ )
+ }
+
showChat(sendFiatButton, receivedFiatButton, openDisputeButton){
return(
@@ -610,7 +622,8 @@ handleRatingChange=(e)=>{
{/* Trade Finished - TODO Needs more planning */}
{this.props.data.statusCode == 11 ? this.showInDisputeStatement() : ""}
-
+ {/* Order has expired */}
+ {this.props.data.statusCode == 5 ? this.showOrderExpired() : ""}
{/* TODO */}
{/* */}
{/* */}