Merge lp:~therp-nl/banking-addons/camt_stuzza into lp:banking-addons

Proposed by Holger Brunn (Therp)
Status: Merged
Merged at revision: 252
Proposed branch: lp:~therp-nl/banking-addons/camt_stuzza
Merge into: lp:banking-addons
Diff against target: 20 lines (+4/-2)
1 file modified
account_banking_camt/camt.py (+4/-2)
To merge this branch: bzr merge lp:~therp-nl/banking-addons/camt_stuzza
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) Approve
Pedro Manuel Baeza code review Approve
Review via email: mp+211952@code.launchpad.net

Description of the change

I've been working on a camt53 statement provided by UniCredit Austria.

I encountered a weird namespace there and needed the following patch. See the first commit message for some details. The full namespace would be 'ISO:camt.053.001.02:APC:STUZZA:payments:003'.

Now I feel a bit uneasy about doing startswith heuristics. Why don't we whitelist namespaces we can work with?

To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Stuzza btw. is the Austrian payment provider handling this stuff for UniCredit, so I assume this path will be necessary for some other Austrian banks too.

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Seeing XSD, it seems OK, although I have no opportunity to test in a real scenario.

Regards.

review: Approve (code review)
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

LGTM. I hope there are not a lot of other alternative namespaces around.

review: Approve
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

BTW yes I would prefer a whitelist like you suggest in the proposal description.

Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

So the xsd says: 'All XML data validating with this scheme can also be validated with the underlying original namespace of ISO. Therefor [sic] the original ISO namespace is to be used for data transmission.'
Which means UniCredit does it wrong. But well, that's how they hand out the files, and I think for the time being we need to deal with that.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Are you still going to refactor into a whitelist, or do you want me to merge this for now?

review: Needs Information
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Given that I have no overview about the deviations floating around, I wouldn't dare to introduce a hard (=full namespace) whitelist. So I'd propose to merge as it is.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Done!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_banking_camt/camt.py'
2--- account_banking_camt/camt.py 2013-10-11 12:20:14 +0000
3+++ account_banking_camt/camt.py 2014-03-20 14:33:15 +0000
4@@ -253,12 +253,14 @@
5 """
6 Sanity check the document's namespace
7 """
8- if not self.ns.startswith('{urn:iso:std:iso:20022:tech:xsd:camt.'):
9+ if not self.ns.startswith('{urn:iso:std:iso:20022:tech:xsd:camt.')\
10+ and not self.ns.startswith('{ISO:camt.'):
11 raise except_orm(
12 "Error",
13 "This does not seem to be a CAMT format bank statement.")
14
15- if not self.ns.startswith('{urn:iso:std:iso:20022:tech:xsd:camt.053.'):
16+ if not self.ns.startswith('{urn:iso:std:iso:20022:tech:xsd:camt.053.')\
17+ and not self.ns.startswith('{ISO:camt.053'):
18 raise except_orm(
19 "Error",
20 "Only CAMT.053 is supported at the moment.")

Subscribers

People subscribed via source and target branches

to status/vote changes: