Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/quickbooks/model/deposit_line_detail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ class DepositLineDetail < BaseModel
xml_accessor :check_num, :from => 'CheckNum'
xml_accessor :txn_type, :from => 'TxnType'
xml_accessor :custom_fields, :from => 'CustomField', :as => [CustomField]
xml_accessor :tax_code_ref, :from => 'TaxCodeRef', :as => BaseReference

reference_setters :class_ref, :account_ref, :payment_method_ref, :entity_ref
reference_setters :class_ref, :account_ref, :payment_method_ref, :entity_ref, :tax_code_ref

end
end
Expand Down
14 changes: 13 additions & 1 deletion spec/fixtures/deposit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
<PaymentMethodRef name="Cash">1</PaymentMethodRef>
</DepositLineDetail>
</Line>
<Line>
<Id>2</Id>
<LineNum>2</LineNum>
<Amount>13.77</Amount>
<DetailType>DepositLineDetail</DetailType>
<DepositLineDetail>
<Entity name="John Doe" type="CUSTOMER">59</Entity>
<AccountRef name="Sales Income">32</AccountRef>
<PaymentMethodRef name="Check">2</PaymentMethodRef>
<TaxCodeRef>NON</TaxCodeRef>
</DepositLineDetail>
</Line>
<DepositToAccountRef name="Checking">4</DepositToAccountRef>
<TotalAmt>200.00</TotalAmt>
<TotalAmt>213.27</TotalAmt>
</Deposit>
17 changes: 15 additions & 2 deletions spec/lib/quickbooks/model/deposit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
expect(deposit.txn_date).to eq(Date.new(2015, 3, 7))
expect(deposit.private_note).to eq("Deposit smoke test")
expect(deposit.txn_status).to be_nil
expect(deposit.line_items.size).to eq(2)
expect(deposit.line_items.size).to eq(3)
expect(deposit.deposit_to_account_ref.value).to eq("4")
expect(deposit.total).to eq(200.0)
expect(deposit.total).to eq(213.27)
expect(deposit.currency_ref.value).to eq('USD')
expect(deposit.exchange_rate).to be_nil
expect(deposit.line_items[1].deposit_line_detail.entity_ref.type).to eq('CUSTOMER')
Expand All @@ -36,6 +36,19 @@
expect(line_item2.deposit_line_detail.account_ref.name).to eq("Uncategorized Expense")
expect(line_item2.deposit_line_detail.payment_method_ref.value).to eq("1")
expect(line_item2.deposit_line_detail.payment_method_ref.name).to eq("Cash")

line_item3 = deposit.line_items[2]
expect(line_item3.id).to eq("2")
expect(line_item3.amount).to eq(13.77)
expect(line_item3.deposit_line_detail?).to eq(true)
expect(line_item3.deposit_line_detail.entity_ref.type).to eq('CUSTOMER')
expect(line_item3.deposit_line_detail.entity_ref.name).to eq('John Doe')
expect(line_item3.deposit_line_detail.entity_ref.value).to eq('59')
expect(line_item3.deposit_line_detail.account_ref.value).to eq("32")
expect(line_item3.deposit_line_detail.account_ref.name).to eq("Sales Income")
expect(line_item3.deposit_line_detail.payment_method_ref.value).to eq("2")
expect(line_item3.deposit_line_detail.payment_method_ref.name).to eq("Check")
expect(line_item3.deposit_line_detail.tax_code_ref.to_s).to eq('NON')
end

it "should require at least one line" do
Expand Down