sepafm 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +14 -30
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +15 -0
  5. data/Gemfile +1 -1
  6. data/LICENSE +16 -4
  7. data/README.md +180 -319
  8. data/Rakefile +7 -2
  9. data/lib/sepa/application_request.rb +100 -131
  10. data/lib/sepa/application_response.rb +28 -84
  11. data/lib/sepa/attribute_checks.rb +169 -0
  12. data/lib/sepa/banks/danske/danske_response.rb +19 -0
  13. data/lib/sepa/banks/danske/soap_danske.rb +132 -0
  14. data/lib/sepa/banks/nordea/nordea_response.rb +20 -0
  15. data/lib/sepa/banks/nordea/soap_nordea.rb +51 -0
  16. data/lib/sepa/client.rb +72 -60
  17. data/lib/sepa/error_messages.rb +15 -0
  18. data/lib/sepa/response.rb +88 -85
  19. data/lib/sepa/soap_builder.rb +51 -341
  20. data/lib/sepa/utilities.rb +132 -0
  21. data/lib/sepa/version.rb +1 -1
  22. data/lib/sepa/xml_schemas/PKIFactory.xsd +334 -0
  23. data/lib/sepa/xml_schemas/xml_id.xsd +9 -0
  24. data/lib/sepa/xml_templates/application_request/create_certificate.xml +15 -10
  25. data/lib/sepa/xml_templates/application_request/danske_get_bank_certificate.xml +13 -9
  26. data/lib/sepa/xml_templates/application_request/download_file.xml +32 -30
  27. data/lib/sepa/xml_templates/application_request/download_file_list.xml +29 -27
  28. data/lib/sepa/xml_templates/application_request/encrypted_request.xml +22 -0
  29. data/lib/sepa/xml_templates/application_request/get_certificate.xml +9 -8
  30. data/lib/sepa/xml_templates/application_request/get_user_info.xml +26 -24
  31. data/lib/sepa/xml_templates/application_request/upload_file.xml +29 -27
  32. data/lib/sepa/xml_templates/soap/create_certificate.xml +17 -15
  33. data/lib/sepa/xml_templates/soap/danske_get_bank_certificate.xml +15 -13
  34. data/lib/sepa/xml_templates/soap/download_file.xml +19 -15
  35. data/lib/sepa/xml_templates/soap/download_file_list.xml +19 -15
  36. data/lib/sepa/xml_templates/soap/get_certificate.xml +2 -1
  37. data/lib/sepa/xml_templates/soap/get_user_info.xml +19 -15
  38. data/lib/sepa/xml_templates/soap/header.xml +48 -37
  39. data/lib/sepa/xml_templates/soap/upload_file.xml +19 -15
  40. data/lib/sepafm.rb +20 -18
  41. data/{sepa.gemspec → sepafm.gemspec} +10 -9
  42. data/test/sepa/banks/danske/danske_cert_response_test.rb +52 -0
  43. data/test/sepa/banks/danske/danske_cert_soap_builder_test.rb +100 -0
  44. data/test/sepa/banks/danske/danske_generic_soap_builder_test.rb +278 -0
  45. data/test/sepa/banks/danske/danske_get_bank_cert_test.rb +111 -0
  46. data/{lib/sepa/danske_testing/keys/danske_encryption.crt → test/sepa/banks/danske/keys/bank_encryption_cert.pem} +0 -0
  47. data/test/sepa/{danske_test_keys/danskeroot.pem → banks/danske/keys/bank_root_cert.pem} +1 -1
  48. data/test/sepa/banks/danske/keys/bank_signing_cert.pem +24 -0
  49. data/test/sepa/banks/danske/keys/danske_encryption.crt +24 -0
  50. data/test/sepa/banks/danske/keys/enc_private_key.pem +27 -0
  51. data/test/sepa/{danske_test_keys → banks/danske/keys}/encryption_pkcs.csr +0 -0
  52. data/test/sepa/banks/danske/keys/own_enc_cert.pem +21 -0
  53. data/test/sepa/banks/danske/keys/own_signing_cert.pem +22 -0
  54. data/test/sepa/{danske_test_keys → banks/danske/keys}/signing_key.pem +0 -0
  55. data/test/sepa/{danske_test_keys → banks/danske/keys}/signing_pkcs.csr +0 -0
  56. data/test/sepa/banks/danske/keys/signing_private_key.pem +27 -0
  57. data/test/sepa/banks/danske/responses/create_cert.xml +38 -0
  58. data/test/sepa/banks/danske/responses/get_bank_cert.xml +37 -0
  59. data/{lib/sepa/nordea_testing → test/sepa/banks/nordea}/keys/nordea.crt +0 -4
  60. data/test/sepa/{nordea_test_keys → banks/nordea/keys}/nordea.key +0 -3
  61. data/test/sepa/{nordea_test_keys → banks/nordea/keys}/root_cert.cer +0 -0
  62. data/test/sepa/{nordea_test_keys → banks/nordea/keys}/testcert.csr +0 -0
  63. data/test/sepa/banks/nordea/nordea_application_request_test.rb +252 -0
  64. data/test/sepa/{application_response_test.rb → banks/nordea/nordea_application_response_test.rb} +40 -46
  65. data/test/sepa/banks/nordea/nordea_cert_application_request_test.rb +72 -0
  66. data/test/sepa/banks/nordea/nordea_cert_request_soap_builder_test.rb +65 -0
  67. data/test/sepa/banks/nordea/nordea_generic_soap_builder_test.rb +280 -0
  68. data/test/sepa/banks/nordea/nordea_response_test.rb +116 -0
  69. data/test/sepa/banks/nordea/responses/df_ktl.xml +45 -0
  70. data/test/sepa/{test_files/test_responses/df.xml → banks/nordea/responses/df_tito.xml} +1 -1
  71. data/test/sepa/{test_files/test_responses → banks/nordea/responses}/dfl.xml +0 -0
  72. data/test/sepa/banks/nordea/responses/gbc.xml +15 -0
  73. data/test/sepa/banks/nordea/responses/gc.xml +49 -0
  74. data/test/sepa/{test_files/test_responses → banks/nordea/responses}/gui.xml +0 -0
  75. data/test/sepa/{test_files/test_responses → banks/nordea/responses}/uf.xml +0 -0
  76. data/test/sepa/client_test.rb +156 -302
  77. data/test/sepa/fixtures.rb +214 -0
  78. data/test/sepa/sepa_test.rb +3 -13
  79. data/test/sepa/test_files/{invalid.wsdl → invalid_wsdl.wsdl} +0 -0
  80. data/test/test_helper.rb +29 -3
  81. metadata +140 -116
  82. data/lib/danske_get_bank_certificate_test.rb +0 -15
  83. data/lib/sepa/custom_exceptions.rb +0 -2
  84. data/lib/sepa/filedescriptor.rb +0 -7
  85. data/lib/sepa/filetypeservice.rb +0 -6
  86. data/lib/sepa/nordea_testing/keys/CSR.csr +0 -0
  87. data/lib/sepa/nordea_testing/keys/nordea.key +0 -19
  88. data/lib/sepa/nordea_testing/response/content_053.xml +0 -998
  89. data/lib/sepa/nordea_testing/response/content_054.xml +0 -1
  90. data/lib/sepa/nordea_testing/response/download_file_response.xml +0 -14
  91. data/lib/sepa/nordea_testing/response/download_filelist_response.xml +0 -14
  92. data/lib/sepa/nordea_testing/response/get_user_info_response.xml +0 -14
  93. data/lib/sepa/nordea_testing/response/upload_file_response.xml +0 -14
  94. data/lib/sepa/payload.rb +0 -109
  95. data/lib/sepa/payment.rb +0 -97
  96. data/lib/sepa/sender_verifier.rb +0 -15
  97. data/lib/sepa/signature.rb +0 -7
  98. data/lib/sepa/soap_danske.rb +0 -47
  99. data/lib/sepa/soap_nordea.rb +0 -68
  100. data/lib/sepa/transaction.rb +0 -178
  101. data/lib/sepa/userfiletype.rb +0 -16
  102. data/lib/sepa/xml_parser.rb +0 -291
  103. data/lib/sepa_client_testing_mika.rb +0 -32
  104. data/lib/sepa_client_testing_tiere.rb +0 -257
  105. data/test/sepa/application_request_test.rb +0 -423
  106. data/test/sepa/cert_application_request_test.rb +0 -99
  107. data/test/sepa/nordea_cert_request_soap_builder_test.rb +0 -112
  108. data/test/sepa/nordea_generic_soap_builder_test.rb +0 -427
  109. data/test/sepa/nordea_test_keys/nordea.crt +0 -27
  110. data/test/sepa/payload_test.rb +0 -297
  111. data/test/sepa/payment_test.rb +0 -198
  112. data/test/sepa/response_test.rb +0 -269
  113. data/test/sepa/transaction_test.rb +0 -362
  114. data/test/sepa/user_file_type_test.rb +0 -21
  115. data/test/sepa/xml_parser_test.rb +0 -73
