From 2e306a6339b0820c0e7c96147a73cd80e6100a11 Mon Sep 17 00:00:00 2001 From: Zoey Date: Wed, 26 Jun 2019 12:18:17 +0630 Subject: [PATCH] kbz pay fixed --- .../origami/payments_controller.rb | 2 +- app/models/sale_payment.rb | 7 +------ config/initializers/action_controller.rb | 10 +++++----- config/puma.rb | 20 +++++++++---------- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 1311ef7c..560b43f3 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -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 diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 21e8fda6..db44dd10 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -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" diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 205c330a..85f38ec5 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -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 diff --git a/config/puma.rb b/config/puma.rb index fd89392f..6a545bed 100755 --- a/config/puma.rb +++ b/config/puma.rb @@ -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!