Skip to content

Commit

Permalink
add NtryRef to entry.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
frantisekrokusek authored and tobischo committed Jan 10, 2025
1 parent 44f58d3 commit de363d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/camt_parser/general/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ def bank_reference # May be missing
@bank_reference ||= xml_data.xpath('AcctSvcrRef/text()').text
end

# @return [String]
def reference # May be missing
@reference ||= xml_data.xpath('NtryRef/text()').text
end

# @return [Array<CamtParser::Transaction>]
def transactions
@transactions ||= parse_transactions
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/053/valid_example.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
</Bal>
<Ntry>
<Amt Ccy="EUR">2.00</Amt>
<NtryRef>1234567890sdfghjk</NtryRef>
<CdtDbtInd>DBIT</CdtDbtInd>
<Sts>BOOK</Sts>
<BookgDt>
Expand Down
1 change: 1 addition & 0 deletions spec/lib/camt_parser/general/entry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
specify { expect(ex_entry.sign).to eq(-1) }
specify { expect(ex_entry.transactions).to all(be_kind_of(CamtParser::Transaction)) }
specify { expect(ex_entry.bank_reference).to eq('2013122710583450000') }
specify { expect(ex_entry.reference).to eq('1234567890sdfghjk') }
specify { expect(ex_entry.xml_data).to_not be_nil }

context 'datetime' do
Expand Down

0 comments on commit de363d8

Please sign in to comment.