data/README.md CHANGED
@@ -1,385 +1,246 @@
1
1
  # Devlab / SEPA
2
2
 
3
- This project aims to create an open source implementation of SEPA Financial Messages using Web Services. Project implementation will be done in Ruby. We will also create a REST API for this module.
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
- ## First milestone
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
- * Support for SEPA Web Services
8
- * Customer-to-Bank Statement. ISO standard "CustomerCreditTransferInitiationV03", XML schema "pain.001.001.03"
9
- * Bank-to-Customer Statement. ISO standard "BankToCustomerStatementV02", XML schema "camt.053.001.02"
10
- * Bank-to-Customer Debit/Credit Notification. ISO standard "BankToCustomerDebitCreditNotificationV02", XML schma "camt.054.001.02"
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
- gem 'sepafm'
18
+ ```ruby
19
+ gem 'sepafm'
20
+ ```
18
21
 
19
22
  And then execute:
20
23
 
21
- $ bundle
24
+ ```bash
25
+ $ bundle
26
+ ```
22
27
 
23
- Or install it yourself as:
28
+ Or install it with:
24
29
 
25
- $ gem install sepafm
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
- 1. Require the gem:
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
- * Check that the hashes match in the response
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
- response.hashes_match?
54
+ Initialize a new instance of the client and pass the params hash
217
55
 
