update sale and customer

This commit is contained in:
Aung Myo
2017-06-14 18:13:13 +06:30
parent 914069e3af
commit 2da2edc5ec
8 changed files with 112 additions and 166 deletions

View File

@@ -51,34 +51,14 @@ class Crm::CustomersController < BaseCrmController
#get customer amount
@customer = Customer.find(params[:id])
response = Customer.get_member_account(@customer)
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
response = HTTParty.get(url, :body => { membership_id: @customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
)
if(response["status"] == true)
@membership = response["data"]
else
@membership = 0
end
# @type = "-"
# @balance = 0.00
# response["data"].each do |res|
# if res["accountable_type"] == "RebateAccount"
# @balance = res["balance"]
# @type = "RebateAccount"
# end
# end
#end customer amount
end