python-sepaxml icon indicating copy to clipboard operation
python-sepaxml copied to clipboard

CBI compatibility

Open aster94 opened this issue 4 years ago • 6 comments

Hello,

I would like to have compatibility with the CBI standard, which is derived from the ISO20022 pain.001.001.03

These are some useful files and links: STIP-ST-001 Credit Transfer CBI v.00.04.00.xls

SEPA Single Euro Payments Area.pdf

https://remote.cedbrianteo.it/PagheWEB/help/infinity/ITA/mergedProjects/Infinity_PagheWeb/intro/intro_tracciati_record_accredito_netti.htm

Needed:

  1. add a new schemas for validation of the standard: https://github.com/raphaelm/python-sepaxml/tree/master/sepaxml/schemas Here there is a schema which could be used to ease the work: https://github.com/linkmesrl/cbi/blob/master/lib/xsd/CBIPaymentRequest.00.04.00.xsd
  2. add tests: https://github.com/raphaelm/python-sepaxml/tree/master/tests
  3. add support (for both SEPA and CBI) for Structured Credit Transfer Transaction Information (tag: 'Strd'), right now only Unstructured (Ustrd) is supported

This is a test xml downloaded from my bank with some parameter hidden for privacy:

<?xml version="1.0" encoding="utf-8"?>
<DEF:CBIBdyPaymentRequest
	xmlns="urn:CBI:xsd:CBIBdyPaymentRequest.00.04.00"
	xmlns:DEF="urn:CBI:xsd:CBIBdyPaymentRequest.00.04.00"
	xmlns:PMRQ="urn:CBI:xsd:CBIPaymentRequest.00.04.00"
	xmlns:SGNT="urn:CBI:xsd:CBISgnInf.001.04">
	<DEF:CBIEnvelPaymentRequest>
		<DEF:CBIPaymentRequest>
			<PMRQ:GrpHdr>
				<PMRQ:MsgId>unique id</PMRQ:MsgId>
				<PMRQ:CreDtTm>2021-04-14T00:00:00</PMRQ:CreDtTm>
				<PMRQ:NbOfTxs>1</PMRQ:NbOfTxs>
				<PMRQ:CtrlSum>36.60</PMRQ:CtrlSum>
				<PMRQ:InitgPty>
					<PMRQ:Id>
						<PMRQ:OrgId>
							<PMRQ:Othr>
								<PMRQ:Id>id</PMRQ:Id>
								<PMRQ:Issr>CBI</PMRQ:Issr>
							</PMRQ:Othr>
						</PMRQ:OrgId>
					</PMRQ:Id>
				</PMRQ:InitgPty>
			</PMRQ:GrpHdr>
			<PMRQ:PmtInf>
				<PMRQ:PmtInfId>unique id</PMRQ:PmtInfId>
				<PMRQ:PmtMtd>TRA</PMRQ:PmtMtd>
				<PMRQ:PmtTpInf>
					<PMRQ:InstrPrty>NORM</PMRQ:InstrPrty>
					<PMRQ:SvcLvl>
						<PMRQ:Cd>SEPA</PMRQ:Cd>
					</PMRQ:SvcLvl>
				</PMRQ:PmtTpInf>
				<PMRQ:ReqdExctnDt>2021-04-13</PMRQ:ReqdExctnDt>
				<PMRQ:Dbtr>
					<PMRQ:Nm>we</PMRQ:Nm>
					<PMRQ:PstlAdr>
						<PMRQ:AdrLine>our address</PMRQ:AdrLine>
						<PMRQ:AdrLine>another line</PMRQ:AdrLine>
					</PMRQ:PstlAdr>
				</PMRQ:Dbtr>
				<PMRQ:DbtrAcct>
					<PMRQ:Id>
						<PMRQ:IBAN>my iban</PMRQ:IBAN>
					</PMRQ:Id>
				</PMRQ:DbtrAcct>
				<PMRQ:DbtrAgt>
					<PMRQ:FinInstnId>
						<PMRQ:ClrSysMmbId>
							<PMRQ:MmbId>bank code</PMRQ:MmbId>
						</PMRQ:ClrSysMmbId>
					</PMRQ:FinInstnId>
				</PMRQ:DbtrAgt>
				<PMRQ:ChrgBr>SLEV</PMRQ:ChrgBr>
				<PMRQ:CdtTrfTxInf>
					<PMRQ:PmtId>
						<PMRQ:InstrId>1</PMRQ:InstrId>
						<PMRQ:EndToEndId>unique id</PMRQ:EndToEndId>
					</PMRQ:PmtId>
					<PMRQ:PmtTpInf>
						<PMRQ:CtgyPurp>
							<PMRQ:Cd>SUPP</PMRQ:Cd>
						</PMRQ:CtgyPurp>
					</PMRQ:PmtTpInf>
					<PMRQ:Amt>
						<PMRQ:InstdAmt Ccy="EUR">36.60</PMRQ:InstdAmt>
					</PMRQ:Amt>
					<PMRQ:Cdtr>
						<PMRQ:Nm>my supplier</PMRQ:Nm>
						<PMRQ:PstlAdr>
							<PMRQ:StrtNm>supplier address</PMRQ:StrtNm>
						</PMRQ:PstlAdr>
						<PMRQ:Id>
							<PMRQ:OrgId>
								<PMRQ:Othr>
									<PMRQ:Id>supplier vat number</PMRQ:Id>
								</PMRQ:Othr>
							</PMRQ:OrgId>
						</PMRQ:Id>
					</PMRQ:Cdtr>
					<PMRQ:CdtrAcct>
						<PMRQ:Id>
							<PMRQ:IBAN>supplier iban</PMRQ:IBAN>
						</PMRQ:Id>
					</PMRQ:CdtrAcct>
					<PMRQ:RmtInf>
						<PMRQ:Strd>
							<PMRQ:RfrdDocInf>
								<PMRQ:Tp>
									<PMRQ:CdOrPrtry>
										<PMRQ:Cd>CINV</PMRQ:Cd>
									</PMRQ:CdOrPrtry>
								</PMRQ:Tp>
								<PMRQ:Nb>test string</PMRQ:Nb>
								<PMRQ:RltdDt>2021-04-26</PMRQ:RltdDt>
							</PMRQ:RfrdDocInf>
							<PMRQ:RfrdDocAmt>
								<PMRQ:CdtNoteAmt Ccy="EUR">36.60</PMRQ:CdtNoteAmt>
							</PMRQ:RfrdDocAmt>
						</PMRQ:Strd>
					</PMRQ:RmtInf>
				</PMRQ:CdtTrfTxInf>
			</PMRQ:PmtInf>
		</DEF:CBIPaymentRequest>
	</DEF:CBIEnvelPaymentRequest>