218
- # You can also provide an optional parameter verbose:true
219
- # if you want to see which hashes failed to verify.
56
+ ```ruby
57
+ client = Sepa::Client.new params
58
+ ```
220
59
 
221
- response.hashes_match?(verbose: true)
60
+ Send request to bank
222
61
 
223
- * Check that the signature of the response is valid
62
+ ```ruby
63
+ response = client.send_request
64
+ ```
224
65
 
225
- response.signature_is_valid?
66
+ ### Interacting with the response
226
67
 
227
- * Extract the certificate from the response
68
+ Make sure response is valid
228
69
 
229
- # Will return an OpenSSL::X509::Certificate object
230
- response.certificate
70
+ ```ruby
71
+ response.valid?
72
+ ```
231
73
 
232
- * Check that the certificate is trusted against a root cert
74
+ Get reponse content
233
75
 
234
- # The root cert has to be of type OpenSSL::X509::Certificate
235
- response.cert_is_trusted?(root_cert)
76
+ ```ruby
77
+ response.content
78
+ ```
236
79
 
237
- ### Verifying the application response
80
+ ### Downloading Nordea certificate
238
81
 
239
- 1. Extract the application request from the request
82
+ Define parameters hash for client
240
83
 
241
- ar = response.application_request
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
- * Check that the hashes match in the application response
96
+ Initialize a new instance of the client and pass the params hash
244
97
 
245
- ar.hashes_match?
98
+ ```ruby
99
+ client = Sepa::Client.new params
100
+ response = client.send_request
101
+ ```
246
102
 
247
- * Check that the signature of the application response is valid
103
+ Get the certificates from the response
248
104
 
249
- ar.signature_is_valid?
105
+ ```ruby
106
+ response.content
107
+ ```
250
108
 
251
- * Extract the certificate from the application response
109
+ ### Downloading Danske bank certificates
252
110
 
253
- # Will return an OpenSSL::X509::Certificate object
254
- ar.certificate
111
+ #### Bank's certificates
255
112
 
256
- * Check that the certificate is trusted against a root cert
113
+ Define parameters hash for client
257
114
 
