kbzpay
This commit is contained in:
@@ -102,7 +102,6 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
|
|
||||||
#TODO :: KBZPAY ( QR )
|
#TODO :: KBZPAY ( QR )
|
||||||
# On/Off setting ( show or not qr )
|
# On/Off setting ( show or not qr )
|
||||||
# qrCode = "00020101021202021110500346KBZ005ab0ed5c1ed09d1c4585ff1313170389160831435294600062000040732kp1e78f7efddca190042638341afb88d50200006KBZPay0106KBZPay5303MMK5802MM62170813PAY_BY_QRCODE64060002my6304FBBD"
|
# qrCode = "00020101021202021110500346KBZ005ab0ed5c1ed09d1c4585ff1313170389160831435294600062000040732kp1e78f7efddca190042638341afb88d50200006KBZPay0106KBZPay5303MMK5802MM62170813PAY_BY_QRCODE64060002my6304FBBD"
|
||||||
@@ -169,8 +168,8 @@ 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 sp.nil? #is_kbz
|
if is_kbz == 'false'
|
||||||
Rails.logger.info '################ CASH PAYMENT #################'
|
Rails.logger.info '################ CASH PAYMENT #################'
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
if path.include? ("credit_payment")
|
if path.include? ("credit_payment")
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
def self.get_kbz_pay_amount(sale_id, current_user)
|
def self.get_kbz_pay_amount(sale_id, current_user)
|
||||||
amount = 0
|
amount = 0
|
||||||
sale_payment = SalePayment.where('sale_id=? and payment_status!=?', sale_id, 'dead').last
|
sale_payment = SalePayment.where('sale_id=? and payment_method=? and payment_status!=?', sale_id, KbzPay::KBZ_PAY, 'dead').last
|
||||||
if !sale_payment.nil?
|
if !sale_payment.nil?
|
||||||
if sale_payment.payment_status == 'pending'
|
if sale_payment.payment_status == 'pending'
|
||||||
amount = KbzPay.query(sale_payment.id, current_user)
|
amount = KbzPay.query(sale_payment.id, current_user)
|
||||||
@@ -631,6 +631,7 @@ 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
|
||||||
@@ -656,6 +657,10 @@ class SalePayment < ApplicationRecord
|
|||||||
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"
|
||||||
@@ -669,7 +674,7 @@ class SalePayment < ApplicationRecord
|
|||||||
self.sale.payment_status = "foc"
|
self.sale.payment_status = "foc"
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_kbz_pay > 0
|
if is_kbz_pay == 1
|
||||||
self.sale.payment_status = 'paid'
|
self.sale.payment_status = 'paid'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
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"
|
||||||
|
|||||||
Reference in New Issue
Block a user