diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index bdae0f0e..4ac519b0 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -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| diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index f582007a..a6a6dd41 100644 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -15,7 +15,6 @@ Customer : <%= @sale_data.customer.name%> - Points : <%= @balance %> @@ -70,6 +69,12 @@ Grand Total <%=@sale_data.grand_total rescue 0%> + <%if @balance > 0%> + + <%= @accountable_type %> + <%=@balance%> + + <% end %>