sepafm 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +14 -30
- data/.ruby-version +1 -1
- data/.travis.yml +15 -0
- data/Gemfile +1 -1
- data/LICENSE +16 -4
- data/README.md +180 -319
- data/Rakefile +7 -2
- data/lib/sepa/application_request.rb +100 -131
- data/lib/sepa/application_response.rb +28 -84
- data/lib/sepa/attribute_checks.rb +169 -0
- data/lib/sepa/banks/danske/danske_response.rb +19 -0
- data/lib/sepa/banks/danske/soap_danske.rb +132 -0
- data/lib/sepa/banks/nordea/nordea_response.rb +20 -0
- data/lib/sepa/banks/nordea/soap_nordea.rb +51 -0
- data/lib/sepa/client.rb +72 -60
- data/lib/sepa/error_messages.rb +15 -0
- data/lib/sepa/response.rb +88 -85
- data/lib/sepa/soap_builder.rb +51 -341
- data/lib/sepa/utilities.rb +132 -0
- data/lib/sepa/version.rb +1 -1
- data/lib/sepa/xml_schemas/PKIFactory.xsd +334 -0
- data/lib/sepa/xml_schemas/xml_id.xsd +9 -0
- data/lib/sepa/xml_templates/application_request/create_certificate.xml +15 -10
- data/lib/sepa/xml_templates/application_request/danske_get_bank_certificate.xml +13 -9
- data/lib/sepa/xml_templates/application_request/download_file.xml +32 -30
- data/lib/sepa/xml_templates/application_request/download_file_list.xml +29 -27
- data/lib/sepa/xml_templates/application_request/encrypted_request.xml +22 -0
- data/lib/sepa/xml_templates/application_request/get_certificate.xml +9 -8
- data/lib/sepa/xml_templates/application_request/get_user_info.xml +26 -24
- data/lib/sepa/xml_templates/application_request/upload_file.xml +29 -27
- data/lib/sepa/xml_templates/soap/create_certificate.xml +17 -15
- data/lib/sepa/xml_templates/soap/danske_get_bank_certificate.xml +15 -13
- data/lib/sepa/xml_templates/soap/download_file.xml +19 -15
- data/lib/sepa/xml_templates/soap/download_file_list.xml +19 -15
- data/lib/sepa/xml_templates/soap/get_certificate.xml +2 -1
- data/lib/sepa/xml_templates/soap/get_user_info.xml +19 -15
- data/lib/sepa/xml_templates/soap/header.xml +48 -37
- data/lib/sepa/xml_templates/soap/upload_file.xml +19 -15
- data/lib/sepafm.rb +20 -18
- data/{sepa.gemspec → sepafm.gemspec} +10 -9
- data/test/sepa/banks/danske/danske_cert_response_test.rb +52 -0
- data/test/sepa/banks/danske/danske_cert_soap_builder_test.rb +100 -0
- data/test/sepa/banks/danske/danske_generic_soap_builder_test.rb +278 -0
- data/test/sepa/banks/danske/danske_get_bank_cert_test.rb +111 -0
- data/{lib/sepa/danske_testing/keys/danske_encryption.crt → test/sepa/banks/danske/keys/bank_encryption_cert.pem} +0 -0
- data/test/sepa/{danske_test_keys/danskeroot.pem → banks/danske/keys/bank_root_cert.pem} +1 -1
- data/test/sepa/banks/danske/keys/bank_signing_cert.pem +24 -0
- data/test/sepa/banks/danske/keys/danske_encryption.crt +24 -0
- data/test/sepa/banks/danske/keys/enc_private_key.pem +27 -0
- data/test/sepa/{danske_test_keys → banks/danske/keys}/encryption_pkcs.csr +0 -0
- data/test/sepa/banks/danske/keys/own_enc_cert.pem +21 -0
- data/test/sepa/banks/danske/keys/own_signing_cert.pem +22 -0
- data/test/sepa/{danske_test_keys → banks/danske/keys}/signing_key.pem +0 -0
- data/test/sepa/{danske_test_keys → banks/danske/keys}/signing_pkcs.csr +0 -0
- data/test/sepa/banks/danske/keys/signing_private_key.pem +27 -0
- data/test/sepa/banks/danske/responses/create_cert.xml +38 -0
- data/test/sepa/banks/danske/responses/get_bank_cert.xml +37 -0
- data/{lib/sepa/nordea_testing → test/sepa/banks/nordea}/keys/nordea.crt +0 -4
- data/test/sepa/{nordea_test_keys → banks/nordea/keys}/nordea.key +0 -3
- data/test/sepa/{nordea_test_keys → banks/nordea/keys}/root_cert.cer +0 -0
- data/test/sepa/{nordea_test_keys → banks/nordea/keys}/testcert.csr +0 -0
- data/test/sepa/banks/nordea/nordea_application_request_test.rb +252 -0
- data/test/sepa/{application_response_test.rb → banks/nordea/nordea_application_response_test.rb} +40 -46
- data/test/sepa/banks/nordea/nordea_cert_application_request_test.rb +72 -0
- data/test/sepa/banks/nordea/nordea_cert_request_soap_builder_test.rb +65 -0
- data/test/sepa/banks/nordea/nordea_generic_soap_builder_test.rb +280 -0
- data/test/sepa/banks/nordea/nordea_response_test.rb +116 -0
- data/test/sepa/banks/nordea/responses/df_ktl.xml +45 -0
- data/test/sepa/{test_files/test_responses/df.xml → banks/nordea/responses/df_tito.xml} +1 -1
- data/test/sepa/{test_files/test_responses → banks/nordea/responses}/dfl.xml +0 -0
- data/test/sepa/banks/nordea/responses/gbc.xml +15 -0
- data/test/sepa/banks/nordea/responses/gc.xml +49 -0
- data/test/sepa/{test_files/test_responses → banks/nordea/responses}/gui.xml +0 -0
- data/test/sepa/{test_files/test_responses → banks/nordea/responses}/uf.xml +0 -0
- data/test/sepa/client_test.rb +156 -302
- data/test/sepa/fixtures.rb +214 -0
- data/test/sepa/sepa_test.rb +3 -13
- data/test/sepa/test_files/{invalid.wsdl → invalid_wsdl.wsdl} +0 -0
- data/test/test_helper.rb +29 -3
- metadata +140 -116
- data/lib/danske_get_bank_certificate_test.rb +0 -15
- data/lib/sepa/custom_exceptions.rb +0 -2
- data/lib/sepa/filedescriptor.rb +0 -7
- data/lib/sepa/filetypeservice.rb +0 -6
- data/lib/sepa/nordea_testing/keys/CSR.csr +0 -0
- data/lib/sepa/nordea_testing/keys/nordea.key +0 -19
- data/lib/sepa/nordea_testing/response/content_053.xml +0 -998
- data/lib/sepa/nordea_testing/response/content_054.xml +0 -1
- data/lib/sepa/nordea_testing/response/download_file_response.xml +0 -14
- data/lib/sepa/nordea_testing/response/download_filelist_response.xml +0 -14
- data/lib/sepa/nordea_testing/response/get_user_info_response.xml +0 -14
- data/lib/sepa/nordea_testing/response/upload_file_response.xml +0 -14
- data/lib/sepa/payload.rb +0 -109
- data/lib/sepa/payment.rb +0 -97
- data/lib/sepa/sender_verifier.rb +0 -15
- data/lib/sepa/signature.rb +0 -7
- data/lib/sepa/soap_danske.rb +0 -47
- data/lib/sepa/soap_nordea.rb +0 -68
- data/lib/sepa/transaction.rb +0 -178
- data/lib/sepa/userfiletype.rb +0 -16
- data/lib/sepa/xml_parser.rb +0 -291
- data/lib/sepa_client_testing_mika.rb +0 -32
- data/lib/sepa_client_testing_tiere.rb +0 -257
- data/test/sepa/application_request_test.rb +0 -423
- data/test/sepa/cert_application_request_test.rb +0 -99
- data/test/sepa/nordea_cert_request_soap_builder_test.rb +0 -112
- data/test/sepa/nordea_generic_soap_builder_test.rb +0 -427
- data/test/sepa/nordea_test_keys/nordea.crt +0 -27
- data/test/sepa/payload_test.rb +0 -297
- data/test/sepa/payment_test.rb +0 -198
- data/test/sepa/response_test.rb +0 -269
- data/test/sepa/transaction_test.rb +0 -362
- data/test/sepa/user_file_type_test.rb +0 -21
- data/test/sepa/xml_parser_test.rb +0 -73
data/README.md
CHANGED
@@ -1,385 +1,246 @@
|
|
1
1
|
# Devlab / SEPA
|
2
2
|
|
3
|
-
|
3
|
+
[![Code Climate](https://codeclimate.com/github/devlab-oy/sepa.png)](https://codeclimate.com/github/devlab-oy/sepa)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/devlab-oy/sepa/coverage.png)](https://codeclimate.com/github/devlab-oy/sepa)
|
5
|
+
[![Build Status](https://travis-ci.org/devlab-oy/sepa.svg?branch=master)](https://travis-ci.org/devlab-oy/sepa)
|
4
6
|
|
5
|
-
|
7
|
+
This project aims to create an open source implementation of SEPA Financial Messages using Web Services. Project implementation is done in Ruby.
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
*
|
10
|
-
* Bank
|
11
|
-
* Update README
|
9
|
+
Currently we have support for SEPA Web Services for:
|
10
|
+
|
11
|
+
* Nordea
|
12
|
+
* Danske Bank
|
12
13
|
|
13
14
|
## Installation
|
14
15
|
|
15
16
|
Add this line to your application's Gemfile:
|
16
17
|
|
17
|
-
|
18
|
+
```ruby
|
19
|
+
gem 'sepafm'
|
20
|
+
```
|
18
21
|
|
19
22
|
And then execute:
|
20
23
|
|
21
|
-
|
24
|
+
```bash
|
25
|
+
$ bundle
|
26
|
+
```
|
22
27
|
|
23
|
-
Or install it
|
28
|
+
Or install it with:
|
24
29
|
|
25
|
-
|
30
|
+
```bash
|
31
|
+
$ gem install sepafm
|
32
|
+
```
|
26
33
|
|
27
34
|
## Usage
|
28
35
|
|
29
|
-
### Building the payload
|
30
|
-
|
31
|
-
* You can optionally have an invoice bundle included in a given transaction. If that is the case, you first have to define the invoices i.e. as follows:
|
32
|
-
|
33
|
-
invoice_bundle = []
|
34
|
-
|
35
|
-
invoice_1 = {
|
36
|
-
|
37
|
-
# Has to be either CINV for normal invoice or CREN for credit note.
|
38
|
-
type: 'CINV',
|
39
|
-
|
40
|
-
# Positive for invoices and negative for credits.
|
41
|
-
amount: '700',
|
42
|
-
|
43
|
-
currency: 'EUR',
|
44
|
-
|
45
|
-
# You either have to specify an invoice number or a reference.
|
46
|
-
invoice_number: '123456'
|
47
|
-
}
|
48
|
-
|
49
|
-
invoice_2 = {
|
50
|
-
type: 'CINV',
|
51
|
-
amount: '300',
|
52
|
-
currency: 'EUR',
|
53
|
-
reference: '123456789',
|
54
|
-
}
|
55
|
-
|
56
|
-
invoice_3 = {
|
57
|
-
type: 'CREN',
|
58
|
-
amount: '-100',
|
59
|
-
currency: 'EUR',
|
60
|
-
invoice_number: '654321'
|
61
|
-
}
|
62
|
-
|
63
|
-
invoice_4 = {
|
64
|
-
type: 'CREN',
|
65
|
-
amount: '-500',
|
66
|
-
currency: 'EUR',
|
67
|
-
reference: '987654321'
|
68
|
-
}
|
69
|
-
|
70
|
-
# All the invoices are pushed to an array which is later included in the
|
71
|
-
# transaction's params.
|
72
|
-
invoice_bundle.push(invoice_1)
|
73
|
-
invoice_bundle.push(invoice_2)
|
74
|
-
invoice_bundle.push(invoice_3)
|
75
|
-
invoice_bundle.push(invoice_4)
|
76
|
-
|
77
|
-
1. Define parameters for the transactions. You need at least one and one payment can have multiple. It is also worth noting that one payload can also have multiple payments. Here's how the parameters are defined:
|
78
|
-
|
79
|
-
transactions_params = {
|
80
|
-
|
81
|
-
# Optional id for the transaction. This is returned to the payer only.
|
82
|
-
# Max length is 35 characters.
|
83
|
-
instruction_id: '70CEF29BEBA8396A1F806005EDA51DEE4CE',
|
84
|
-
|
85
|
-
# Mandatory id for the transaction. This id is also passed on the the
|
86
|
-
# beneficiary. Max length is 35 characters.
|
87
|
-
end_to_end_id: '629CADFDAD5246AD915BA24A3C8E9FC3313',
|
88
|
-
|
89
|
-
# Amount to be transferred. Decimals separated by a period.
|
90
|
-
amount: '30.75',
|
91
|
-
|
92
|
-
# Currency. For Euros EUR etc.
|
93
|
-
currency: 'EUR',
|
94
|
-
|
95
|
-
# Bank's unique BIC.
|
96
|
-
bic: 'NDEAFIHH',
|
97
|
-
|
98
|
-
# Name of the creditor company or person
|
99
|
-
name: 'Testi Saaja Oy',
|
100
|
-
|
101
|
-
# Street and street number of the creditor.
|
102
|
-
address: 'Kokeilukatu 66',
|
103
|
-
|
104
|
-
# Creditor's county code.
|
105
|
-
country: 'FI',
|
106
|
-
|
107
|
-
# Creditor's postcode.
|
108
|
-
postcode: '00200',
|
109
|
-
|
110
|
-
# Creditor's town
|
111
|
-
town: 'Helsinki',
|
112
|
-
|
113
|
-
# Creditor's IBAN.
|
114
|
-
iban: 'FI7429501800000014',
|
115
|
-
|
116
|
-
# Reference number for the transaction. Mandatory if message not given.
|
117
|
-
reference: '00000000000000001245',
|
118
|
-
|
119
|
-
# Message for the transaction. Mandatory if reference not given.
|
120
|
-
message: 'Maksu',
|
121
|
-
|
122
|
-
# Optional set of invoices to be bundled in this transaction. If a bundle
|
123
|
-
# is provided amount, currency and reference will be automatically taken
|
124
|
-
# from that bundle.
|
125
|
-
invoice_bundle: invoice_bundle
|
126
|
-
}
|
127
|
-
|
128
|
-
2. Create an array of Sepa::Transaction objects in which you put all the transactions of a given payment. You need to create an array for each payment separately.
|
129
|
-
|
130
|
-
payment_transactions = []
|
131
|
-
|
132
|
-
payment_transactions.push(Sepa::Transaction.new(transaction_params))
|
133
|
-
|
134
|
-
3. Define the parameters for the payment/payments:
|
135
|
-
|
136
|
-
payment_params = {
|
137
|
-
|
138
|
-
# Unique id the payment. Max length is 35 characters.
|
139
|
-
payment_info_id: 'F56D46DDA136A981F58C05999479E768C92',
|
140
|
-
|
141
|
-
# Requested executin date for the payment in form YYY-MM-DD.
|
142
|
-
execution_date: '2013-08-10',
|
143
|
-
|
144
|
-
# The array of transactions for this payment
|
145
|
-
transactions: payment_transactions
|
146
|
-
|
147
|
-
# If this is a payment consisting of salary of pension transactions, you
|
148
|
-
# need to provide the following flag.
|
149
|
-
salary_or_pension: true
|
150
|
-
}
|
151
|
-
|
152
|
-
4. Define parameters for the debtor as follows:
|
153
|
-
|
154
|
-
debtor_params = {
|
155
|
-
name: 'Testi Maksaja Oy',
|
156
|
-
address: 'Testing Street 12',
|
157
|
-
country: 'FI',
|
158
|
-
postcode: '00100',
|
159
|
-
town: 'Helsinki',
|
160
|
-
customer_id: '111111111',
|
161
|
-
iban: 'FI4819503000000010',
|
162
|
-
bic: 'NDEAFIHH'
|
163
|
-
}
|
164
|
-
|
165
|
-
5. Create an array of Sepa::Payment objects in which you put all the payments that are going to be in the payload.
|
166
|
-
|
167
|
-
payments = []
|
168
|
-
|
169
|
-
payments.push(Sepa::Payment.new(debtor_params, payment_params))
|
170
|
-
|
171
|
-
6. Create the actual payload object:
|
172
|
-
|
173
|
-
payload = Sepa::Payload.new(debtor_params, payments)
|
174
|
-
|
175
|
-
# Will return the payload as an xml document which can be included in the
|
176
|
-
# construction of the SOAP message.
|
177
|
-
payload.to_xml
|
178
|
-
|
179
36
|
### Communicating with the bank
|
180
37
|
|
181
|
-
|
182
|
-
|
183
|
-
require 'sepafm'
|
184
|
-
|
185
|
-
2. Define the hash that will be passed to the gem when initializing it:
|
186
|
-
|
187
|
-
params = {
|
188
|
-
bank: :nordea,
|
189
|
-
private_key_path: "path/to/key", (OR private_key_plain : "Your private key in plain text form ")
|
190
|
-
cert_path: "path/to/key", (OR cert_plain : "Your certificate in plain text form ")
|
191
|
-
command: :command_as_symbol,
|
192
|
-
customer_id: '11111111',
|
193
|
-
environment: 'PRODUCTION',
|
194
|
-
status: 'NEW',
|
195
|
-
target_id: '11111111A1',
|
196
|
-
language: 'FI',
|
197
|
-
file_type: 'TITO',
|
198
|
-
content: payload, # You can use the payload you may have constructed earlier. I.e. payload.to_xml
|
199
|
-
file_reference: "11111111A12006030329501800000014"
|
200
|
-
}
|
201
|
-
|
202
|
-
3. Initialize a new instance of the client and pass the params hash
|
203
|
-
|
204
|
-
sepa_client = Sepa::Client.new(params)
|
205
|
-
|
206
|
-
4. There is only one method that can be called after initializing the client:
|
207
|
-
|
208
|
-
* Returns the whole soap response as a savon response object:
|
209
|
-
|
210
|
-
response = client.send
|
211
|
-
|
212
|
-
### Verifying the response
|
38
|
+
Define parameters hash for client, ie. get bank statement;
|
213
39
|
|
214
|
-
|
40
|
+
```ruby
|
41
|
+
params = {
|
42
|
+
bank: :nordea,
|
43
|
+
command: :download_file,
|
44
|
+
private_key: "...your private key...",
|
45
|
+
cert: "...your certificate...",
|
46
|
+
customer_id: '11111111',
|
47
|
+
file_type: 'NDCAMT53L',
|
48
|
+
file_reference: "11111111A12006030329501800000014",
|
49
|
+
target_id: '11111111A1',
|
50
|
+
status: 'NEW'
|
51
|
+
}
|
52
|
+
```
|
215
53
|
|
216
|
-
|
54
|
+
Initialize a new instance of the client and pass the params hash
|
217
55
|
|
218
|
-
|
219
|
-
|
56
|
+
```ruby
|
57
|
+
client = Sepa::Client.new params
|
58
|
+
```
|
220
59
|
|
221
|
-
|
60
|
+
Send request to bank
|
222
61
|
|
223
|
-
|
62
|
+
```ruby
|
63
|
+
response = client.send_request
|
64
|
+
```
|
224
65
|
|
225
|
-
|
66
|
+
### Interacting with the response
|
226
67
|
|
227
|
-
|
68
|
+
Make sure response is valid
|
228
69
|
|
229
|
-
|
230
|
-
|
70
|
+
```ruby
|
71
|
+
response.valid?
|
72
|
+
```
|
231
73
|
|
232
|
-
|
74
|
+
Get reponse content
|
233
75
|
|
234
|
-
|
235
|
-
|
76
|
+
```ruby
|
77
|
+
response.content
|
78
|
+
```
|
236
79
|
|
237
|
-
###
|
80
|
+
### Downloading Nordea certificate
|
238
81
|
|
239
|
-
|
82
|
+
Define parameters hash for client
|
240
83
|
|
241
|
-
|
84
|
+
```ruby
|
85
|
+
params = {
|
86
|
+
pin: '1234567890',
|
87
|
+
bank: :nordea,
|
88
|
+
command: :get_certificate,
|
89
|
+
customer_id: '11111111',
|
90
|
+
environment: 'TEST',
|
91
|
+
csr: "...your csr...",
|
92
|
+
service: 'service'
|
93
|
+
}
|
94
|
+
```
|
242
95
|
|
243
|
-
|
96
|
+
Initialize a new instance of the client and pass the params hash
|
244
97
|
|
245
|
-
|
98
|
+
```ruby
|
99
|
+
client = Sepa::Client.new params
|
100
|
+
response = client.send_request
|
101
|
+
```
|
246
102
|
|
247
|
-
|
103
|
+
Get the certificates from the response
|
248
104
|
|
249
|
-
|
105
|
+
```ruby
|
106
|
+
response.content
|
107
|
+
```
|
250
108
|
|
251
|
-
|
109
|
+
### Downloading Danske bank certificates
|
252
110
|
|
253
|
-
|
254
|
-
ar.certificate
|
111
|
+
#### Bank's certificates
|
255
112
|
|
256
|
-
|
113
|
+
Define parameters hash for client
|
257
114
|
|
258
|
-
|
259
|
-
|
115
|
+
```ruby
|
116
|
+
params = {
|
117
|
+
bank: :danske,
|
118
|
+
target_id: 'Danske FI',
|
119
|
+
language: 'EN',
|
120
|
+
command: :get_bank_certificate,
|
121
|
+
bank_root_cert_serial: '1111110002',
|
122
|
+
customer_id: '360817',
|
123
|
+
environment: 'TEST'
|
124
|
+
}
|
125
|
+
```
|
260
126
|
|
261
|
-
|
127
|
+
Initialize a new instance of the client and pass the params hash
|
262
128
|
|
263
|
-
|
129
|
+
```ruby
|
130
|
+
client = Sepa::Client.new params
|
131
|
+
response = client.send_request
|
132
|
+
```
|
264
133
|
|
265
|
-
|
134
|
+
Get the certificates from the response
|
266
135
|
|
267
|
-
|
136
|
+
```ruby
|
137
|
+
# Bank's encryption certificate
|
138
|
+
response.bank_encryption_cert
|
268
139
|
|
269
|
-
|
270
|
-
|
271
|
-
command: :get_certificate,
|
272
|
-
customer_id: '11111111',
|
273
|
-
environment: 'TEST',
|
274
|
-
csr_path: "path_to_your_local_csr_file", (OR csr_plain: "your csr in plain text format")
|
275
|
-
service: 'service'
|
276
|
-
}
|
140
|
+
# Bank's signing certificate
|
141
|
+
response.bank_signing_cert
|
277
142
|
|
278
|
-
|
143
|
+
# Bank's root certificate
|
144
|
+
response.bank_root_cert
|
145
|
+
```
|
279
146
|
|
280
|
-
|
281
|
-
sepa_client.call
|
147
|
+
#### Own certificates
|
282
148
|
|
283
|
-
|
149
|
+
Define parameters hash
|
284
150
|
|
285
|
-
|
151
|
+
``` ruby
|
152
|
+
params = {
|
153
|
+
bank: :danske,
|
154
|
+
enc_cert: danske_bank_enc_cert,
|
155
|
+
command: :create_certificate,
|
156
|
+
customer_id: '360817',
|
157
|
+
environment: 'customertest',
|
158
|
+
key_generator_type: 'software',
|
159
|
+
encryption_cert_pkcs10: danske_enc_cert_request,
|
160
|
+
signing_cert_pkcs10: danske_signing_cert_request,
|
161
|
+
pin: '1234'
|
162
|
+
}
|
163
|
+
```
|
286
164
|
|
287
|
-
|
165
|
+
Initialize a new instance of the client and pass the params hash
|
288
166
|
|
289
|
-
|
167
|
+
```ruby
|
168
|
+
client = Sepa::Client.new params
|
169
|
+
response = client.send_request
|
170
|
+
```
|
290
171
|
|
291
|
-
|
172
|
+
Get the certificates from the response
|
292
173
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
language: 'EN',
|
297
|
-
command: :get_bank_certificate,
|
298
|
-
bank_root_cert_serial: '1111110002',
|
299
|
-
customer_id: '360817',
|
300
|
-
environment: 'TEST',
|
301
|
-
}
|
174
|
+
```ruby
|
175
|
+
# Own encryption certificate
|
176
|
+
response.own_encryption_cert
|
302
177
|
|
303
|
-
|
178
|
+
# Own signing certificate
|
179
|
+
response.own_signing_cert
|
304
180
|
|
305
|
-
|
306
|
-
|
181
|
+
# CA Certificate used for signing own certificates
|
182
|
+
response.ca_certificate
|
183
|
+
```
|
307
184
|
|
308
|
-
|
309
|
-
|
310
|
-
***
|
185
|
+
---
|
311
186
|
|
312
187
|
### Parameter breakdown
|
313
188
|
|
314
|
-
* bank
|
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
|
-
* service: For testing value is service, otherwise ISSUER
|
363
|
-
|
364
|
-
* bank_root_cert_serial: Serial number for Danske bank certificate download (1111110002)
|
365
|
-
|
366
|
-
***
|
367
|
-
|
368
|
-
### Parsing data from bank response xml
|
369
|
-
Parsing based on specifications by Federation of Finnish Financial Services provided xml examples account statement [XML account statement](http://www.fkl.fi/teemasivut/sepa/tekninen_dokumentaatio/Dokumentit/FI_camt_053_sample.xml.xml) and debit credit notification [XML debit credit notification](http://www.fkl.fi/teemasivut/sepa/tekninen_dokumentaatio/Dokumentit/FI_camt_054_sample.xml.xml) and ISO20022 transaction reporting guide [ISO20022 Transaction reporting guide](http://www.fkl.fi/en/themes/sepa/sepa_documents/Dokumentit/ISO20022_Payment_Guide.pdf)
|
370
|
-
* Hardcode wanted specs into app_response.rb methods get_account_statement_content/get_debit_credit_notification_content
|
371
|
-
* Create new instance of ApplicationResponse
|
372
|
-
* method get_account_statement_content takes a bank statement file (xml) as a parameter and returns selected info in a hash
|
373
|
-
* method get_debit_credit_notification_content takes a debit credit notification file (xml) as a parameter and returns selected info in a hash
|
374
|
-
* method animate_response takes a full application response xml as a parameter and parses data into objects, can be used to take out different formats of Content-field, without predefined parameter specs
|
189
|
+
* **bank** - The bank you want to send the request to as a symbol. Either :nordea or :danske
|
190
|
+
* **private_key** - Your private key in plain text format
|
191
|
+
* **cert** - Your certificate in plain text format
|
192
|
+
* **csr** - Your certificate signing request in plain text format
|
193
|
+
* **command** - Must be one of:
|
194
|
+
* download_file_list
|
195
|
+
* upload_file
|
196
|
+
* download_file
|
197
|
+
* get_user_info
|
198
|
+
* get_certificate
|
199
|
+
* get_bank_certificate
|
200
|
+
* **customer_id** - Your personal id with the bank.
|
201
|
+
* **environment** - Must be either PRODUCTION or TEST
|
202
|
+
* **status** - For filtering stuff. Must be either NEW, DOWNLOADED or ALL
|
203
|
+
* **target_id** - Some specification of the folder which to access in the bank.
|
204
|
+
* **language** - Language must be either FI, EN or SV
|
205
|
+
* **file_type** - File types to upload or download:
|
206
|
+
* LMP300 = Laskujen maksupalvelu (lähtevä)
|
207
|
+
* LUM2 = Valuuttamaksut (lähtevä)
|
208
|
+
* KTL = Saapuvat viitemaksut (saapuva)
|
209
|
+
* TITO = Konekielinen tiliote (saapuva)
|
210
|
+
* NDCORPAYS = Yrityksen maksut XML (lähtevä)
|
211
|
+
* NDCAMT53L = Konekielinen XML-tiliote (saapuva)
|
212
|
+
* NDCAMT54L = Saapuvat XML viitemaksu (saapuva)
|
213
|
+
* **content** - The payload to send.
|
214
|
+
* **file_reference** - File reference for :download_file command
|
215
|
+
* **pin** - Your personal pin-code provided by the bank
|
216
|
+
* **service** - For testing value is service, otherwise ISSUER
|
217
|
+
* **bank_root_cert_serial** - Serial number for Danske bank certificate download (1111110002)
|
218
|
+
|
219
|
+
---
|
220
|
+
|
221
|
+
## Upcoming features
|
222
|
+
|
223
|
+
* Parse responses
|
224
|
+
* Bank-to-Customer Statement
|
225
|
+
* ISO standard "BankToCustomerStatementV02"
|
226
|
+
* XML schema "camt.053.001.02"
|
227
|
+
* Bank-to-Customer Debit/Credit Notification
|
228
|
+
* ISO standard "BankToCustomerDebitCreditNotificationV02"
|
229
|
+
* XML schma "camt.054.001.02"
|
230
|
+
* Create payloads
|
231
|
+
* Customer-to-Bank Statement
|
232
|
+
* ISO standard "CustomerCreditTransferInitiationV03"
|
233
|
+
* XML schema "pain.001.001.03"
|
234
|
+
|
235
|
+
---
|
375
236
|
|
376
237
|
## Contributing
|
377
238
|
|
378
239
|
1. Fork it
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
240
|
+
1. Create your feature branch (`git checkout -b my-new-feature`)
|
241
|
+
1. Commit your changes (`git commit -am 'Add some feature'`)
|
242
|
+
1. Push to the branch (`git push origin my-new-feature`)
|
243
|
+
1. Create new Pull Request
|
383
244
|
|
384
245
|
## License
|
385
246
|
|
data/Rakefile
CHANGED
@@ -2,9 +2,14 @@ require 'bundler/gem_tasks'
|
|
2
2
|
require 'rake/testtask'
|
3
3
|
|
4
4
|
Rake::TestTask.new do |t|
|
5
|
-
t.libs << '
|
6
|
-
t.test_files = FileList['test/sepa
|
5
|
+
t.libs << 'test'
|
6
|
+
t.test_files = FileList['test/sepa/**/*_test.rb']
|
7
7
|
t.verbose = true
|
8
8
|
end
|
9
9
|
|
10
|
+
desc "Open an irb session preloaded with this library"
|
11
|
+
task :console do
|
12
|
+
sh "bundle exec irb -I lib -r sepafm.rb"
|
13
|
+
end
|
14
|
+
|
10
15
|
task :default => :test
|