add new payment for aston request

This commit is contained in:
phyusin
2018-05-29 14:29:38 +06:30
parent 089630616d
commit 930e8d29d5
16 changed files with 397 additions and 40 deletions

View File

@@ -58,6 +58,8 @@ class SalePayment < ApplicationRecord
payment_status = junction_pay_payment
when "dinga"
payment_status,membership_data = dinga_payment
when "GiftVoucher"
payment_status = giftvoucher_payment
else
puts "it was something else"
end
@@ -485,6 +487,18 @@ class SalePayment < ApplicationRecord
end
def giftvoucher_payment
payment_status = false
self.payment_method = "giftvoucher"
self.payment_amount = self.received_amount
self.payment_reference = self.payment_reference
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
self.payment_status = "paid"
payment_method = self.save!
sale_update_payment_status(self.received_amount)
return payment_status
end
def sale_update_payment_status(paid_amount,check_foc = false)
#update amount_outstanding
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f