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

View File

@@ -69,20 +69,8 @@ class Origami::HomeController < BaseOrigamiController
def get_customer
@customer = Customer.find(params[:customer_id])
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'
}
)
response = Customer.get_member_account(@customer)
respond_to do |format|
format.js do

View File

@@ -92,6 +92,16 @@ class Transactions::SalesController < ApplicationController
end
end
def void
@sale = params[:sale_id]
@reason = Lookup.where("lookup_type = 'void_reason'")
end
def manual_void_sale
sale_id = params[:sale_id]
end
private
# Use callbacks to share common setup or constraints between actions.
def set_transactions_sale