Skip to content

Commit

Permalink
Add support for pain.002.001.10
Browse files Browse the repository at this point in the history
Also adds changelog
  • Loading branch information
Tobias Schoknecht committed May 28, 2024
1 parent 9c6df0b commit d3a5697
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 5 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# v0.2.1

- Add support for pain.002.001.10

# v0.2.0

- Add general pain.002 support, specifically for pain.002.001.03

# v0.1.0

- Fork from [camt_parser](https://github.com/viafintech/camt_parser)
- Added general pain.001 and pain.008 support
1 change: 1 addition & 0 deletions lib/sepa_file_parser/register.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

## PAIN002
SepaFileParser::Xml.register('urn:iso:std:iso:20022:tech:xsd:pain.002.001.03', :pain002)
SepaFileParser::Xml.register('urn:iso:std:iso:20022:tech:xsd:pain.002.001.10', :pain002)

## PAIN008
SepaFileParser::Xml.register('urn:iso:std:iso:20022:tech:xsd:pain.008.003.02', :pain008)
107 changes: 107 additions & 0 deletions spec/fixtures/pain002/valid_example_001.10.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.002.001.10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.002.001.10 pain.002.001.10.xsd">
<CstmrPmtStsRpt>
<GrpHdr>
<MsgId>Message-ID-4712</MsgId>
<CreDtTm>2023-11-22T09:30:47.000Z</CreDtTm>
<CdtrAgt>
<FinInstnId>
<BICFI>BANKDEFFXXX</BICFI>
</FinInstnId>
</CdtrAgt>
</GrpHdr>
<OrgnlGrpInfAndSts>
<OrgnlMsgId>Message-ID-4711</OrgnlMsgId>
<OrgnlMsgNmId>pain.008.001.08</OrgnlMsgNmId>
</OrgnlGrpInfAndSts>
<OrgnlPmtInfAndSts>
<OrgnlPmtInfId>Sammlerreferenz-4710</OrgnlPmtInfId>
<TxInfAndSts>
<StsId>Status-ID</StsId>
<OrgnlEndToEndId>OriginatorID1234</OrgnlEndToEndId>
<TxSts>RJCT</TxSts>
<StsRsnInf>
<Orgtr>
<Id>
<OrgId>
<AnyBIC>BANKDEFFXXX</AnyBIC>
</OrgId>
</Id>
</Orgtr>
<Rsn>
<Cd>AC01</Cd>
</Rsn>
</StsRsnInf>
<OrgnlTxRef>
<Amt>
<InstdAmt Ccy="EUR">6543.14</InstdAmt>
</Amt>
<ReqdColltnDt>2023-11-24</ReqdColltnDt>
<CdtrSchmeId>
<Id>
<PrvtId>
<Othr>
<Id>DE00ZZZ00099999999</Id>
<SchmeNm>
<Prtry>SEPA</Prtry>
</SchmeNm>
</Othr>
</PrvtId>
</Id>
</CdtrSchmeId>
<PmtTpInf>
<SvcLvl>
<Cd>SEPA</Cd>
</SvcLvl>
<LclInstrm>
<Cd>CORE</Cd>
</LclInstrm>
<SeqTp>FRST</SeqTp>
</PmtTpInf>
<MndtRltdInf>
<MndtId>Mandate-Id</MndtId>
<DtOfSgntr>2023-11-20</DtOfSgntr>
</MndtRltdInf>
<RmtInf>
<Ustrd>Unstructured Remittance Information</Ustrd>
</RmtInf>
<UltmtDbtr>
<Pty>
<Nm>Ultimate Debtor Name</Nm>
</Pty>
</UltmtDbtr>
<Dbtr>
<Pty>
<Nm>Debtor Name</Nm>
</Pty>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>DE87200500001234567890</IBAN>
</Id>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BICFI>SPUEDE2UXXX</BICFI>
</FinInstnId>
</DbtrAgt>
<CdtrAgt>
<FinInstnId>
<BICFI>BANKDEFFXXX</BICFI>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Pty>
<Nm>Creditor Name</Nm>
</Pty>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>DE21500500009876543210</IBAN>
</Id>
</CdtrAcct>
</OrgnlTxRef>
</TxInfAndSts>
</OrgnlPmtInfAndSts>
</CstmrPmtStsRpt>
</Document>
32 changes: 27 additions & 5 deletions spec/lib/sepa_file_parser/pain002/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,42 @@

RSpec.describe SepaFileParser::Pain002::Base do

let(:pain) { SepaFileParser::File.parse('spec/fixtures/pain002/valid_example.xml') }

context 'initialization' do
after do
SepaFileParser::File.parse 'spec/fixtures/pain002/valid_example.xml'
SepaFileParser::File.parse('spec/fixtures/pain002/valid_example.xml')
end

specify { expect(SepaFileParser::GroupHeader).to receive(:new).and_call_original }

specify do
expect(SepaFileParser::Pain002::Report).to receive(:new).and_call_original
end
end

let(:pain) { SepaFileParser::File.parse 'spec/fixtures/pain002/valid_example.xml' }
specify { expect(pain.group_header).to_not be_nil }
specify { expect(pain.reports).to_not eq([]) }
specify { expect(pain.xml_data).to_not be_nil }
specify { expect(pain.group_header).not_to be_nil }
specify { expect(pain.reports).not_to eq([]) }
specify { expect(pain.xml_data).not_to be_nil }

context 'with pain.002.001.10' do
let(:pain) { SepaFileParser::File.parse('spec/fixtures/pain002/valid_example_001.10.xml') }

context 'initialization' do
after do
SepaFileParser::File.parse('spec/fixtures/pain002/valid_example_001.10.xml')
end

specify { expect(SepaFileParser::GroupHeader).to receive(:new).and_call_original }

specify do
expect(SepaFileParser::Pain002::Report).to receive(:new).and_call_original
end
end

specify { expect(pain.group_header).not_to be_nil }
specify { expect(pain.reports).not_to eq([]) }
specify { expect(pain.xml_data).not_to be_nil }
end

end

0 comments on commit d3a5697

Please sign in to comment.