Skip to content

Commit

Permalink
Added remt parse test
Browse files Browse the repository at this point in the history
  • Loading branch information
phoughton committed Sep 23, 2024
1 parent 8dc27f6 commit dcd957f
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 1 deletion.
90 changes: 90 additions & 0 deletions example_files/remt/remt_001_001_06.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:remt.001.001.06">
<RmtAdvc>
<GrpHdr>
<MsgId>20241001Ex1234</MsgId>
<CreDtTm>2024-10-01T09:00:00</CreDtTm>
<InitgPty>
<Id>
<OrgId>
<Othr>
<Id>623456</Id>
<SchmeNm>
<Prtry>Exchange Framework</Prtry>
</SchmeNm>
</Othr>
</OrgId>
</Id>
</InitgPty>
<MsgRcpt>
<Id>
<OrgId>
<Othr>
<Id>654326</Id>
<SchmeNm>
<Prtry>Exchange Framework</Prtry>
</SchmeNm>
</Othr>
</OrgId>
</Id>
</MsgRcpt>
</GrpHdr>
<RmtInf>
<RmtId>20240427_121000322_1754_321</RmtId>
<Strd>
<RfrdDocInf>
<Tp>
<CdOrPrtry>
<Cd>CINV</Cd>
</CdOrPrtry>
</Tp>
<Nb>684528</Nb>
<RltdDt>2022-06-10</RltdDt>
</RfrdDocInf>
<RfrdDocAmt>
<RmtAmtAndTp>
<Amt Ccy="USD">3916.11</Amt>
</RmtAmtAndTp>
</RfrdDocAmt>
</Strd>
<Strd>
<RfrdDocInf>
<Tp>
<CdOrPrtry>
<Cd>CINV</Cd>
</CdOrPrtry>
</Tp>
<Nb>683529</Nb>
<RltdDt>2022-06-10</RltdDt>
</RfrdDocInf>
<RfrdDocAmt>
<RmtAmtAndTp>
<Amt Ccy="USD">3916.99</Amt>
</RmtAmtAndTp>
</RfrdDocAmt>
</Strd>
<OrgnlPmtInf>
<Refs>
<EndToEndId>Linking ID Example 1</EndToEndId>
</Refs>
<PmtTpInf>
<LclInstrm>
<Cd>ARC</Cd>
</LclInstrm>
</PmtTpInf>
<Amt>
<InstdAmt Ccy="USD">7845.61</InstdAmt>
</Amt>
<ReqdExctnDt>
<Dt>2022-07-10</Dt>
</ReqdExctnDt>
<Dbtr>
<Nm>Payer McTest1</Nm>
</Dbtr>
<Cdtr>
<Nm>Payee McTest1</Nm>
</Cdtr>
</OrgnlPmtInf>
</RmtInf>
</RmtAdvc>
</Document>
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="pyiso20022",
version="1.4.4",
version="1.4.5",
author="Peter Houghton",
author_email="[email protected]",
description="pyiso20022 is a library for generating ISO20022 messages in Python.",
Expand Down
19 changes: 19 additions & 0 deletions tests/parse_remt_msgs_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest
from xsdata.formats.dataclass.parsers import XmlParser
from pyiso20022.remt.remt_001_001_06 import *
from decimal import Decimal


@pytest.mark.parametrize("expected_RmtAmtAndTp", [
("3916.11")
])
def test_parse_remt001_001_006(expected_RmtAmtAndTp):

parser = XmlParser()

with open("example_files/remt/remt_001_001_06.xml", "rb") as xml_file:
doc: Document = parser.parse(xml_file, Document, )

amount = doc.rmt_advc.rmt_inf[0].strd[0].rfrd_doc_amt.rmt_amt_and_tp[0].amt.value

assert amount == Decimal(expected_RmtAmtAndTp)

0 comments on commit dcd957f

Please sign in to comment.