sepafm 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -0
  3. data/.travis.yml +1 -1
  4. data/lib/sepa/application_request.rb +30 -31
  5. data/lib/sepa/attribute_checks.rb +44 -15
  6. data/lib/sepa/banks/danske/danske_response.rb +21 -0
  7. data/lib/sepa/banks/danske/soap_danske.rb +7 -18
  8. data/lib/sepa/banks/nordea/nordea_response.rb +13 -0
  9. data/lib/sepa/banks/nordea/soap_nordea.rb +3 -63
  10. data/lib/sepa/banks/op/op_response.rb +76 -0
  11. data/lib/sepa/banks/op/soap_op.rb +14 -0
  12. data/lib/sepa/certificates/op_root_certificate.cer +30 -0
  13. data/lib/sepa/client.rb +20 -26
  14. data/lib/sepa/response.rb +28 -7
  15. data/lib/sepa/soap_builder.rb +65 -8
  16. data/lib/sepa/utilities.rb +8 -21
  17. data/lib/sepa/version.rb +1 -1
  18. data/lib/sepa/wsdl/wsdl_op_cert_production.xml +156 -0
  19. data/lib/sepa/wsdl/wsdl_op_cert_test.xml +157 -0
  20. data/lib/sepa/wsdl/wsdl_op_production.xml +234 -0
  21. data/lib/sepa/wsdl/wsdl_op_test.xml +234 -0
  22. data/lib/sepa/xml_schemas/op/ApplicationRequest_20080918.xsd +135 -0
  23. data/lib/sepa/xml_schemas/op/ApplicationResponse_20080918.xsd +311 -0
  24. data/lib/sepa/xml_schemas/op/CertApplicationRequest_200812.xsd +105 -0
  25. data/lib/sepa/xml_schemas/op/CertApplicationResponse_200812.xsd +88 -0
  26. data/lib/sepa/xml_templates/application_request/{create_certificate.xml → danske/create_certificate.xml} +8 -8
  27. data/lib/sepa/xml_templates/application_request/{danske_get_bank_certificate.xml → danske/get_bank_certificate.xml} +3 -3
  28. data/lib/sepa/xml_templates/application_request/download_file.xml +10 -11
  29. data/lib/sepa/xml_templates/application_request/download_file_list.xml +9 -10
  30. data/lib/sepa/xml_templates/application_request/nordea/get_certificate.xml +11 -0
  31. data/lib/sepa/xml_templates/application_request/op/get_certificate.xml +12 -0
  32. data/lib/sepa/xml_templates/application_request/op/get_service_certificates.xml +10 -0
  33. data/lib/sepa/xml_templates/soap/{create_certificate.xml → danske/create_certificate.xml} +6 -6
  34. data/lib/sepa/xml_templates/soap/{danske_get_bank_certificate.xml → danske/get_bank_certificate.xml} +5 -5
  35. data/lib/sepa/xml_templates/soap/nordea/get_certificate.xml +15 -0
  36. data/lib/sepa/xml_templates/soap/op/get_certificate.xml +14 -0
  37. data/lib/sepa/xml_templates/soap/op/get_service_certificates.xml +14 -0
  38. data/lib/sepafm.rb +36 -0
  39. data/readme.md +9 -6
  40. data/sepafm.gemspec +8 -8
  41. data/test/custom_assertions.rb +20 -0
  42. data/test/sepa/banks/op/op_application_request_test.rb +63 -0
  43. data/test/sepa/banks/op/op_cert_application_request_test.rb +77 -0
  44. data/test/sepa/banks/op/op_cert_request_soap_builder_test.rb +62 -0
  45. data/test/sepa/banks/op/op_generic_soap_builder_test.rb +52 -0
  46. data/test/sepa/banks/op/op_response_test.rb +13 -0
  47. data/test/sepa/client_test.rb +35 -1
  48. data/test/sepa/fixtures.rb +82 -0
  49. data/test/sepa/sepa_test.rb +1 -1
  50. data/test/test_helper.rb +1 -0
  51. data/test_client/data/certs_example.rb +9 -0
  52. data/test_client/data/params_example.rb +110 -0
  53. data/test_client/test_client.rb +61 -0
  54. metadata +42 -12
  55. data/lib/sepa/xml_templates/application_request/get_certificate.xml +0 -11
  56. data/lib/sepa/xml_templates/soap/get_certificate.xml +0 -14
data/test/test_helper.rb CHANGED
@@ -17,6 +17,7 @@ SimpleCov.start do
17
17
  add_filter "/vendor/"
18
18
  end
19
19
 
