Skip to content

Commit 1cfbb15

Browse files
author
Tobias Schoknecht
committed
Add basic container.nnn.001.02 support
1 parent 0db8bf7 commit 1cfbb15

File tree

3 files changed

+105
-1
lines changed

3 files changed

+105
-1
lines changed

lib/schema/container.nnn.001.02.xsd

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?xml version="1.0"?>
2+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:conxml="urn:conxml:xsd:container.nnn.001.02" xmlns:DocPain001="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:DocPain008="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:ns1="urn:conxml:xsd:container.nnn.001.02" targetNamespace="urn:conxml:xsd:container.nnn.001.02" elementFormDefault="qualified" attributeFormDefault="unqualified">
3+
<xs:import namespace="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" schemaLocation="pain.001.001.03.xsd"/>
4+
<xs:import namespace="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" schemaLocation="pain.008.001.02.xsd"/>
5+
<xs:element name="conxml" type="conxml:conxml"/>
6+
<xs:complexType name="conxml">
7+
<xs:sequence>
8+
<xs:element name="ContainerId">
9+
<xs:annotation>
10+
<xs:documentation>ContainerId and CreDtTm should form a unique reference. This reference must be provided in the signature authorizing the container.
11+
Defined as optional because the data might be provided by the bank's responder system instead of customers.</xs:documentation>
12+
</xs:annotation>
13+
<xs:complexType>
14+
<xs:sequence>
15+
<xs:element name="SenderId">
16+
<xs:annotation>
17+
<xs:documentation>User ID (BCS or EBICS or RVS file and station ID, or other)</xs:documentation>
18+
</xs:annotation>
19+
<xs:simpleType>
20+
<xs:restriction base="xs:string">
21+
<xs:maxLength value="22"/>
22+
</xs:restriction>
23+
</xs:simpleType>
24+
</xs:element>
25+
<xs:element name="IdType">
26+
<xs:annotation>
27+
<xs:documentation>Type of ID provided. It may indicate the routing layer/communication protocol the id is valid for. Recommended are: BCS, EBIC, BFTP, H2H, RVS, X400, CD, SFTP, SCP. It is intended to allow for additional bilaterally agreed values, so no enumeration is defined here.</xs:documentation>
28+
</xs:annotation>
29+
<xs:simpleType>
30+
<xs:restriction base="xs:string">
31+
<xs:minLength value="1"/>
32+
<xs:maxLength value="4"/>
33+
</xs:restriction>
34+
</xs:simpleType>
35+
</xs:element>
36+
<xs:element name="TimeStamp">
37+
<xs:annotation>
38+
<xs:documentation>Time Stamp with a millisecond precision, as a numeric string of length 9 (hhmmssxxx)</xs:documentation>
39+
</xs:annotation>
40+
<xs:simpleType>
41+
<xs:restriction base="xs:string">
42+
<xs:length value="9"/>
43+
<xs:pattern value="[0-9]{9,9}"/>
44+
</xs:restriction>
45+
</xs:simpleType>
46+
</xs:element>
47+
</xs:sequence>
48+
</xs:complexType>
49+
</xs:element>
50+
<xs:element name="CreDtTm" type="conxml:ISODateTime">
51+
<xs:annotation>
52+
<xs:documentation>Creation Timestamp for container structure</xs:documentation>
53+
</xs:annotation>
54+
</xs:element>
55+
<xs:choice>
56+
<xs:element name="MsgPain001" type="conxml:MsgPain001" maxOccurs="unbounded"/>
57+
<xs:element name="MsgPain008" type="conxml:MsgPain008" maxOccurs="unbounded"/>
58+
</xs:choice>
59+
</xs:sequence>
60+
</xs:complexType>
61+
<xs:complexType name="MsgPain001">
62+
<xs:sequence>
63+
<xs:element name="HashValue" type="conxml:HashSHA256" minOccurs="0"/>
64+
<xs:element name="HashAlgorithm" type="conxml:HashAlgorithm" minOccurs="0"/>
65+
<xs:element ref="DocPain001:Document"/>
66+
</xs:sequence>
67+
</xs:complexType>
68+
<xs:complexType name="MsgPain008">
69+
<xs:sequence>
70+
<xs:element name="HashValue" type="conxml:HashSHA256" minOccurs="0"/>
71+
<xs:element name="HashAlgorithm" type="conxml:HashAlgorithm" minOccurs="0"/>
72+
<xs:element ref="DocPain008:Document"/>
73+
</xs:sequence>
74+
</xs:complexType>
75+
<xs:simpleType name="HashSHA256">
76+
<xs:restriction base="xs:string">
77+
<xs:minLength value="64"/>
78+
<xs:maxLength value="64"/>
79+
</xs:restriction>
80+
</xs:simpleType>
81+
<xs:simpleType name="HashAlgorithm">
82+
<xs:restriction base="xs:string">
83+
<xs:enumeration value="SHA256"/>
84+
</xs:restriction>
85+
</xs:simpleType>
86+
<xs:simpleType name="ISODateTime">
87+
<xs:restriction base="xs:dateTime"/>
88+
</xs:simpleType>
89+
</xs:schema>

lib/sepa_king/container.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66

77
module SEPA
88

9+
CONTAINER_NNN_001_02 = 'container.nnn.001.02'
910
CONTAINER_NNN_001_GBIC4 = 'container.nnn.001.GBIC4'
1011
CONTAINER_NNN_001_04 = 'container.nnn.001.04'
1112

1213
CONTAINER_TO_MESSAGE_MAPPING = {
14+
CONTAINER_NNN_001_02 => {
15+
SEPA::CreditTransfer => PAIN_001_001_03,
16+
SEPA::DirectDebit => PAIN_008_001_02,
17+
},
1318
CONTAINER_NNN_001_GBIC4 => {
1419
SEPA::CreditTransfer => PAIN_001_001_09,
1520
SEPA::DirectDebit => PAIN_008_001_08,
@@ -46,7 +51,7 @@ class Container
4651

4752
class_attribute :known_schemas
4853

49-
self.known_schemas = [CONTAINER_NNN_001_GBIC4, CONTAINER_NNN_001_04]
54+
self.known_schemas = [CONTAINER_NNN_001_GBIC4, CONTAINER_NNN_001_04, CONTAINER_NNN_001_02]
5055

5156
def initialize(container_options = {})
5257
@sender_id = container_options[:sender_id]

spec/container_spec.rb

+10
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@
231231
expect(container.to_xml(SEPA::CONTAINER_NNN_001_GBIC4))
232232
.to validate_against('container.nnn.001.GBIC4.xsd')
233233
end
234+
235+
it 'is valid against the container schema container.nnn.001.02' do
236+
expect(container.to_xml(SEPA::CONTAINER_NNN_001_02))
237+
.to validate_against('container.nnn.001.02.xsd')
238+
end
234239
end
235240

236241
context 'with direct debits' do
@@ -247,6 +252,11 @@
247252
expect(container.to_xml(SEPA::CONTAINER_NNN_001_GBIC4))
248253
.to validate_against('container.nnn.001.GBIC4.xsd')
249254
end
255+
256+
it 'is valid against the container schema container.nnn.001.02' do
257+
expect(container.to_xml(SEPA::CONTAINER_NNN_001_02))
258+
.to validate_against('container.nnn.001.02.xsd')
259+
end
250260
end
251261
end
252262
end

0 commit comments

Comments
 (0)