From 600e8e47f48814a4cab052c539cb95f52b54bb48 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 11 Jul 2017 18:26:36 +0630 Subject: [PATCH] update queue assign and member discount change --- .../crm/dining_queues_controller.rb | 2 +- .../origami/discounts_controller.rb | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index 9c5f8b73..22351395 100644 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -86,7 +86,7 @@ class Crm::DiningQueuesController < BaseCrmController table_id = params[:table_id] 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 diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index 2b6d4383..1d1d5f83 100644 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -154,11 +154,12 @@ class Origami::DiscountsController < BaseOrigamiController # Control for Paypar Cloud begin 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, receipt_no: receipt_no, merchant_uid:merchant_uid, - discount_method:arr.to_json, + discount_method:arr, total_sale_transaction_amount: sale.grand_total, auth_token:auth_token}.to_json, :headers => { @@ -179,20 +180,18 @@ class Origami::DiscountsController < BaseOrigamiController response = { status: false, message: "Can't open membership server "} end - puts response.to_json - table_id = sale.bookings[0].dining_facility_id table_type = DiningFacility.find(table_id).type # Re-calc All Amount in Sale if response["status"] == true - sale.compute_by_sale_items(sale_id, sale.sale_items, response["rebate_earned"].to_f,"member_discount") - result = {:status=> "Success", :table_id => table_id, :table_type => table_type,:table_type => table_type } + sale.compute_by_sale_items(sale_id, sale.sale_items, response["discount_earned"]) + 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 + 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 end