check order reservation update and payment route fixed

This commit is contained in:
phyusin
2018-06-08 16:50:06 +06:30
parent 630e82a306
commit c8642548e5
9 changed files with 111 additions and 101 deletions

View File

@@ -173,6 +173,7 @@ class OrderReservation < ApplicationRecord
end
def self.send_status_to_ordering(url,ref_no,status,waiting_time=nil,min_type=nil,reason=nil)
puts "send status to ordering"
base_url = 'https://api.doemal.com'
token = '3T-tnlYtFJ-5Z1vY6XQqxQ'
order_reservation = Lookup.collection_of("order_reservation")
@@ -191,19 +192,19 @@ class OrderReservation < ApplicationRecord
Rails.logger.debug "Doemal URL" + base_url
post_url = base_url + url
if status == 'processed'
status = 'send_to_kitchen'
elsif status == 'delivered'
status = 'ready_to_deliver'
elsif status == 'completed'
status = 'delivered'
else
status = status
end
# if status == 'processed'
# status = 'send_to_kitchen'
# elsif status == 'delivery'
# status = 'ready_to_delivery'
# elsif status == 'completed'
# status = 'delivered'
# else
# status = status
# end
if waiting_time != ""
if (!min_type.nil? && !waiting_time.nil?) && (min_type != "" && waiting_time != "")
send_params = {id: ref_no,type: min_type, waiting_time: waiting_time, status: status}
elsif reason != ""
elsif !reason.nil? && reason != ""
send_params = {id: ref_no, status: status, reason: reason}
else
send_params = {id: ref_no, status: status}
@@ -226,7 +227,7 @@ class OrderReservation < ApplicationRecord
rescue SocketError
response = { status: false}
end
Rails.logger.debug "Get Doemal Status "
Rails.logger.debug "Get Doemal Status => #{send_params}"
Rails.logger.debug response.to_json
return response
end