20
+ require 'custom_assertions'
20
21
  require 'sepafm'
21
22
  require 'sepa/fixtures'
22
23
 
@@ -0,0 +1,9 @@
1
+ NORDEA_CSR = ''
2
+ NORDEA_CERT = ''
3
+ NORDEA_PRIVATE_KEY = ''
4
+ DANSKE_BANK_ENC_CERT = ''
5
+ DANSKE_SIGNING_CERT_REQUEST = ''
6
+ DANSKE_ENC_CERT_REQUEST = ''
7
+ OP_CSR = ''
8
+ OP_PRIVATE_KEY = ''
9
+ OP_CERT = ''
@@ -0,0 +1,110 @@
1
+ PAYLOAD = "#{ROOT_PATH}/test_client/data/payload.xml"
2
+
3
+ NORDEA_GET_CERTIFICATE_PARAMS = {
4
+ pin: '1234567890',
5
+ bank: :nordea,
6
+ command: :get_certificate,
7
+ customer_id: '11111111',
8
+ environment: 'test',
9
+ signing_csr: NORDEA_CSR
10
+ }
11
+
12
+
13
+ NORDEA_UPLOAD_FILE_PARAMS = {
14
+ bank: :nordea,
15
+ own_signing_certificate: NORDEA_CERT,
16
+ signing_private_key: NORDEA_PRIVATE_KEY,
17
+ command: :upload_file,
18
+ customer_id: '11111111',
19
+ target_id: '11111111A1',
20
+ file_type: 'NDCORPAYS',
21
+ content: PAYLOAD,
22
+ }
23
+
24
+ NORDEA_DOWNLOAD_FILE_PARAMS = {
25
+ bank: :nordea,
26
+ command: :download_file,
27
+ own_signing_certificate: NORDEA_CERT,
28
+ signing_private_key: NORDEA_PRIVATE_KEY,
29
+ customer_id: '11111111',
30
+ file_type: 'TITO',
31
+ file_reference: "11111111A12006030319503000000010",
32
+ target_id: '11111111A1',
33
+ status: 'NEW'
34
+ }
35
+
36
+ NORDEA_DOWNLOAD_FILE_LIST_PARAMS = {
37
+ bank: :nordea,
38
+ command: :download_file_list,
39
+ own_signing_certificate: NORDEA_CERT,
40
+ signing_private_key: NORDEA_PRIVATE_KEY,
41
+ customer_id: '11111111',
42
+ target_id: '11111111A1',
43
+ status: 'NEW',
44
+ file_type: 'NDCORPAYL'
45
+ }
46
+
47
+ NORDEA_GET_USER_INFO_PARAMS = {
48
+ bank: :nordea,
49
+ command: :get_user_info,
50
+ own_signing_certificate: NORDEA_CERT,
51
+ signing_private_key: NORDEA_PRIVATE_KEY,
52
+ customer_id: '11111111',
53
+ environment: 'TEST'
54
+ }
55
+
56
+ DANSKE_GET_BANK_CERT_PARAMS = {
57
+ environment: 'test',
58
+ bank: :danske,
59
+ command: :get_bank_certificate,
60
+ customer_id: '',
61
+ }
62
+
63
+ DANSKE_CREATE_CERT_PARAMS = {
64
+ bank: :danske,
65
+ bank_encryption_certificate: DANSKE_BANK_ENC_CERT,
66
+ command: :create_certificate,
67
+ customer_id: '',
68
+ environment: 'test',
69
+ encryption_csr: DANSKE_ENC_CERT_REQUEST,
70
+ signing_csr: DANSKE_SIGNING_CERT_REQUEST,
71
+ pin: '1234'
72
+ }
73
+
74
+ OP_GET_SERVICE_CERTIFICATES_PARAMS = {
75
+ bank: :op,
76
+ command: :get_service_certificates,
77
+ customer_id: '',
78
+ environment: 'test',
79
+ }
80
+
81
+ OP_UPLOAD_FILE_PARAMS = {
82
+ bank: :op,
83
+ command: :upload_file,
84
+ content: PAYLOAD,
85
+ customer_id: '',
86
+ environment: 'test',
87
+ file_type: 'pain.001.001.02',
88
+ own_signing_certificate: OP_CERT,
89
+ signing_private_key: OP_PRIVATE_KEY,
90
+ }
91
+
92
+ OP_DOWNLOAD_FILE_PARAMS = {
93
+ bank: :op,
94
+ command: :download_file,
95
+ customer_id: '',
96
+ environment: 'test',
97
+ file_reference: '',
98
+ own_signing_certificate: OP_CERT,
99
+ signing_private_key: OP_PRIVATE_KEY,
100
+ }
101
+
102
+ OP_DOWNLOAD_FILE_LIST_PARAMS = {
103
+ bank: :op,
104
+ command: :download_file_list,
105
+ customer_id: '',
106
+ environment: 'test',
107
+ own_signing_certificate: OP_CERT,
108
+ signing_private_key: OP_PRIVATE_KEY,
109
+ file_type: 'pain.002.001.02'
110
+ }
@@ -0,0 +1,61 @@
1
+ module Testing
2
+ require "base64"
3
+ require "sepafm"
4
+ require_relative "data/certs"
5
+ require_relative "data/params"
6
+
7
+ content_clients = {
8
+ nordea_download_file: Sepa::Client.new(NORDEA_DOWNLOAD_FILE_PARAMS),
9
+ nordea_download_file_list: Sepa::Client.new(NORDEA_DOWNLOAD_FILE_LIST_PARAMS),
10
+ nordea_get_user_info: Sepa::Client.new(NORDEA_GET_USER_INFO_PARAMS),
11
+ nordea_upload_file: Sepa::Client.new(NORDEA_UPLOAD_FILE_PARAMS),
12
+ op_download_file: Sepa::Client.new(OP_DOWNLOAD_FILE_PARAMS),
13
+ op_download_file_list: Sepa::Client.new(OP_DOWNLOAD_FILE_LIST_PARAMS),
14
+ op_upload_file: Sepa::Client.new(OP_UPLOAD_FILE_PARAMS),
15
+ }
16
+
17
+ certificate_clients = {
18
+ danske_create_cert: Sepa::Client.new(DANSKE_CREATE_CERT_PARAMS),
19
+ danske_get_bank_cert: Sepa::Client.new(DANSKE_GET_BANK_CERT_PARAMS),
20
+ nordea_get_certificate: Sepa::Client.new(NORDEA_GET_CERTIFICATE_PARAMS),
21
+ op_get_service_certificates: Sepa::Client.new(OP_GET_SERVICE_CERTIFICATES_PARAMS)
22
+ }
23
+
24
+ content_clients.each do |name, client|
25
+ response = client.send_request
26
+
27
+ if response.response_code == "00"
28
+ puts "\e[32m#{response.response_code} #{response.response_text}\e[0m #{name}"
29
+ puts "\e[31m#{response.errors.full_messages}\e[0m" unless response.valid?
30
+ puts "\n"
31
+ else
32
+ puts "\e[31m#{response.response_code} #{response.response_text}\e[0m #{name}"
33
+ puts "\n"
34
+ end
35
+
36
+ File.write "#{ROOT_PATH}/test_client/log/#{name}.log.xml", response.content
37
+ end
38
+
39
+ certificate_clients.each do |name, client|
40
+ response = client.send_request
41
+
42
+ if response.response_code == "00"
43
+ puts "\e[32m#{response.response_code} #{response.response_text}\e[0m #{name}"
44
+ puts "\e[31m#{response.errors.full_messages}\e[0m" unless response.valid?
45
+ puts "\n"
46
+ else
47
+ puts "\e[31m#{response.response_code} #{response.response_text}\e[0m #{name}"
48
+ puts "\n"
49
+ end
50
+
51
+ contents =
52
+ "# Bank Encryption Certificate:\n#{response.bank_encryption_certificate}\n\n" \
53
+ "# Bank Signing Certificate:\n#{response.bank_signing_certificate}\n\n" \
54
+ "# Bank Root Certificate:\n#{response.bank_root_certificate}\n\n" \
55
+ "# Own Encryption Certificate:\n#{response.own_encryption_certificate}\n\n" \
56
+ "# Own Signing Certificate:\n#{response.own_signing_certificate}\n\n" \
57
+ "# CA Certificate:\n#{response.ca_certificate}\n\n"
58
+
59
+ File.write("#{ROOT_PATH}/test_client/log/#{name}.pem", contents)
60
+ end
61
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sepafm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joni Kanerva
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-10-28 00:00:00.000000000 Z
13
+ date: 2015-11-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
@@ -60,14 +60,14 @@ dependencies:
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '1.7'
63
+ version: '1.10'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: '1.7'
70
+ version: '1.10'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: codeclimate-test-reporter
73
73
  requirement: !ruby/object:Gem::Requirement