</DEF:CBIBdyPaymentRequest>

This issue is pubblished on bountysource I am able to run tests to check if generated xml file are correctly accepted by my bank

aster94 avatar Apr 23 '21 16:04 aster94

There definitely would need to be a schema for validation. And some trickery in the XML handling, such that the output will have the prefix, but the API remains mostly unchanged.

You probably want a config option to select the CBI behavior.

MarcelWaldvogel avatar Apr 30 '21 11:04 MarcelWaldvogel

I would like to give a bounty for this issue (actually it is the first time I do this), but before I would like to have the permission from the repo author @raphaelm Manwhile if someone if willing to grab it you can contact me with email (visible on my profile)

aster94 avatar May 03 '21 15:05 aster94

I'm not really a fan of this library expanding in scope, as it is already hard to maintain due to the different schemas involved. I wouldn't oppose a PR with good tests and a schema, though.

raphaelm avatar May 03 '21 16:05 raphaelm

Understandable Raphael, I really don't understand why my country (Italy) had to make their own standard when there was an european standard available... Meanwhile I updated the first post with some documentation

aster94 avatar May 03 '21 17:05 aster94

I opened the bounty and edited the first post, I also asked support for the Structured Credit Transfer Transaction Information, which is supported by both classic SEPA and CBI, my desire is that the whole library would benefit from this bounty

@raphaelm please feel free to propose any change on the issue, both in private or here

aster94 avatar May 04 '21 19:05 aster94

Bounty raised to 100$

aster94 avatar May 16 '21 10:05 aster94