add new payment for aston request
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user