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

@@ -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"