update member discount and seed for detail
This commit is contained in:
@@ -49,21 +49,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
#get customer amount
|
||||
@customer = Customer.find(params[:id])
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
# get member information
|
||||
total = Customer.get_member_account(@customer)
|
||||
|
||||
|
||||
@balance = 0.00
|
||||
@accountable_type = ''
|
||||
if total["status"]==true
|
||||
total["data"].each do |res|
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
@balance += res["balance"]
|
||||
# @accountable_type = res["accountable_type"]
|
||||
@accountable_type = "Rebate Balance"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# @response = ""
|
||||
#end customer amount
|
||||
|
||||
|
||||
@@ -170,37 +170,36 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
response = {status: false, message: "Can't open membership server "}
|
||||
|
||||
rescue Net::OpenTimeout
|
||||
|
||||
response = { status: false , message: "Can't open membership server "}
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false, message: "Can't open membership server "}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false, message: "Can't open membership server "}
|
||||
end
|
||||
# {"status":true,"discount_earned":360.0,"is_bonus":false}
|
||||
# {"status":false,"message":"Can't open membership server "}
|
||||
|
||||
|
||||
puts "ssssssssss"
|
||||
puts response.to_json["status"]
|
||||
puts response["status"]
|
||||
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table_type = DiningFacility.find(table_id).type
|
||||
|
||||
puts response.to_json
|
||||
# Re-calc All Amount in Sale
|
||||
if response["status"] == true
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, response["discount_earned"])
|
||||
discount_amount = response["discount_earned"]
|
||||
if response["discount_bonus_earned"]
|
||||
discount_amount = discount_amount + response["discount_bonus_earned"]
|
||||
end
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, discount_amount, 'member_discount')
|
||||
result = {:status=> "Success", :table_id => table_id,:table_type => table_type }
|
||||
end
|
||||
if response[:status] == false
|
||||
result = {:status=> response[:message], :table_id => table_id,:table_type => table_type }
|
||||
end
|
||||
if response["status"] == 500
|
||||
result = {:status=> response["message"], :table_id => table_id,:table_type => table_type }
|
||||
|
||||
if response["status"] == "500"
|
||||
result = {:status=> response["error"], :table_id => table_id,:table_type => table_type }
|
||||
end
|
||||
if !response.nil?
|
||||
if response[:status] == false
|
||||
result = {:status=> response[:message], :table_id => table_id,:table_type => table_type }
|
||||
end
|
||||
end
|
||||
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user