@@ -158,8 +158,11 @@ files:
158
158
  - lib/sepa/banks/danske/soap_danske.rb
159
159
  - lib/sepa/banks/nordea/nordea_response.rb
160
160
  - lib/sepa/banks/nordea/soap_nordea.rb
161
+ - lib/sepa/banks/op/op_response.rb
162
+ - lib/sepa/banks/op/soap_op.rb
161
163
  - lib/sepa/certificates/danske_root_certificate.cer
162
164
  - lib/sepa/certificates/nordea_root_certificate.cer
165
+ - lib/sepa/certificates/op_root_certificate.cer
163
166
  - lib/sepa/client.rb
164
167
  - lib/sepa/error_messages.rb
165
168
  - lib/sepa/response.rb
@@ -170,6 +173,10 @@ files:
170
173
  - lib/sepa/wsdl/wsdl_danske_cert.xml
171
174
  - lib/sepa/wsdl/wsdl_nordea.xml
172
175
  - lib/sepa/wsdl/wsdl_nordea_cert.xml
176
+ - lib/sepa/wsdl/wsdl_op_cert_production.xml
177
+ - lib/sepa/wsdl/wsdl_op_cert_test.xml
178
+ - lib/sepa/wsdl/wsdl_op_production.xml
179
+ - lib/sepa/wsdl/wsdl_op_test.xml
173
180
  - lib/sepa/xml_schemas/PKIFactory.xsd
