Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add NtryRef to entry.rb #71

Merged
merged 1 commit into from
Jan 10, 2025
Merged
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
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
Loading