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 = SalePayment.find(sale_payment_id)
# salePayment.process_kbz_payment(salePayment.sale_id, sale_data.grand_total, cash, 'paid') # salePayment.process_kbz_payment(salePayment.sale_id, sale_data.grand_total, cash, 'paid')
# else # 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' if is_kbz == 'false'
Rails.logger.info '################ CASH PAYMENT #################' Rails.logger.info '################ CASH PAYMENT #################'
sale_payment = SalePayment.new sale_payment = SalePayment.new

View File

@@ -631,7 +631,6 @@ class SalePayment < ApplicationRecord
def sale_update_payment_status(paid_amount,check_foc = false) def sale_update_payment_status(paid_amount,check_foc = false)
#update amount_outstanding #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.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
self.sale.save! self.sale.save!
self.sale.amount_changed = self.sale.amount_received.to_f - self.sale.grand_total.to_f 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 if spay.payment_method == KbzPay::KBZ_PAY
is_kbz_pay = 1 is_kbz_pay = 1
end 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 method_status = true
end end
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 (self.sale.grand_total <= all_received_amount) && method_status
if is_credit == 0 if is_credit == 0
self.sale.payment_status = "paid" self.sale.payment_status = "paid"

View File

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

View File

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