mirror of
https://github.com/Blockstream/satellite-api.git
synced 2025-02-23 14:00:26 +01:00
Added order param for bump and cancellation errors
This commit is contained in:
parent
dae61a669b
commit
175f13ed95
2 changed files with 4 additions and 4 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
4
main.rb
4
main.rb
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue