puma deleted by sqa-1804-001

This commit is contained in:
phyusin
2018-04-25 15:14:40 +06:30
28 changed files with 263 additions and 115 deletions

View File

@@ -156,13 +156,17 @@ class DiningFacility < ApplicationRecord
table = DiningFacility.find(table_id)
#Send to background job for processing
# CheckInBookingJob.perform_later(table)
ActionCable.server.broadcast "check_in_booking_channel",table: table
#if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "check_in_booking_channel",table: table
#end
end
def self.checkin_time
table = DiningFacility.get_checkin_booking
if table.length > 0
ActionCable.server.broadcast "checkin_channel",table: table
if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "checkin_channel",table: table
end
end
end

View File

@@ -60,8 +60,8 @@ class License
return true
end
else
# @license = Marshal.load(cache_license)
# assign(aes_key, aes_iv)
@license = Marshal.load(cache_license)
assign(aes_key, aes_iv)
# Rails.logger.info 'API License'
return true
end

View File

@@ -62,7 +62,8 @@ class MyAesCrypt
shop_json = JSON.parse(shop_data)
shop_json["data"].each do |j|
if j["lookup"] == from
if j["lookup"] == from
# add [0...44] for production cloud for remove \n
if(j["value"]["key"] == token)
return true
end

View File

@@ -321,7 +321,9 @@ class Order < ApplicationRecord
end
else
msg = ' Print Error ! Please contact to service'
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
#if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
#end
if !sidekiq.nil?
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
else
@@ -335,7 +337,9 @@ class Order < ApplicationRecord
end
end
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
#if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
#end
end
end
@@ -372,7 +376,9 @@ class Order < ApplicationRecord
type = 'order'
#Send to background job for processing
# OrderBroadcastJob.perform_later(table,type)
#if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "order_channel",table: table,type:type
#end
end
end
@@ -526,7 +532,9 @@ class Order < ApplicationRecord
end
end
end
ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status
#if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status
#end
end
private

View File

@@ -7,45 +7,48 @@ class OrderReservation < ApplicationRecord
has_many :order_reservation_items
belongs_to :delivery
scope :latest_order, -> { order("order_reservation_id desc, requested_time asc") }
SEND_TO_KITCHEN = "send_to_kitchen"
READY_TO_DELIVERY = "ready_to_deliver"
DELIVERED = "delivered"
COMPLETED = "completed"
def self.addOrderReservationInfo(params)
check_order_reservation = OrderReservation.where("transaction_ref = ?",params[:reference])
def self.addOrderReservationInfo(order_reserve)
Rails.logger.debug order_reserve.to_s
check_order_reservation = OrderReservation.where("transaction_ref = ?",order_reserve[:reference])
if check_order_reservation.empty?
order_reservation = OrderReservation.new
order_reservation.order_reservation_type = params[:order_type]
order_reservation.customer_id = params[:cus_info]
order_reservation.requested_time = DateTime.parse(params[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
order_reservation.callback_url = params[:callback_url]
order_reservation.transaction_ref = params[:reference]
if params[:order_info]
order_reservation.item_count = params[:order_info][:items].count
order_reservation.payment_type = params[:payment_info][:payment_type]
order_reservation.payment_status = params[:payment_info][:payment_status]
order_reservation.payment_ref = params[:payment_info][:payment_ref]
order_reservation.total_amount = params[:payment_info][:sub_total]
order_reservation.total_tax = params[:payment_info][:total_tax]
order_reservation.discount_amount = params[:payment_info][:discount_amount]
order_reservation.grand_total = params[:payment_info][:grand_total]
order_reservation.order_remark = params[:order_info][:order_remark]
order_reservation.order_reservation_type = order_reserve[:order_type]
order_reservation.customer_id = order_reserve[:cus_info]
order_reservation.requested_time = DateTime.parse(order_reserve[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
order_reservation.callback_url = order_reserve[:callback_url]
order_reservation.transaction_ref = order_reserve[:reference]
if order_reserve[:order_info]
order_reservation.item_count = order_reserve[:order_info][:items].count
order_reservation.payment_type = order_reserve[:payment_info][:payment_type]
order_reservation.payment_status = order_reserve[:payment_info][:payment_status]
order_reservation.payment_ref = order_reserve[:payment_info][:payment_ref]
order_reservation.total_amount = order_reserve[:payment_info][:sub_total]
order_reservation.total_tax = order_reserve[:payment_info][:total_tax]
order_reservation.discount_amount = order_reserve[:payment_info][:discount_amount]
order_reservation.grand_total = order_reserve[:payment_info][:grand_total]
order_reservation.order_remark = order_reserve[:order_info][:order_remark]
end
if params[:reservation_info]
order_reservation.total_customer = params[:reservation_info][:total_user]
order_reservation.reservation_remark = params[:reservation_info][:reservation_note]
if order_reserve[:reservation_info]
order_reservation.total_customer = order_reserve[:reservation_info][:total_user]
order_reservation.reservation_remark = order_reserve[:reservation_info][:reservation_note]
end
order_reservation.save!
if params[:order_info][:items]
params[:order_info][:items].each do |oritem|
if order_reserve[:order_info][:items]
order_reserve[:order_info][:items].each do |oritem|
OrderReservationItem.process_order_reservation_item(oritem[:product_code],oritem[:item_instance_code],oritem[:product_name],oritem[:product_alt_name],
oritem[:account_id],oritem[:qty],oritem[:price],oritem[:unit_price],
oritem[:options],nil,order_reservation.id)
end
end
if params[:delivery_info]
Delivery.addDeliveryInfo(params[:delivery_info],order_reservation.id)
if order_reserve[:delivery_info]
Delivery.addDeliveryInfo(order_reserve[:delivery_info],order_reservation.id)
end
return order_reservation.id, true
else
@@ -219,14 +222,30 @@ class OrderReservation < ApplicationRecord
end
def self.send_status_to_ordering(url,ref_no,status)
base_url = "http://192.168.1.186:3002"
base_url = 'https://api.doemal.com'
token = '3T-tnlYtFJ-5Z1vY6XQqxQ'
order_reservation = Lookup.collection_of("order_reservation")
if !order_reservation.empty?
order_reservation.each do |order_reserve|
if order_reserve[0] == 'BaseURL'
base_url = order_reserve[1]
elsif order_reserve[0] == 'Token'
token = order_reserve[1]
end
end
else
Rails.logger.debug "Add order reservation BaseURL "
response = {status: false}
end
Rails.logger.debug "Doemal URL" + base_url
post_url = base_url + url
begin
response = HTTParty.post(post_url,
:body => { id: ref_no, status: status}.to_json,
:headers => {
'Authorization' => 'Token token=3T-tnlYtFJ-5Z1vY6XQqxQ',
'Authorization' => 'Token token='+token,
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
}, :timeout => 10

View File

@@ -607,7 +607,9 @@ class SalePayment < ApplicationRecord
type = 'payment'
#Send to background job for processing
# OrderBroadcastJob.perform_later(table,type)
ActionCable.server.broadcast "order_channel",table: table,type:type
#if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "order_channel",table: table,type:type
#end
end
end
end