sepa_rator 0.16.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +132 -46
- data/lib/schema/dk/pain.001.001.03_GBIC_3.xsd +499 -0
- data/lib/schema/dk/pain.001.001.09_GBIC_5.xsd +2411 -0
- data/lib/schema/dk/pain.008.001.02_GBIC_3.xsd +625 -0
- data/lib/schema/dk/pain.008.001.08_GBIC_5.xsd +2690 -0
- data/lib/schema/sps/pain.001.001.09.ch.03.xsd +1733 -0
- data/lib/schema/sps/pain.008.001.02.chsdd.02.xsd +1056 -0
- data/lib/sepa_rator/account/address.rb +11 -0
- data/lib/sepa_rator/account/creditor_account.rb +2 -2
- data/lib/sepa_rator/account/debtor_account.rb +4 -3
- data/lib/sepa_rator/account.rb +11 -10
- data/lib/sepa_rator/builders/credit_transfer/group_header.rb +40 -0
- data/lib/sepa_rator/builders/credit_transfer/payment_information.rb +85 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/amount.rb +20 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/credit_transfer_mandate.rb +24 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/creditor.rb +19 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/creditor_account.rb +15 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/creditor_agent.rb +22 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/instructions_for_creditor_agent.rb +26 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/payment_id.rb +19 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/purpose.rb +15 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/regulatory_reporting.rb +87 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/remittance_information.rb +15 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/txn_instruction_for_debtor_agent.rb +35 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/ultimate_creditor.rb +19 -0
- data/lib/sepa_rator/builders/credit_transfer/transaction/ultimate_debtor.rb +19 -0
- data/lib/sepa_rator/builders/direct_debit/group_header.rb +23 -0
- data/lib/sepa_rator/builders/direct_debit/payment_information.rb +80 -0
- data/lib/sepa_rator/builders/direct_debit/transaction/amount.rb +18 -0
- data/lib/sepa_rator/builders/direct_debit/transaction/debtor.rb +19 -0
- data/lib/sepa_rator/builders/direct_debit/transaction/debtor_account.rb +15 -0
- data/lib/sepa_rator/builders/direct_debit/transaction/debtor_agent.rb +20 -0
- data/lib/sepa_rator/builders/direct_debit/transaction/direct_debit_info.rb +61 -0
- data/lib/sepa_rator/builders/direct_debit/transaction/payment_id.rb +19 -0
- data/lib/sepa_rator/builders/direct_debit/transaction/purpose.rb +15 -0
- data/lib/sepa_rator/builders/direct_debit/transaction/remittance_information.rb +15 -0
- data/lib/sepa_rator/builders/direct_debit/transaction/ultimate_creditor.rb +19 -0
- data/lib/sepa_rator/builders/direct_debit/transaction/ultimate_debtor.rb +19 -0
- data/lib/sepa_rator/builders/stage.rb +31 -0
- data/lib/sepa_rator/concerns/schema_validation.rb +27 -17
- data/lib/sepa_rator/concerns/xml_builder.rb +49 -21
- data/lib/sepa_rator/error.rb +36 -0
- data/lib/sepa_rator/message/credit_transfer.rb +12 -198
- data/lib/sepa_rator/message/direct_debit.rb +12 -126
- data/lib/sepa_rator/message.rb +180 -176
- data/lib/sepa_rator/profile.rb +269 -0
- data/lib/sepa_rator/profiles/cfonb.rb +45 -0
- data/lib/sepa_rator/profiles/country_defaults.rb +104 -0
- data/lib/sepa_rator/profiles/dk.rb +57 -0
- data/lib/sepa_rator/profiles/epc.rb +50 -0
- data/lib/sepa_rator/profiles/iso.rb +233 -0
- data/lib/sepa_rator/profiles/sps.rb +80 -0
- data/lib/sepa_rator/transaction/credit_transfer_transaction.rb +71 -77
- data/lib/sepa_rator/transaction/direct_debit_transaction.rb +8 -33
- data/lib/sepa_rator/transaction.rb +14 -0
- data/lib/sepa_rator/validators/dk/min_amount.rb +27 -0
- data/lib/sepa_rator/version.rb +1 -1
- data/lib/sepa_rator.rb +47 -0
- metadata +53 -12
- data/lib/schema/pain.001.001.03.ch.02.xsd +0 -1212
- /data/lib/schema/{pain.001.001.03.xsd → iso/pain.001.001.03.xsd} +0 -0
- /data/lib/schema/{pain.001.001.09.xsd → iso/pain.001.001.09.xsd} +0 -0
- /data/lib/schema/{pain.001.001.13.xsd → iso/pain.001.001.13.xsd} +0 -0
- /data/lib/schema/{pain.001.002.03.xsd → iso/pain.001.002.03.xsd} +0 -0
- /data/lib/schema/{pain.001.003.03.xsd → iso/pain.001.003.03.xsd} +0 -0
- /data/lib/schema/{pain.008.001.02.xsd → iso/pain.008.001.02.xsd} +0 -0
- /data/lib/schema/{pain.008.001.08.xsd → iso/pain.008.001.08.xsd} +0 -0
- /data/lib/schema/{pain.008.001.12.xsd → iso/pain.008.001.12.xsd} +0 -0
- /data/lib/schema/{pain.008.002.02.xsd → iso/pain.008.002.02.xsd} +0 -0
- /data/lib/schema/{pain.008.003.02.xsd → iso/pain.008.003.02.xsd} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dfad7d3d0bdc0746f73ef52cdda9f0963449b3fb8011fc7cbc8517ff7c2ce3af
|
|
4
|
+
data.tar.gz: b6f0ec529bec02449479008d60583873b7d606e027dbb226da95527c2e5eeb3a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92b5682bc566140730448a99a27e09307fdef78bc1a7241aa29570fc05d66a035d0a11b51f41bebb82ca74cf0e48fbee10535e692f7cca6b4722fa83b0160b50
|
|
7
|
+
data.tar.gz: 7d4015b5109e027a038f772299e4ab97d50d21caf59521559640fae1f49c37d23c9c30e0375c954667abf11b5fe6f051c0a0611d62f130d4b6d8141a8384762a
|
data/README.md
CHANGED
|
@@ -3,97 +3,181 @@
|
|
|
3
3
|
[](https://github.com/AdVitam/sepa_rator/actions)
|
|
4
4
|
|
|
5
5
|
Successor to [salesking/sepa_king](https://github.com/salesking/sepa_king) (unmaintained since 2022).
|
|
6
|
-
Adds support for newer SEPA schemas
|
|
7
|
-
|
|
8
|
-
and security improvements.
|
|
6
|
+
Adds support for newer SEPA schemas and a **profile-based architecture** that makes
|
|
7
|
+
national variants (CFONB for France, DK/DFÜ for Germany, …) first-class.
|
|
9
8
|
|
|
10
9
|
## Features
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
- **Credit Transfer** (`pain.001`) — schemas `.001.13`, `.001.09`, `.003.03`, `.002.03`, `.001.03`
|
|
12
|
+
- **Direct Debit** (`pain.008`) — schemas `.001.12`, `.001.08`, `.003.02`, `.002.02`, `.001.02`
|
|
13
|
+
- **National profiles** — `CFONB` (🇫🇷), `DK/DFÜ` (🇩🇪), generic `EPC` SEPA
|
|
14
|
+
- Resolves the right profile from a simple `country: :fr` hint
|
|
15
|
+
- Full XSD validation on every generated XML
|
|
16
|
+
- Postal addresses, contact details, LEI, regulatory reporting
|
|
17
|
+
- Flexible charge bearer (SLEV, DEBT, CRED, SHAR)
|
|
18
|
+
- Mandate amendment support (original mandate ID, debtor account, creditor scheme)
|
|
18
19
|
|
|
19
20
|
**pain** = **Pa**yment **In**itiation (ISO 20022).
|
|
20
21
|
|
|
21
22
|
## Requirements
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
- Ruby 3.2+
|
|
25
|
+
- ActiveModel 7.0+ (tested up to 8.1)
|
|
25
26
|
|
|
26
27
|
## Installation
|
|
27
28
|
|
|
28
29
|
```ruby
|
|
29
|
-
gem 'sepa_rator'
|
|
30
|
+
gem 'sepa_rator', '~> 1.0'
|
|
30
31
|
```
|
|
31
32
|
|
|
32
33
|
## Quick start
|
|
33
34
|
|
|
34
|
-
### Credit Transfer
|
|
35
|
+
### The simplest possible Credit Transfer
|
|
36
|
+
|
|
37
|
+
No profile, no country, no schema name — defaults to the latest EPC SEPA profile:
|
|
35
38
|
|
|
36
39
|
```ruby
|
|
37
40
|
sct = SEPA::CreditTransfer.new(
|
|
38
|
-
name: '
|
|
39
|
-
bic: '
|
|
40
|
-
iban: '
|
|
41
|
+
name: 'Acme Ltd',
|
|
42
|
+
bic: 'BNPAFRPPXXX',
|
|
43
|
+
iban: 'FR7612345678901234567890123'
|
|
41
44
|
)
|
|
42
45
|
|
|
43
46
|
sct.add_transaction(
|
|
44
|
-
name: '
|
|
45
|
-
|
|
46
|
-
iban: 'DE37112589611964645802',
|
|
47
|
+
name: 'Supplier GmbH',
|
|
48
|
+
iban: 'DE21500500009876543210',
|
|
47
49
|
amount: 102.50,
|
|
48
|
-
reference: '
|
|
50
|
+
reference: 'INV-123',
|
|
49
51
|
remittance_information: 'Invoice 123'
|
|
50
52
|
)
|
|
51
53
|
|
|
52
|
-
xml = sct.to_xml
|
|
53
|
-
xml = sct.to_xml('pain.001.001.09') # newer schema
|
|
54
|
-
xml = sct.to_xml('pain.001.001.13') # latest schema
|
|
54
|
+
xml = sct.to_xml
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
### Direct Debit
|
|
57
|
+
### The simplest possible Direct Debit
|
|
58
58
|
|
|
59
59
|
```ruby
|
|
60
60
|
sdd = SEPA::DirectDebit.new(
|
|
61
|
-
name: '
|
|
62
|
-
bic: '
|
|
63
|
-
iban: '
|
|
64
|
-
creditor_identifier: '
|
|
61
|
+
name: 'Acme Ltd',
|
|
62
|
+
bic: 'BNPAFRPPXXX',
|
|
63
|
+
iban: 'FR7612345678901234567890123',
|
|
64
|
+
creditor_identifier: 'FR72ZZZ123456'
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
sdd.add_transaction(
|
|
68
|
-
name: '
|
|
69
|
-
bic: 'SPUEDE2UXXX',
|
|
68
|
+
name: 'Customer SA',
|
|
70
69
|
iban: 'DE21500500009876543210',
|
|
71
70
|
amount: 39.99,
|
|
72
|
-
reference: '
|
|
73
|
-
mandate_id: '
|
|
74
|
-
mandate_date_of_signature: Date.new(
|
|
75
|
-
sequence_type: 'OOFF'
|
|
71
|
+
reference: 'SUB/2025-08/001',
|
|
72
|
+
mandate_id: 'MND-2025-001',
|
|
73
|
+
mandate_date_of_signature: Date.new(2025, 1, 15)
|
|
76
74
|
)
|
|
77
75
|
|
|
78
|
-
xml = sdd.to_xml
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
xml = sdd.to_xml
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## The 4-level public API
|
|
80
|
+
|
|
81
|
+
`sepa_rator` exposes a progressive API: the simpler path covers 90 % of use
|
|
82
|
+
cases; the explicit path is there when you need it.
|
|
83
|
+
|
|
84
|
+
### Level 0 — defaults (generic SEPA)
|
|
85
|
+
|
|
86
|
+
Do nothing special and get the latest EPC SEPA profile
|
|
87
|
+
(`pain.001.001.13` for credit transfer, `pain.008.001.12` for direct debit):
|
|
88
|
+
|
|
89
|
+
```ruby
|
|
90
|
+
SEPA::CreditTransfer.new(name: ..., iban: ..., bic: ...)
|
|
91
|
+
SEPA::DirectDebit.new(name: ..., iban: ..., bic: ..., creditor_identifier: ...)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Level 1 — hint by country
|
|
95
|
+
|
|
96
|
+
The country code is **the country of the bank that will receive and process
|
|
97
|
+
your XML file** — your own bank for credit transfers, the creditor's bank for
|
|
98
|
+
direct debits. It is **not** the country of the beneficiary.
|
|
99
|
+
|
|
100
|
+
> Example: a company with a French bank pays Italian and German suppliers.
|
|
101
|
+
> The file goes to the French bank, so write `country: :fr`. The suppliers'
|
|
102
|
+
> IBANs can be from any SEPA country.
|
|
103
|
+
|
|
104
|
+
```ruby
|
|
105
|
+
SEPA::CreditTransfer.new(country: :fr, name: ..., iban: ..., bic: ...)
|
|
106
|
+
# → SEPA::Profiles::CFONB::SCT_13
|
|
107
|
+
|
|
108
|
+
SEPA::DirectDebit.new(country: :de, name: ..., iban: ..., bic: ...,
|
|
109
|
+
creditor_identifier: ...)
|
|
110
|
+
# → SEPA::Profiles::DK::SDD_12_GBIC5
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Countries without a dedicated profile (e.g. `:it`, `:es`, `:be`) fall back
|
|
114
|
+
to the generic EPC profile automatically.
|
|
115
|
+
|
|
116
|
+
### Level 2 — country + version
|
|
117
|
+
|
|
118
|
+
If your bank hasn't upgraded to the latest ISO version yet, pin the version:
|
|
119
|
+
|
|
120
|
+
```ruby
|
|
121
|
+
SEPA::CreditTransfer.new(country: :fr, version: :v09, ...)
|
|
122
|
+
# → SEPA::Profiles::CFONB::SCT_09
|
|
81
123
|
```
|
|
82
124
|
|
|
83
|
-
|
|
125
|
+
Supported version symbols:
|
|
126
|
+
|
|
127
|
+
| Family | Versions |
|
|
128
|
+
|-----------------|-------------------------|
|
|
129
|
+
| `credit_transfer` | `:v09`, `:v13`, `:latest` |
|
|
130
|
+
| `direct_debit` | `:v08`, `:v12`, `:latest` |
|
|
131
|
+
|
|
132
|
+
Requesting an unknown version raises `SEPA::UnsupportedVersionError` with
|
|
133
|
+
the list of available versions.
|
|
134
|
+
|
|
135
|
+
The older EPC AOS schemas (`pain.001.002.03`, `pain.001.003.03`,
|
|
136
|
+
`pain.008.002.02`, `pain.008.003.02`) are not exposed through the
|
|
137
|
+
`country:` / `version:` API — use Level 3 (explicit
|
|
138
|
+
`SEPA::Profiles::ISO::*` constants) if you need them.
|
|
139
|
+
|
|
140
|
+
### Level 3 — explicit profile (power user)
|
|
141
|
+
|
|
142
|
+
Pass a `SEPA::Profile` constant directly when you need a specific variant:
|
|
143
|
+
|
|
144
|
+
```ruby
|
|
145
|
+
SEPA::CreditTransfer.new(
|
|
146
|
+
profile: SEPA::Profiles::DK::SCT_09_GBIC5,
|
|
147
|
+
name: ..., iban: ..., bic: ...
|
|
148
|
+
)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`profile:` is mutually exclusive with `country:` / `version:` — passing
|
|
152
|
+
both raises `ArgumentError`.
|
|
153
|
+
|
|
154
|
+
## Supported profiles
|
|
155
|
+
|
|
156
|
+
| Family | Namespace | Profiles |
|
|
157
|
+
|---------------------|------------------|----------------------------------------------------------------------------------------------------------------------------------------|
|
|
158
|
+
| ISO (raw XSD) | `Profiles::ISO` | `SCT_03`, `SCT_09`, `SCT_13`, `SCT_EPC_002_03`, `SCT_EPC_003_03`, `SDD_02`, `SDD_08`, `SDD_12`, `SDD_EPC_002_02`, `SDD_EPC_003_02` |
|
|
159
|
+
| EPC SEPA | `Profiles::EPC` | `SCT_09`, `SCT_13`, `SDD_08`, `SDD_12` |
|
|
160
|
+
| CFONB (France 🇫🇷) | `Profiles::CFONB` | `SCT_09`, `SCT_13`, `SDD_08`, `SDD_12` |
|
|
161
|
+
| DK / DFÜ (Germany 🇩🇪) | `Profiles::DK` | `SCT_09_GBIC5`, `SCT_13_GBIC5`, `SDD_08_GBIC5`, `SDD_12_GBIC5` |
|
|
162
|
+
|
|
163
|
+
Adding a new country is a single file in `lib/sepa_rator/profiles/` plus
|
|
164
|
+
entries in `lib/sepa_rator/profiles/country_defaults.rb`.
|
|
84
165
|
|
|
85
|
-
|
|
166
|
+
## Reusing validators
|
|
86
167
|
|
|
87
168
|
```ruby
|
|
88
169
|
class BankAccount < ActiveRecord::Base
|
|
89
170
|
validates_with SEPA::IBANValidator, field_name: :iban
|
|
90
171
|
validates_with SEPA::BICValidator, field_name: :bic
|
|
172
|
+
validates_with SEPA::LEIValidator, field_name: :agent_lei
|
|
91
173
|
end
|
|
92
174
|
```
|
|
93
175
|
|
|
94
176
|
## Documentation
|
|
95
177
|
|
|
96
|
-
For the full list of options (addresses, charge bearer, amendment info,
|
|
178
|
+
For the full list of options (addresses, charge bearer, amendment info,
|
|
179
|
+
regulatory reporting, LEI, contact details, etc.), see
|
|
180
|
+
[DOCUMENTATION.md](DOCUMENTATION.md).
|
|
97
181
|
|
|
98
182
|
## Changelog
|
|
99
183
|
|
|
@@ -101,17 +185,19 @@ See [CHANGELOG.md](CHANGELOG.md).
|
|
|
101
185
|
|
|
102
186
|
## Contributors
|
|
103
187
|
|
|
104
|
-
|
|
105
|
-
|
|
188
|
+
- [Original contributors](https://github.com/salesking/sepa_king/graphs/contributors) (salesking/sepa_king)
|
|
189
|
+
- [sepa_rator contributors](https://github.com/AdVitam/sepa_rator/graphs/contributors)
|
|
106
190
|
|
|
107
191
|
## Resources
|
|
108
192
|
|
|
109
|
-
|
|
110
|
-
|
|
193
|
+
- [ISO 20022 message definitions](https://www.iso20022.org/iso-20022-message-definitions)
|
|
194
|
+
- [EPC rulebooks](https://www.europeanpaymentscouncil.eu/document-library)
|
|
195
|
+
- [CFONB guides](https://www.cfonb.org/espaces-telechargements/documents)
|
|
196
|
+
- [EBICS / DK data formats](https://www.ebics.de/de/datenformate)
|
|
111
197
|
|
|
112
198
|
## License
|
|
113
199
|
|
|
114
200
|
Released under the [MIT License](LICENSE.txt).
|
|
115
201
|
|
|
116
|
-
Originally copyright (c) 2013-2022 Georg Leciejewski (SalesKing), Georg Ledermann.
|
|
117
|
-
Copyright (c) 2025-2026
|
|
202
|
+
- Originally copyright (c) 2013-2022 Georg Leciejewski (SalesKing), Georg Ledermann.
|
|
203
|
+
- Copyright (c) 2025-2026 Advitam — fork, maintenance, profile-based architecture.
|