@@ -1621,14 +1621,18 @@ func (i *jsonAPIHandler) POSTOrderConfirmation(w http.ResponseWriter, r *http.Re
1621
1621
ErrorResponse (w , http .StatusBadRequest , err .Error ())
1622
1622
return
1623
1623
}
1624
+
1625
+ order , _ := i .node .GetOrder (conf .OrderID )
1626
+ v5contract := order .Contract
1627
+
1624
1628
contract , state , funded , records , _ , _ , err := i .node .Datastore .Sales ().GetByOrderId (conf .OrderID )
1625
1629
if err != nil {
1626
1630
ErrorResponse (w , http .StatusNotFound , err .Error ())
1627
1631
return
1628
1632
}
1629
1633
1630
1634
// TODO: Remove once broken contracts are migrated
1631
- lookupCoin := contract .BuyerOrder .Payment .AmountCurrency .Code
1635
+ lookupCoin := v5contract .BuyerOrder .Payment .AmountCurrency .Code
1632
1636
_ , err = i .node .LookupCurrency (lookupCoin )
1633
1637
if err != nil {
1634
1638
log .Warningf ("invalid BuyerOrder.Payment.Coin (%s) on order (%s)" , lookupCoin , conf .OrderID )
@@ -1776,7 +1780,7 @@ func (i *jsonAPIHandler) POSTRefund(w http.ResponseWriter, r *http.Request) {
1776
1780
ErrorResponse (w , http .StatusBadRequest , err .Error ())
1777
1781
return
1778
1782
}
1779
- contract , state , _ , records , _ , _ , err := i .node .Datastore .Sales ().GetByOrderId (can .OrderID )
1783
+ _ , state , _ , records , _ , _ , err := i .node .Datastore .Sales ().GetByOrderId (can .OrderID )
1780
1784
if err != nil {
1781
1785
ErrorResponse (w , http .StatusNotFound , "order not found" )
1782
1786
return
@@ -1787,14 +1791,17 @@ func (i *jsonAPIHandler) POSTRefund(w http.ResponseWriter, r *http.Request) {
1787
1791
}
1788
1792
1789
1793
// TODO: Remove once broken contracts are migrated
1790
- lookupCoin := contract .BuyerOrder .Payment .AmountCurrency .Code
1794
+ order , _ := i .node .GetOrder (can .OrderID )
1795
+ v5contract := order .Contract
1796
+
1797
+ lookupCoin := v5contract .BuyerOrder .Payment .AmountCurrency .Code
1791
1798
_ , err = i .node .LookupCurrency (lookupCoin )
1792
1799
if err != nil {
1793
1800
log .Warningf ("invalid BuyerOrder.Payment.Coin (%s) on order (%s)" , lookupCoin , can .OrderID )
1794
1801
//contract.BuyerOrder.Payment.Coin = paymentCoin.String()
1795
1802
}
1796
1803
1797
- err = i .node .RefundOrder (contract , records )
1804
+ err = i .node .RefundOrder (v5contract , records )
1798
1805
if err != nil {
1799
1806
ErrorResponse (w , http .StatusInternalServerError , err .Error ())
1800
1807
return
@@ -1980,14 +1987,17 @@ func (i *jsonAPIHandler) POSTOrderFulfill(w http.ResponseWriter, r *http.Request
1980
1987
ErrorResponse (w , http .StatusBadRequest , err .Error ())
1981
1988
return
1982
1989
}
1983
- contract , state , _ , records , _ , _ , err := i .node .Datastore .Sales ().GetByOrderId (fulfill .OrderId )
1990
+ _ , state , _ , records , _ , _ , err := i .node .Datastore .Sales ().GetByOrderId (fulfill .OrderId )
1984
1991
if err != nil {
1985
1992
ErrorResponse (w , http .StatusNotFound , "order not found" )
1986
1993
return
1987
1994
}
1988
1995
1989
1996
// TODO: Remove once broken contracts are migrated
1990
- lookupCoin := contract .BuyerOrder .Payment .AmountCurrency .Code
1997
+ order , _ := i .node .GetOrder (fulfill .OrderId )
1998
+ v5contract := order .Contract
1999
+
2000
+ lookupCoin := v5contract .BuyerOrder .Payment .AmountCurrency .Code
1991
2001
_ , err = i .node .LookupCurrency (lookupCoin )
1992
2002
if err != nil {
1993
2003
log .Warningf ("invalid BuyerOrder.Payment.Coin (%s) on order (%s)" , lookupCoin , fulfill .OrderId )
@@ -1998,7 +2008,7 @@ func (i *jsonAPIHandler) POSTOrderFulfill(w http.ResponseWriter, r *http.Request
1998
2008
ErrorResponse (w , http .StatusBadRequest , "order must be in state AWAITING_FULFILLMENT or PARTIALLY_FULFILLED to fulfill" )
1999
2009
return
2000
2010
}
2001
- err = i .node .FulfillOrder (& fulfill , contract , records )
2011
+ err = i .node .FulfillOrder (& fulfill , v5contract , records )
2002
2012
if err != nil {
2003
2013
ErrorResponse (w , http .StatusInternalServerError , err .Error ())
2004
2014
return
@@ -2326,7 +2336,8 @@ func (i *jsonAPIHandler) POSTReleaseEscrow(w http.ResponseWriter, r *http.Reques
2326
2336
}
2327
2337
2328
2338
// TODO: Remove once broken contracts are migrated
2329
- lookupCoin := contract .BuyerOrder .Payment .AmountCurrency .Code
2339
+ order , _ := i .node .GetOrder (rel .OrderID )
2340
+ lookupCoin := order .Contract .BuyerOrder .Payment .AmountCurrency .Code
2330
2341
_ , err = i .node .LookupCurrency (lookupCoin )
2331
2342
if err != nil {
2332
2343
log .Warningf ("invalid BuyerOrder.Payment.Coin (%s) on order (%s)" , lookupCoin , rel .OrderID )
0 commit comments