Added order param for bump and cancellation errors

This commit is contained in:
Jeremy Bokobza 2019-04-11 13:56:42 +01:00 committed by bteitelb
parent dae61a669b
commit 175f13ed95
2 changed files with 4 additions and 4 deletions

View file

@ -49,11 +49,11 @@ module Sinatra
halt 413, error_object("Bid too low", "Per byte bid cannot be below #{MIN_PER_BYTE_BID} millisatoshis per byte. The minimum bid for this message is #{min_bid} millisatoshis.", ERROR::CODES[:BID_TOO_SMALL]) halt 413, error_object("Bid too low", "Per byte bid cannot be below #{MIN_PER_BYTE_BID} millisatoshis per byte. The minimum bid for this message is #{min_bid} millisatoshis.", ERROR::CODES[:BID_TOO_SMALL])
end end
def order_bump_error def order_bump_error(order)
halt 400, error_object("Cannot bump order", "Order already #{order.status}", ERROR::CODES[:ORDER_BUMP_ERROR]) halt 400, error_object("Cannot bump order", "Order already #{order.status}", ERROR::CODES[:ORDER_BUMP_ERROR])
end end
def order_cancellation_error def order_cancellation_error(order)
halt 400, error_object("Cannot cancel order", "Order already #{order.status}", ERROR::CODES[:ORDER_CANCELLATION_ERROR]) halt 400, error_object("Cannot cancel order", "Order already #{order.status}", ERROR::CODES[:ORDER_CANCELLATION_ERROR])
end end

View file

@ -165,7 +165,7 @@ post '/order/:uuid/bump' do
order = get_and_authenticate_order order = get_and_authenticate_order
unless order.bump unless order.bump
order_bump_error order_bump_error(order)
end end
invoice = new_invoice(order, bid_increase) invoice = new_invoice(order, bid_increase)
@ -189,7 +189,7 @@ delete '/order/:uuid' do
order = get_and_authenticate_order order = get_and_authenticate_order
unless order.cancel! unless order.cancel!
order_cancellation_error order_cancellation_error(order)
end end
{:message => "order cancelled"}.to_json {:message => "order cancelled"}.to_json