kbz pay fixed

This commit is contained in:
Zoey
2019-06-26 12:18:17 +06:30
parent b948f10209
commit 2e306a6339
4 changed files with 17 additions and 22 deletions

View File

@@ -168,7 +168,7 @@ class Origami::PaymentsController < BaseOrigamiController
# salePayment = SalePayment.find(sale_payment_id)
# salePayment.process_kbz_payment(salePayment.sale_id, sale_data.grand_total, cash, 'paid')
# else
sp = SalePayment.where('sale_id=? and payment_method=? and payment_status=?', sale_id, 'kbzpay', 'paid').last
# sp = SalePayment.where('sale_id=? and payment_method=? and payment_status=?', sale_id, 'kbzpay', 'paid').last
if is_kbz == 'false'
Rails.logger.info '################ CASH PAYMENT #################'
sale_payment = SalePayment.new

View File

@@ -631,7 +631,6 @@ class SalePayment < ApplicationRecord
def sale_update_payment_status(paid_amount,check_foc = false)
#update amount_outstanding
Rails.logger.info '####### SALE UPDATE PAYMENT STATUS #######'
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
self.sale.save!
self.sale.amount_changed = self.sale.amount_received.to_f - self.sale.grand_total.to_f
@@ -652,15 +651,11 @@ class SalePayment < ApplicationRecord
if spay.payment_method == KbzPay::KBZ_PAY
is_kbz_pay = 1
end
if spay.payment_method == "cash" || spay.payment_method == "foc" || spay.payment_method == "creditnote" || spay.payment_method == 'kbzpay'
if spay.payment_method == "cash" || spay.payment_method == "foc" || spay.payment_method == "creditnote" || spay.payment_method == KbzPay::KBZ_PAY
method_status = true
end
end
Rails.logger.info self.sale.grand_total
Rails.logger.info all_received_amount
Rails.logger.info '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
if (self.sale.grand_total <= all_received_amount) && method_status
if is_credit == 0
self.sale.payment_status = "paid"

View File

@@ -21,11 +21,11 @@ class ActionController::Base
end
else
# check for license file
if check_license
current_license(ENV["SX_PROVISION_URL"])
else
redirect_to activate_path
end
# if check_license
# current_license(ENV["SX_PROVISION_URL"])
# else
# redirect_to activate_path
# end
end
end

View File

@@ -1,10 +1,10 @@
application_path="#{File.expand_path("../..", __FILE__)}"
directory application_path
#environment ENV.fetch("RAILS_ENV") { "production" }
environment "production"
pidfile "#{application_path}/tmp/puma/pid"
state_path "#{application_path}/tmp/puma/state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
port ENV.fetch("PORT") { 62158 }
workers 2
preload_app!
# application_path="#{File.expand_path("../..", __FILE__)}"
# directory application_path
# #environment ENV.fetch("RAILS_ENV") { "production" }
# environment "production"
# pidfile "#{application_path}/tmp/puma/pid"
# state_path "#{application_path}/tmp/puma/state"
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
# port ENV.fetch("PORT") { 62158 }
# workers 2
# preload_app!