├── .gitignore
├── LICENSE
├── README.md
├── composer.json
├── example.php
├── lib.sepalastschrift.php
├── pain.008.002.02.xsd
└── pain.008.003.02.xsd
/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michael-dev/php-sepa-lastschrift/aee9981c995a1e5f4fed0eb3ae44b46e94664bf0/.gitignore
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | php-sepa-lastschrift
2 | ====================
3 |
4 | PHP SEPA (Sammel-)Lastschriften erzeugen (XML)
5 |
6 | Diese Bibliothek erzeugt SEPA-Basis-(Sammel-)lastschriften (CDD). Fristen, State-Tracking usw. entsprechend Rulebook und sonstigen Vereinbarungen muss außerhalb der Lib implementiert werden.
7 |
8 | Benutzung auf eigene Gefahr!
9 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "michael-dev/php-sepa-lastschrift",
3 | "description" : "PHP SEPA (Sammel-)Lastschriften erzeugen (XML)",
4 | "type" : "library",
5 | "authors" : [{
6 | "name" : "Michael Braun",
7 | "email" : "michael-dev@fami-braun.de"
8 | }
9 | ],
10 | "homepage" : "https://github.com/michael-dev/php-sepa-lastschrift",
11 | "license" : "LGPL-3.0+",
12 | "minimum-stability" : "dev",
13 | "keywords" : [
14 | "SEPA",
15 | "Lastschrift"
16 | ],
17 | "autoload": {
18 | "classmap": ["lib.sepalastschrift.php"]
19 | }
20 | }
--------------------------------------------------------------------------------
/example.php:
--------------------------------------------------------------------------------
1 | addLastschrift( /* id */ "randomtxid",
15 | /* iban */ "DE456IBAN",
16 | /* bic */ "BICEXAMPLE1",
17 | /* account owner */ "Test Me",
18 | /* mandate */ "Mandate-Id123",
19 | /* mandate signing date */ new DateTime("2013-05-23"),
20 | /* amount */ 42.00,
21 | /* subject */ "blabla SSS",
22 | /* type */ "FRST");
23 | $lastschriften->addLastschrift("randomtxid2", "DE789IBAN", "BICEXAMPLE2", "Test Me2", "Mandate-Id122", new DateTime("2013-05-22"), 44.00, "blabla SSS","RCUR");
24 | $lastschriften->addLastschrift("randomtxid3", "DE012IBAN", "BICEXAMPLE3", "Test Me3", "Mandate-Id123", new DateTime("2013-05-22"), 44.00, "blabla SSS","RCUR");
25 |
26 | # enable self-test: optional
27 | global $sepaLastschriftXMLVersion; # 008.002.02
28 | global $sepaLastschriftXSD; # ../media/
29 | $sepaLastschriftXSD = dirname(__FILE__);
30 | function add_message($msg, $class="hinweis") {
31 | echo $msg."\n";
32 | }
33 |
34 | # output
35 | header("Content-type: text/xml");
36 | echo $lastschriften->asXML();
37 |
38 |
--------------------------------------------------------------------------------
/lib.sepalastschrift.php:
--------------------------------------------------------------------------------
1 | .
5 | * All rights reserved.
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 3 of the License, or (at your option) any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this library; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 | * MA 02110-1301 USA
21 | *
22 | * https://github.com/michael-dev/php-sepa-lastschrift
23 | */
24 |
25 | global $sepaLastschriftXMLVersion; # 008.002.02
26 | global $sepaLastschriftXSD; # ../media/
27 |
28 | /**
29 | * Diese Klasse implementiert pain.008.003.02
30 | * für SEPA Lastschriften
31 | * Payment-Id := -
32 | */
33 | class SEPALastschrift {
34 | private $date; /* Y-m-d\TH:i:s\Z */
35 | private $msgid; /* ([A-Za-z0-9]|[\+|\?|/|\-|:|\(|\)|\.|,|'| ]){1,35} */
36 | private $txs = Array(); /* $type => Array */
37 | private $initator = "missing";
38 | private $sum = Array(); /* $type => cents */
39 | private $creditorName = "missing";
40 | private $creditorIBAN = "missing";
41 | private $creditorBIC = "missing";
42 | private $creditorID = "missing"; /* Gläubiger-ID */
43 | private $ccy = "EUR"; /* EUR */
44 | private $txTypes = Array("FRST","RCUR","OOFF","FNAL");
45 | private $cdtype = "CORE";
46 | private $BtchBookg = NULL;
47 |
48 | /**
49 | * msgid ist ein Prefix, welches auch für sie Sammler (PmtInfId) als Prefix verwendet wird. Daher die Länge auf 29 beschränken!
50 | */
51 | public function __construct($date /*class DateTime*/, $msgid, $initiator, $creditorName, $creditorIBAN, $creditorBIC, $creditorID /* GläubigerID */, $ccy="EUR", $cdtype="CORE" /* B2B or COR1 */, $BtchBookg = NULL /* BatchBookingIndicator */) {
52 | $this->date = $date;
53 | $this->msgid = $msgid;
54 | $this->initiator = $initiator;
55 | $this->creditorName = $creditorName;
56 | $this->creditorIBAN = $creditorIBAN;
57 | $this->creditorBIC = $creditorBIC;
58 | $this->creditorID = $creditorID;
59 | $this->ccy = $ccy;
60 | $this->cdtype = $cdtype;
61 | $this->BtchBookg = $BtchBookg;
62 | if (!preg_match("#^([A-Za-z0-9]|[\+|\?|/|\-|:|\(|\)|\.|,|'| ]){1,29}$#", $msgid))
63 | die("ungültige msgid");
64 | }
65 |
66 | /**
67 | * Lastschrift einfügen.
68 | * @param name Kontoinhaber
69 | * @param amount maximal 2 Bruchziffern, float
70 | * @param mandateSignatureDate Datum der Unterschrift auf dem Mandat; als class DateTime Object
71 | * @param sepatyp FRST RCUR OOFF FNAL
72 | * @param UltmtDbtr Name des Schuldners (nur Information; wenn abweichend von Kontoinhaber) (optional)
73 | */
74 | public function addLastschrift($id, $iban, $bic, $name, $mandate, $mandateSignatureDate /* class DateTime */, $amount /* float */, $subject, $type, $UltmtDbtr = NULL) {
75 | if (!preg_match("#^([A-Za-z0-9]|[\+|\?|/|\-|:|\(|\)|\.|,|'| ]){1,35}$#", $id))
76 | die("invalid id $id");
77 | if (!preg_match("#^([A-Za-z0-9]|[\+|\?|/|\-|:|\(|\)|\.|,|']){1,35}$#", $mandate))
78 | die("invalid mandate $mandate");
79 | if (strlen($subject) < 1 or strlen($subject) > 140)
80 | die("invalid subject length");
81 | # Sparkasse Arnstadt-Ilmenau erlaubt hier nur a-zA-Z0-9 sowie -':?,+()/. und Leerzeichen
82 | if (!preg_match("#^[A-Za-z0-9\+\?/\-:\(\)\.,' ]{1,140}$#", $subject))
83 | die("invalid subject $subject: #^[A-Za-z0-9\+\?/\-:\(\)\.,' ]{1,140}$#");
84 | if (strlen($name) < 1 or strlen($name) > 70)
85 | die("invalid name length");
86 | # Sparkasse Arnstadt-Ilmenau erlaubt hier nur a-zA-Z0-9 sowie -':?,+()/. und Leerzeichen
87 | if (!preg_match("#^[A-Za-z0-9\+\?/\-:\(\)\.,' ]{1,70}$#", $name))
88 | die("invalid name $name: #^[A-Za-z0-9\+\?/\-:\(\)\.,' ]{1,70}$#");
89 | if ($UltmtDbtr !== NULL && (strlen($UltmtDbtr) < 1 or strlen($UltmtDbtr) > 70))
90 | die("invalid UltmtDbtr length");
91 | if ($amount < 0.01 || $amount > 999999999.99) die("invalid amount $amount");
92 | $amount = round($amount * 100);
93 | if (!in_array($type, $this->txTypes)) die("invalid type $type");
94 | $tx = Array("id" => $id, "IBAN" => $iban, "BIC" => $bic, "name" => $name, "mandate" => $mandate, "mandateSignatureDate" => $mandateSignatureDate, "amount" => $amount, "subject" => $subject);
95 | if ($UltmtDbtr !== NULL) $ts["UltmtDbtr"] = $UltmtDbtr;
96 | if (!isset($this->txs[$type])) $this->txs[$type] = Array();
97 | $this->txs[$type][] = $tx;
98 | if (!isset($this->sum[$type])) $this->sum[$type] = 0;
99 | $this->sum[$type] += $amount;
100 | }
101 |
102 | private static function formatCcy($cents) {
103 | return sprintf("%d.%02d", ($cents / 100), ($cents % 100));
104 | }
105 |
106 | private function addGrpHdr($xml) {
107 | $xml->startElement('GrpHdr');
108 | $xml->writeElement('MsgId', $this->msgid);
109 | $dt = new DateTime("now", new DateTimeZone('Etc/UTC'));
110 | $xml->writeElement('CreDtTm', $dt->format('Y-m-d\TH:i:s\Z'));
111 | $ctn = 0;
112 | foreach ($this->txs as $v) {
113 | $ctn += count($v);
114 | }
115 | $xml->writeElement('NbOfTxs', $ctn);
116 | $sum = 0;
117 | foreach ($this->sum as $v) {
118 | $sum += $v;
119 | }
120 | $xml->writeElement('CtrlSum', $this->formatCcy($sum));
121 | $xml->startElement('InitgPty');
122 | $xml->writeElement('Nm', $this->initiator);
123 | $xml->endElement(); /* InitgPty */
124 | $xml->endElement(); /* GrpHdr */
125 | }
126 |
127 | /** $type: FRST; RCUR; OOFF; FNAL */
128 | private function addPmtInf($xml, $txs, $sum, $type) {
129 | if (!preg_match("#^([A-Za-z0-9]|[\+|\?|/|\-|:|\(|\)|\.|,|'| ]){1,5}$#", $type))
130 | die("invalid type $type");
131 |
132 | $xml->startElement('PmtInf');
133 | $xml->writeElement('PmtInfId', $this->msgid.'-'.$type);
134 | $xml->writeElement('PmtMtd','DD');
135 | if ($this->BtchBookg !== NULL) {
136 | $xml->writeElement('BtchBookg', $this->BtchBookg ? "true" : "false");
137 | }
138 | $xml->writeElement('NbOfTxs', count($txs));
139 | $xml->writeElement('CtrlSum', $this->formatCcy($sum));
140 | $xml->startElement('PmtTpInf');
141 | $xml->startElement('SvcLvl');
142 | $xml->writeElement('Cd', 'SEPA');
143 | $xml->endElement(); /* SvcLvl */
144 | $xml->startElement('LclInstrm');
145 | $xml->writeElement('Cd', $this->cdtype);
146 | $xml->endElement(); /* LclInstrm */
147 | $xml->writeElement('SeqTp', $type);
148 | $xml->endElement(); /* PmtTpInf */
149 | $xml->writeElement('ReqdColltnDt', $this->date->format('Y-m-d'));
150 | $xml->startElement('Cdtr');
151 | $xml->writeElement('Nm', $this->creditorName);
152 | $xml->endElement(); /* Cdtr */
153 | $xml->startElement('CdtrAcct');
154 | $xml->startElement('Id');
155 | $xml->writeElement('IBAN', $this->creditorIBAN);
156 | $xml->endElement(); /* Id */
157 | $xml->endElement(); /* CdtrAcct */
158 | $xml->startElement('CdtrAgt');
159 | $xml->startElement('FinInstnId');
160 | if ($this->creditorBIC !== NULL) {
161 | $xml->writeElement('BIC', $this->creditorBIC);
162 | } // BIC !== NULL
163 | $xml->endElement(); /* FinInstnId */
164 | $xml->endElement(); /* CdtrAgt */
165 | $xml->writeElement('ChrgBr', 'SLEV');
166 | $xml->startElement('CdtrSchmeId');
167 | $xml->startElement('Id');
168 | $xml->startElement('PrvtId');
169 | $xml->startElement('Othr');
170 | $xml->writeElement('Id',$this->creditorID);
171 | $xml->startElement('SchmeNm');
172 | $xml->writeElement('Prtry','SEPA');
173 | $xml->endElement(); /* SchmeNm */
174 | $xml->endElement(); /* Othr */
175 | $xml->endElement(); /* PrvtId */
176 | $xml->endElement(); /* Id */
177 | $xml->endElement(); /* CdtrSchmeId */
178 | foreach ($txs as $tx) {
179 | $this->addTX($xml, $tx);
180 | }
181 | $xml->endElement(); /* PmtInf */
182 | }
183 |
184 | private function addTX($xml, $tx) {
185 | $xml->startElement('DrctDbtTxInf');
186 | $xml->startElement('PmtId');
187 | $xml->writeElement('EndToEndId',$tx["id"]);
188 | $xml->endElement(); /* PmtId */
189 | $xml->startElement('InstdAmt');
190 | $xml->writeAttribute("Ccy", $this->ccy);
191 | $xml->text($this->formatCcy($tx["amount"]));
192 | $xml->endElement(); /* InstdAmt */
193 | $xml->startElement('DrctDbtTx');
194 | $xml->startElement('MndtRltdInf');
195 | $xml->writeElement('MndtId', $tx["mandate"]);
196 | $xml->writeElement('DtOfSgntr',$tx["mandateSignatureDate"]->format('Y-m-d'));
197 | /* No Amendment aka Change-Tracing supported! */
198 | $xml->endElement(); /* MndtRltdInf */
199 | $xml->endElement(); /* DrctDbtTx */
200 | $xml->startElement('DbtrAgt');
201 | $xml->startElement('FinInstnId');
202 | if ($tx["BIC"] !== NULL) {
203 | $xml->writeElement('BIC',$tx["BIC"]);
204 | } // BIC !== null
205 | $xml->endElement(); /* FinInstnId */
206 | $xml->endElement(); /* DbtrAgt */
207 | $xml->startElement('Dbtr');
208 | $xml->writeElement('Nm',$tx["name"]);
209 | $xml->endElement(); /* Dbtr */
210 | $xml->startElement('DbtrAcct');
211 | $xml->startElement('Id');
212 | $xml->writeElement('IBAN',$tx["IBAN"]);
213 | $xml->endElement(); /* Id */
214 | $xml->endElement(); /* DbtrAcct */
215 | if (isset($tx["UltmtDbtr"])) {
216 | $xml->startElement('UltmtDbtr');
217 | $xml->writeElement('Nm',$tx["UltmtDbtr"]); /* Zahlungspflichtiger, falls vom Kontoinhaber abweichend */
218 | $xml->endElement(); /* UltmtDbtr */
219 | }
220 | $xml->startElement('RmtInf');
221 | $xml->writeElement('Ustrd',$tx["subject"]);
222 | $xml->endElement(); /* RmtInf */
223 | $xml->endElement(); /* DrctDbtTxInf */
224 | }
225 |
226 | public function asXML() {
227 | global $sepaLastschriftXMLVersion; # 008.002.02
228 | global $sepaLastschriftXSD; # ../media/
229 | /** output */
230 | $xml = new XMLWriter;
231 | $xml->openMemory();
232 | $xml->startDocument('1.0', 'UTF-8');
233 |
234 | $painVersion = "008.002.02";
235 | if (isset($sepaLastschriftXMLVersion)) {
236 | $painVersion = $sepaLastschriftXMLVersion;
237 | }
238 | $painXSDFile = "pain.".$painVersion.".xsd";
239 |
240 | $xml->startElement('Document');
241 | $xml->writeAttribute('xmlns','urn:iso:std:iso:20022:tech:xsd:pain.'.$painVersion);
242 | $xml->writeAttributeNS('xsi','schemaLocation','http://www.w3.org/2001/XMLSchema-instance','urn:iso:std:iso:20022:tech:xsd:pain.'.$painVersion.' '.$painXSDFile);
243 | $xml->startElement('CstmrDrctDbtInitn');
244 | $this->addGrpHdr($xml);
245 | foreach ($this->txs as $type => $txs) {
246 | $this->addPmtInf($xml, $txs, $this->sum[$type], $type);
247 | }
248 | $xml->endElement(); /* CstmrDrctDbtInitn */
249 | $xml->endElement(); /* Document */
250 |
251 | $xml->endDocument();
252 | $xmlString = $xml->outputMemory(TRUE);
253 |
254 | // verify xml
255 | if (isset($sepaLastschriftXSD)) {
256 | $xsdFile = $sepaLastschriftXSD."/".$painXSDFile;
257 | if (!is_file($xsdFile)) {
258 | add_message("Die Schema-Datei $xsdFile wurde nicht gefunden.");
259 | return false;
260 | } else {
261 | $tempDom = new DOMDocument();
262 | $tempDom->loadXML($xmlString);
263 | if (!$tempDom->schemaValidate($xsdFile)) {
264 | add_message("Die erzeugten Daten sind ungültig.");
265 | return false;
266 | }
267 | }
268 | }
269 |
270 | return $xmlString;
271 | }
272 | }
273 |
--------------------------------------------------------------------------------
/pain.008.002.02.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | Mandatory if changes occur in ‘Mandate Identification’, otherwise not to be used.
42 |
43 |
44 |
45 |
46 | Mandatory if changes occur in 'Creditor Scheme Identification', otherwise not to be used.
47 |
48 |
49 |
50 |
51 | To be used only for changes of accounts within the same bank.
52 |
53 |
54 |
55 |
56 | To use 'Identification’ under 'Other' under 'Financial Institution Identifier with code ‘SMNDA’ to indicate same mandate with new Debtor Agent. To be used with the ‘FRST’ indicator in the ‘Sequence Type’.
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 | If a Creditor Reference contains a check digit, the receiving bank is not required to validate this.
116 | If the receiving bank validates the check digit and if this validation fails, the bank may continue its processing and send the transaction to the next party in the chain.
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 | It is recommended that all transactions within the same ‘Payment Information’ block have the same ‘Creditor Scheme Identification’.
158 | This data element must be present at either ‘Payment Information’ or ‘Direct Debit
159 | Transaction’ level.
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 | It is recommended that this element be specified at ‘Payment Information’ level.
171 |
172 |
173 |
174 |
175 |
176 | This data element may be present either at ‘Payment Information’ or at ‘Direct Debit Transaction Information’ level.
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 | Mandatory if provided by the debtor in the mandate.
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 | Mandatory if 'Amendment Indicator' is 'TRUE'
314 | The reason code from the Rulebook is indicated using one of the following message subelements.
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 | Either ‘BIC or BEI’ or one
371 | occurrence of ‘Other’ is allowed.
372 |
373 |
374 |
375 |
376 | Either ‘Date and Place of Birth’ or one occurrence of ‘Other’ is allowed
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 | Private Identification is used to identify either an organisation or a private
387 | person.
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 | ‘Name’ is limited to 70 characters in length.
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 | ‘Name’ is limited to 70 characters in length.
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 | If present the new’ Name’ must be specified under ‘Creditor’. ‘Name’ is limited to 70 characters in length.
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 | ‘Name’ is limited to 70 characters in length.
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 | If present and contains ‘true’, batch booking is requested. If present and contains ‘false’, booking per transaction is requested. If element is not present, pre-agreed customer-to-bank conditions apply.
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 | This data element may be present either at ‘Payment Information’ or at ‘Direct Debit Transaction Information’ level.
463 |
464 |
465 |
466 |
467 | It is recommended that this element be specified at ‘Payment Information’ level.
468 |
469 |
470 |
471 |
472 | It is recommended that all transactions within the same ‘Payment Information’ block have the same ‘Creditor Scheme Identification’.
473 | This data element must be present at either ‘Payment Information’ or ‘Direct Debit
474 | Transaction’ level.
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 | Only ‘B2B’ or 'CORE' is allowed. The mixing of Core Direct Debits and B2B Direct Debits is not allowed in the same message.
491 |
492 |
493 |
494 |
495 | If 'Amendment Indicator' is 'true' and 'Original Debtor Agent' is set to 'SMNDA' this message element must indicate 'FRST'
496 |
497 |
498 |
499 |
500 | Depending on the agreement between the Creditor and the Creditor Bank, ‘Category Purpose’ may be forwarded to the Debtor Bank.
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 | Only one occurrence of ‘Other’ is allowed, and no other sub-elements are allowed.
518 | Identification must be used with an identifier described in General Message Element Specifications, Chapter 1.5.2 of the Implementation Guide.
519 | Scheme Name’ under ‘Other’ must specify ‘SEPA’ under ‘Proprietary
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 | Only codes from the ISO 20022 ExternalPurposeCode list are allowed.
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 | When present, the receiving bank is not obliged to validate the reference information.
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
--------------------------------------------------------------------------------
/pain.008.003.02.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | Mandatory if changes occur in ‘Mandate Identification’, otherwise not to be used.
49 |
50 |
51 |
52 |
53 | Mandatory if changes occur in 'Creditor Scheme Identification', otherwise not to be used.
54 |
55 |
56 |
57 |
58 | To be used only for changes of accounts within the same bank.
59 |
60 |
61 |
62 |
63 | To use 'Identification’ under 'Other' under 'Financial Institution Identifier with code ‘SMNDA’ to indicate same mandate with new Debtor Agent. To be used with the ‘FRST’ indicator in the ‘Sequence Type’.
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | If a Creditor Reference contains a check digit, the receiving bank is not required to validate this.
123 | If the receiving bank validates the check digit and if this validation fails, the bank may continue its processing and send the transaction to the next party in the chain.
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 | It is recommended that all transactions within the same ‘Payment Information’ block have the same ‘Creditor Scheme Identification’.
165 | This data element must be present at either ‘Payment Information’ or ‘Direct Debit
166 | Transaction’ level.
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 | It is recommended that this element be specified at ‘Payment Information’ level.
178 |
179 |
180 |
181 |
182 |
183 | This data element may be present either at ‘Payment Information’ or at ‘Direct Debit Transaction Information’ level.
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 | Mandatory if provided by the debtor in the mandate.
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 | Mandatory if 'Amendment Indicator' is 'TRUE'
330 | The reason code from the Rulebook is indicated using one of the following message subelements.
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 | Either ‘BIC or BEI’ or one
387 | occurrence of ‘Other’ is allowed.
388 |
389 |
390 |
391 |
392 | Either ‘Date and Place of Birth’ or one occurrence of ‘Other’ is allowed
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 | Private Identification is used to identify either an organisation or a private
403 | person.
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 | ‘Name’ is limited to 70 characters in length.
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 | ‘Name’ is limited to 70 characters in length.
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 | If present the new’ Name’ must be specified under ‘Creditor’. ‘Name’ is limited to 70 characters in length.
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 | ‘Name’ is limited to 70 characters in length.
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 | If present and contains ‘true’, batch booking is requested. If present and contains ‘false’, booking per transaction is requested. If element is not present, pre-agreed customer-to-bank conditions apply.
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 | This data element may be present either at ‘Payment Information’ or at ‘Direct Debit Transaction Information’ level.
479 |
480 |
481 |
482 |
483 | It is recommended that this element be specified at ‘Payment Information’ level.
484 |
485 |
486 |
487 |
488 | It is recommended that all transactions within the same ‘Payment Information’ block have the same ‘Creditor Scheme Identification’.
489 | This data element must be present at either ‘Payment Information’ or ‘Direct Debit
490 | Transaction’ level.
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 | Only ‘B2B’, 'CORE' or 'COR1' is allowed. The mixing of different Local Instrument values is not allowed in the same message.
507 |
508 |
509 |
510 |
511 | If 'Amendment Indicator' is 'true' and 'Original Debtor Agent' is set to 'SMNDA' this message element must indicate 'FRST'
512 |
513 |
514 |
515 |
516 | Depending on the agreement between the Creditor and the Creditor Bank, ‘Category Purpose’ may be forwarded to the Debtor Bank.
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 | Only one occurrence of ‘Other’ is allowed, and no other sub-elements are allowed.
534 | Identification must be used with an identifier described in General Message Element Specifications, Chapter 1.5.2 of the Implementation Guide.
535 | Scheme Name’ under ‘Other’ must specify ‘SEPA’ under ‘Proprietary
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 | Only codes from the ISO 20022 ExternalPurposeCode list are allowed.
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 | When present, the receiving bank is not obliged to validate the reference information.
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
--------------------------------------------------------------------------------