174
181
  - lib/sepa/xml_schemas/application_request.xsd
175
182
  - lib/sepa/xml_schemas/application_response.xsd
@@ -177,31 +184,40 @@ files:
177
184
  - lib/sepa/xml_schemas/danske_pki.xsd
178
185
  - lib/sepa/xml_schemas/oasis-200401-wss-wssecurity-secext-1.0.xsd
179
186
  - lib/sepa/xml_schemas/oasis-200401-wss-wssecurity-utility-1.0.xsd
187
+ - lib/sepa/xml_schemas/op/ApplicationRequest_20080918.xsd
188
+ - lib/sepa/xml_schemas/op/ApplicationResponse_20080918.xsd
189
+ - lib/sepa/xml_schemas/op/CertApplicationRequest_200812.xsd
190
+ - lib/sepa/xml_schemas/op/CertApplicationResponse_200812.xsd
180
191
  - lib/sepa/xml_schemas/pain.001.001.02.xsd
181
192
  - lib/sepa/xml_schemas/soap.xsd
182
193
  - lib/sepa/xml_schemas/wsdl.xml
183
194
  - lib/sepa/xml_schemas/xml.xsd
184
195
  - lib/sepa/xml_schemas/xml_id.xsd
185
196
  - lib/sepa/xml_schemas/xmldsig-core-schema.xsd
186
- - lib/sepa/xml_templates/application_request/create_certificate.xml
187
- - lib/sepa/xml_templates/application_request/danske_get_bank_certificate.xml
197
+ - lib/sepa/xml_templates/application_request/danske/create_certificate.xml
198
+ - lib/sepa/xml_templates/application_request/danske/get_bank_certificate.xml
188
199
  - lib/sepa/xml_templates/application_request/download_file.xml
189
200
  - lib/sepa/xml_templates/application_request/download_file_list.xml
190
201
  - lib/sepa/xml_templates/application_request/encrypted_request.xml
191
- - lib/sepa/xml_templates/application_request/get_certificate.xml
192
202
  - lib/sepa/xml_templates/application_request/get_user_info.xml
203
+ - lib/sepa/xml_templates/application_request/nordea/get_certificate.xml
204
+ - lib/sepa/xml_templates/application_request/op/get_certificate.xml
205
+ - lib/sepa/xml_templates/application_request/op/get_service_certificates.xml
193
206
  - lib/sepa/xml_templates/application_request/upload_file.xml
194
- - lib/sepa/xml_templates/soap/create_certificate.xml
195
- - lib/sepa/xml_templates/soap/danske_get_bank_certificate.xml
207
+ - lib/sepa/xml_templates/soap/danske/create_certificate.xml
208
+ - lib/sepa/xml_templates/soap/danske/get_bank_certificate.xml
196
209
  - lib/sepa/xml_templates/soap/download_file.xml
197
210
  - lib/sepa/xml_templates/soap/download_file_list.xml
198
- - lib/sepa/xml_templates/soap/get_certificate.xml
199
211
  - lib/sepa/xml_templates/soap/get_user_info.xml
200
212
  - lib/sepa/xml_templates/soap/header.xml
213
+ - lib/sepa/xml_templates/soap/nordea/get_certificate.xml
214
+ - lib/sepa/xml_templates/soap/op/get_certificate.xml
215
+ - lib/sepa/xml_templates/soap/op/get_service_certificates.xml
201
216
  - lib/sepa/xml_templates/soap/upload_file.xml
