order reservation
This commit is contained in:
@@ -36,5 +36,37 @@ class Origami::OrderReservationController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
def send_status
|
||||
base_url = "http://192.168.1.186:3002"
|
||||
post_url = base_url + params[:url]
|
||||
# status = params[:status]
|
||||
if params[:status] == "cancel"
|
||||
status = "rejected"
|
||||
else
|
||||
status = params[:status]
|
||||
end
|
||||
|
||||
begin
|
||||
response = HTTParty.post(post_url,
|
||||
:body => { id: params[:ref_no], status: status}.to_json,
|
||||
:headers => {
|
||||
'Authorization' => 'Token token=3T-tnlYtFJ-5Z1vY6XQqxQ',
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=3'
|
||||
}, :timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
Rails.logger.debug "Get Doemal Status "
|
||||
Rails.logger.debug response.to_json
|
||||
render :json => response
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user