update rebate amount in payment

This commit is contained in:
Aung Myo
2017-06-13 18:46:43 +06:30
parent a600c233d5
commit 8a6c0bf059
2 changed files with 18 additions and 7 deletions

View File

@@ -27,10 +27,11 @@ class Origami::PaymentsController < BaseOrigamiController
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
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}.to_json,
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'
@@ -38,11 +39,16 @@ class Origami::PaymentsController < BaseOrigamiController
)
@balance = 0.00
response["data"].each do |res|
if res["accountable_type"] == "RebateAccount"
@balance = res["balance"]
end
@accountable_type = ''
if response["data"]==true
response["data"].each do |res|
if res["accountable_type"] == "RebateAccount"
@balance = res["balance"]
@accountable_type = res["accountable_type"]
end
end
end
#end customer amount
@sale_data.sale_payments.each do |spay|