202
217
  - lib/sepafm.rb
203
218
  - readme.md
204
219
  - sepafm.gemspec
220
+ - test/custom_assertions.rb
205
221
  - test/sepa/banks/danske/danske_cert_response_test.rb
206
222
  - test/sepa/banks/danske/danske_cert_soap_builder_test.rb
207
223
  - test/sepa/banks/danske/danske_certificate_application_request_test.rb
@@ -242,11 +258,19 @@ files:
242
258
  - test/sepa/banks/nordea/responses/invalid/timestamp_altered.xml
243
259
  - test/sepa/banks/nordea/responses/not_ok_response_code.xml
244
260
  - test/sepa/banks/nordea/responses/uf.xml
261
+ - test/sepa/banks/op/op_application_request_test.rb
262
+ - test/sepa/banks/op/op_cert_application_request_test.rb
263
+ - test/sepa/banks/op/op_cert_request_soap_builder_test.rb
264
+ - test/sepa/banks/op/op_generic_soap_builder_test.rb
265
+ - test/sepa/banks/op/op_response_test.rb
245
266
  - test/sepa/client_test.rb
246
267
  - test/sepa/fixtures.rb
247
268
  - test/sepa/sepa_test.rb
248
269
  - test/sepa/test_files/invalid_wsdl.wsdl
249
270
  - test/test_helper.rb
271
+ - test_client/data/certs_example.rb
272
+ - test_client/data/params_example.rb
273
+ - test_client/test_client.rb
250
274
  homepage: https://github.com/devlab-oy/sepa
251
275
  licenses:
252
276
  - MIT
@@ -259,7 +283,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
259
283
  requirements:
260
284
  - - ">="
261
285
  - !ruby/object:Gem::Version
262
- version: 2.0.0
286
+ version: 2.1.7
263
287
  required_rubygems_version: !ruby/object:Gem::Requirement
264
288
  requirements:
265
289
  - - ">="
@@ -267,11 +291,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
291
  version: '0'
268
292
  requirements: []
269
293
  rubyforge_project:
270
- rubygems_version: 2.4.8
294
+ rubygems_version: 2.5.0
271
295
  signing_key:
272
296
  specification_version: 4
273
297
  summary: SEPA Financial Messages
274
298
  test_files:
299
+ - test/custom_assertions.rb
275
300
  - test/sepa/banks/danske/danske_cert_response_test.rb
276
301
  - test/sepa/banks/danske/danske_cert_soap_builder_test.rb
277
302
  - test/sepa/banks/danske/danske_certificate_application_request_test.rb
@@ -312,6 +337,11 @@ test_files:
312
337
  - test/sepa/banks/nordea/responses/invalid/timestamp_altered.xml
313
338
  - test/sepa/banks/nordea/responses/not_ok_response_code.xml
314
339
  - test/sepa/banks/nordea/responses/uf.xml
340
+ - test/sepa/banks/op/op_application_request_test.rb
341
+ - test/sepa/banks/op/op_cert_application_request_test.rb
342
+ - test/sepa/banks/op/op_cert_request_soap_builder_test.rb
343
+ - test/sepa/banks/op/op_generic_soap_builder_test.rb
344
+ - test/sepa/banks/op/op_response_test.rb
315
345
  - test/sepa/client_test.rb
316
346
  - test/sepa/fixtures.rb
317
347
  - test/sepa/sepa_test.rb
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <CertApplicationRequest xmlns="http://filetransfer.nordea.com/xmldata/">
3
- <CustomerId></CustomerId>
4
- <Timestamp></Timestamp>
5
- <Environment></Environment>
6
- <SoftwareId></SoftwareId>
7
- <Command></Command>
8
- <Service></Service>
9
- <Content></Content>
10
- <HMAC></HMAC>
11
- </CertApplicationRequest>
@@ -1,14 +0,0 @@
1
- <?xml version="1.0"?>
2
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cer="http://bxd.fi/CertificateService">
3
- <soapenv:Header/>
4
- <soapenv:Body>
5
- <cer:getCertificatein>
6
- <cer:RequestHeader>
7
- <cer:SenderId></cer:SenderId>
8
- <cer:RequestId></cer:RequestId>
9
- <cer:Timestamp></cer:Timestamp>
10
- </cer:RequestHeader>
11
- <cer:ApplicationRequest></cer:ApplicationRequest>
12
- </cer:getCertificatein>
13
- </soapenv:Body>
14
- </soapenv:Envelope>