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:
@@ -16,6 +16,13 @@ class Payment
|
|||||||
attr_accessor :errors, :customer_id, :account_id, :payment_method_id, :total_amount
|
attr_accessor :errors, :customer_id, :account_id, :payment_method_id, :total_amount
|
||||||
validates_presence_of :customer_id, :account_id, :payment_method_id, :total_amount
|
validates_presence_of :customer_id, :account_id, :payment_method_id, :total_amount
|
||||||
validates :total_amount, numericality: true
|
validates :total_amount, numericality: true
|
||||||
|
|
||||||
|
#Required dependency for ActiveModel::Errors
|
||||||
|
extend ActiveModel::Naming
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@errors = ActiveModel::Errors.new(self)
|
||||||
|
end
|
||||||
|
|
||||||
def save
|
def save
|
||||||
payment = Quickbooks::Model::Payment.new
|
payment = Quickbooks::Model::Payment.new
|
||||||
@@ -31,7 +38,7 @@ class Payment
|
|||||||
begin
|
begin
|
||||||
Qbo.get_base(:payment).service.update(payment)
|
Qbo.get_base(:payment).service.update(payment)
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
errors.add(e.message)
|
@errors.add(e.message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user