mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Update payment.rb
This commit is contained in:
@@ -18,11 +18,25 @@ class Payment
|
|||||||
validates :total_amount, numericality: true
|
validates :total_amount, numericality: true
|
||||||
|
|
||||||
def save
|
def save
|
||||||
# TODO Save the payment
|
payment = Quickbooks::Model::Payment.new
|
||||||
|
|
||||||
|
payment.customer_ref = Qbo.get_base(:account).service.fetch_by_id(@customer_id)
|
||||||
|
|
||||||
|
payment.deposit_to_account_ref = Qbo.get_base(:account).service.fetch_by_id(@account_id)
|
||||||
|
|
||||||
|
payment.payment_method_ref = Qbo.get_base(:payment_method).service.fetch_by_id(@payment_id)
|
||||||
|
|
||||||
|
payment.total = @total_amount
|
||||||
|
|
||||||
|
begin
|
||||||
|
Qbo.get_base(:payment).service.update(payment)
|
||||||
|
rescue Exception => e
|
||||||
|
@errors.add(e.message)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def save!
|
def save!
|
||||||
# TODO Save! the payment
|
save
|
||||||
end
|
end
|
||||||
|
|
||||||
# Dummy stub to make validtions happy.
|
# Dummy stub to make validtions happy.
|
||||||
|
|||||||
Reference in New Issue
Block a user