update queue assign and member discount change

This commit is contained in:
Aung Myo
2017-07-11 18:26:36 +06:30
parent 28c51300cf
commit 600e8e47f4
2 changed files with 10 additions and 11 deletions

View File

@@ -86,7 +86,7 @@ class Crm::DiningQueuesController < BaseCrmController
table_id = params[:table_id] table_id = params[:table_id]
status = queue.update_attributes(dining_facility_id: table_id,status:"Assign") status = queue.update_attributes(dining_facility_id: table_id,status:"Assign")
status = DiningFacility.find(table_id).update_attributes(status: "occupied") # status = DiningFacility.find(table_id).update_attributes(status: "occupied")
if status == true if status == true

View File

@@ -154,11 +154,12 @@ class Origami::DiscountsController < BaseOrigamiController
# Control for Paypar Cloud # Control for Paypar Cloud
begin begin
response = HTTParty.post(url, response = HTTParty.post(url,
:body => { generic_customer_id:generic_customer_id , :body => { account_no: nil,
generic_customer_id:generic_customer_id ,
campaign_type_id: campaign_type_id, campaign_type_id: campaign_type_id,
receipt_no: receipt_no, receipt_no: receipt_no,
merchant_uid:merchant_uid, merchant_uid:merchant_uid,
discount_method:arr.to_json, discount_method:arr,
total_sale_transaction_amount: sale.grand_total, total_sale_transaction_amount: sale.grand_total,
auth_token:auth_token}.to_json, auth_token:auth_token}.to_json,
:headers => { :headers => {
@@ -179,20 +180,18 @@ class Origami::DiscountsController < BaseOrigamiController
response = { status: false, message: "Can't open membership server "} response = { status: false, message: "Can't open membership server "}
end end
puts response.to_json
table_id = sale.bookings[0].dining_facility_id table_id = sale.bookings[0].dining_facility_id
table_type = DiningFacility.find(table_id).type table_type = DiningFacility.find(table_id).type
# Re-calc All Amount in Sale # Re-calc All Amount in Sale
if response["status"] == true if response["status"] == true
sale.compute_by_sale_items(sale_id, sale.sale_items, response["rebate_earned"].to_f,"member_discount") sale.compute_by_sale_items(sale_id, sale.sale_items, response["discount_earned"])
result = {:status=> "Success", :table_id => table_id, :table_type => table_type,:table_type => table_type }
end
if response[:status] == false
result = {:status=> "Success", :table_id => table_id, :table_type => table_type,:table_type => table_type,:url_status => response[:status],:url_message => response[:message] }
end end
result = {:status=> "Success", :table_id => table_id,:table_type => table_type }
# if response["status"] == false
# result = {:status=> "Success", :table_id => table_id,:table_type => table_type,:url_status => response[:status],:url_message => response[:message] }
# end
render :json => result.to_json render :json => result.to_json
end end