-
Notifications
You must be signed in to change notification settings - Fork 303
/
deposit.rb
44 lines (36 loc) · 1.85 KB
/
deposit.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# == Business Rules
# * There must be at least one line item included in a create request
# * Any transaction that funds the Undeposited Funds account can be linked to a Deposit object with Deposit.Line.LinkedTxn
module Quickbooks
module Model
class Deposit < BaseModel
include DocumentNumbering
include HasLineItems
#== Constants
XML_COLLECTION_MODE = "Deposit"
XML_NODE = "Deposit"
REST_RESOURCE = "deposit"
xml_accessor :id, :from => "Id", :as => Integer
xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
xml_accessor :meta_data, :from => 'MetaData', :as => MetaData
xml_accessor :custom_fields, :from => 'CustomField', :as => [CustomField]
xml_accessor :auto_doc_number, :from => 'AutoDocNumber' # See auto_doc_number! method below for usage
xml_accessor :doc_number, :from => 'DocNumber'
xml_accessor :txn_date, :from => 'TxnDate', :as => Date
xml_accessor :department_ref, :from => 'DepartmentRef', :as => BaseReference
xml_accessor :currency_ref, :from => 'CurrencyRef', :as => BaseReference
xml_accessor :exchange_rate, :from => 'ExchangeRate', :as => BigDecimal, :to_xml => to_xml_big_decimal
xml_accessor :private_note, :from => 'PrivateNote'
xml_accessor :txn_status, :from => 'TxnStatus'
xml_accessor :line_items, :from => 'Line', :as => [DepositLineItem]
xml_accessor :txn_tax_detail, :from => 'TxnTaxDetail', :as => TransactionTaxDetail
xml_accessor :deposit_to_account_ref, :from => 'DepositToAccountRef', :as => BaseReference
xml_accessor :total, :from => 'TotalAmt', :as => BigDecimal, :to_xml => to_xml_big_decimal
reference_setters :department_ref, :currency_ref, :deposit_to_account_ref
#== Validations
validate :line_item_size
validate :document_numbering
private
end
end
end