258
- # The root cert has to be of type OpenSSL::X509::Certificate
259
- ar.cert_is_trusted?(root_cert)
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
- ### For downloading Nordea certificate
127
+ Initialize a new instance of the client and pass the params hash
262
128
 
263
- 1. Require the gem:
129
+ ```ruby
130
+ client = Sepa::Client.new params
131
+ response = client.send_request
132
+ ```
264
133
 
265
- require 'sepafm'
134
+ Get the certificates from the response
266
135
 
267
- 2. Define the hash that will be passed to the gem when initializing it:
136
+ ```ruby
137
+ # Bank's encryption certificate
138
+ response.bank_encryption_cert
268
139
 
269
- params = {
270
- bank: :nordea,
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
- 3. Initialize a new instance of the client and pass the params hash
143
+ # Bank's root certificate
144
+ response.bank_root_cert
145
+ ```
279
146
 
280
- sepa_client = Sepa::Client.new(params)
281
- sepa_client.call
147
+ #### Own certificates
282
148
 
283
- 4. Save the certificate from the response into a local file
149
+ Define parameters hash
284
150
 
285
- ### For downloading Danske bank certificates
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
- 1. Require the gem:
165
+ Initialize a new instance of the client and pass the params hash
288
166
 
289
- require 'sepafm'
167
+ ```ruby
168
+ client = Sepa::Client.new params
169
+ response = client.send_request
170
+ ```
290
171
 
291
- 2. Define the hash that will be passed to the gem when initializing it:
172
+ Get the certificates from the response
292
173
 
293
- params = {
294
- bank: :danske,
295
- target_id: 'Danske FI',
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
- 3. Initialize a new instance of the client and pass the params hash
178
+ # Own signing certificate
179
+ response.own_signing_cert
304
180
 
305
- sepa_client = Sepa::Client.new(params)
306
- sepa_client.call
181
+ # CA Certificate used for signing own certificates
182
+ response.ca_certificate
183
+ ```
307
184
 
308
- 4. Save the certificates from the response into a local file
309
-
310
- ***
185
+ ---
311
186
 
312
187
  ### Parameter breakdown
313
188
 
314
- * bank : The bank you want to send the request to as a symbol. Either :nordea or :danske
315
-
316
- * private_key_plain: Your private key in plain text format
317
-
318
- * private_key_path: Path to your local private key file
319
-
320
- * cert_plain: Your certificate in plain text format.
321
-
322
- * cert_path: Path to your local certificate file
323
-
324
- * csr_plain: Your certificate signing request in plain text format
325
-
326
- * csr_path: Path to your local certificate signing request file
327
-
328
- * command: Either :download_file_list, :upload_file, :download_file, :get_user_info, :get_certificate or :get_bank_certificate, depending on what you want to do.
329
-
330
- * customer_id: Your personal id with the bank.
331
-
332
- * environment: Must be either PRODUCTION or TEST
333
-
334
- * status: For filtering stuff. Must be either NEW, DOWNLOADED or ALL
335
-
336
- * target_id: Some specification of the folder which to access in the bank.
337
-
338
- * language: Language must be either FI, EN or SV
339
-
340
- * file_type: File types to upload or download:
341
-
342
- * LMP300 = Laskujen maksupalvelu (lähtevä)
343
-
344
- * LUM2 = Valuuttamaksut (lähtevä)
345
-
346
- * KTL = Saapuvat viitemaksut (saapuva)
347
-
348
- * TITO = Konekielinen tiliote (saapuva)
349
-
350
- * NDCORPAYS = Yrityksen maksut XML (lähtevä)
351
-
352
- * NDCAMT53L = Konekielinen XML-tiliote (saapuva)
353
-
354
- * NDCAMT54L = Saapuvat XML viitemaksu (saapuva)
355
-
356
- * content: The actual payload to send. The creation of this file may be supported by the client at some point.
357
-
358
- * file_reference: File reference for :download_file command
359
-
360
- * pin: Your personal pin-code provided by the bank
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
- 2. Create your feature branch (`git checkout -b my-new-feature`)
380
- 3. Commit your changes (`git commit -am 'Add some feature'`)
381
- 4. Push to the branch (`git push origin my-new-feature`)
382
- 5. Create new Pull Request
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 << 'lib/sepa'
6
- t.test_files = FileList['test/sepa/*_test.rb']
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