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
@@ -1,73 +0,0 @@
1
- require File.expand_path('../../test_helper.rb', __FILE__)
2
-
3
- class XmlParserTest < MiniTest::Test
4
- def setup
5
- @exampleresponsepath = File.expand_path('../../../lib/sepa/nordea_testing/response',__FILE__)
6
-
7
- @parser = Sepa::XmlParser.new
8
- end
9
-
10
- def test_that_053_example_is_unmodified
11
- sha1 = OpenSSL::Digest::SHA1.new
12
- template = File.read("#{@exampleresponsepath}/content_053.xml")
13
- digest = Base64.encode64(sha1.digest(template)).strip
14
- assert_equal digest, "kfgZav//JsPs+tLG8XrE2Sn+aT0="
15
- end
16
-
17
- def test_that_054_example_is_unmodified
18
- sha1 = OpenSSL::Digest::SHA1.new
19
- template = File.read("#{@exampleresponsepath}/content_054.xml")
20
- digest = Base64.encode64(sha1.digest(template)).strip
21
- assert_equal digest, "flXaS2mlkdckXDUX0lWPuafEris="
22
- end
23
-
24
- def test_parsing_053_should_fail_when_empty_content_entered
25
- assert_raises(ArgumentError) {@parser.get_account_statement_content("")}
26
- end
27
-
28
- def test_parsing_054_should_fail_when_empty_content_entered
29
- assert_raises(ArgumentError) {@parser.get_debit_credit_notification_content("")}
30
- end
31
-
32
- def test_should_parse_content_from_response_when_parsing_download_file_response
33
- @parser.animate_response("#{@exampleresponsepath}/download_file_response.xml")
34
- assert_equal @parser.content.empty?, false
35
- end
36
-
37
- def test_should_parse_userfiletypes_from_response_when_parsing_get_user_info_response
38
- @parser.animate_response("#{@exampleresponsepath}/get_user_info_response.xml")
39
- assert @parser.list_userfiletypes.kind_of?(Array), "Type not an array"
40
- assert @parser.list_userfiletypes.length > 0, "Array should not be empty" #Very unlikely to ever be empty
41
- end
42
-
43
- def test_should_return_hash_from_053_request
44
- assert @parser.get_account_statement_content("#{@exampleresponsepath}/content_053.xml").kind_of?(Hash), "Does not return a hash"
45
- assert @parser.get_account_statement_content("#{@exampleresponsepath}/content_053.xml").length > 0, "Hash should not be empty"
46
- end
47
-
48
- def test_should_return_hash_from_054_request
49
- assert @parser.get_debit_credit_notification_content("#{@exampleresponsepath}/content_054.xml").kind_of?(Hash), "Does not return a hash"
50
- assert @parser.get_debit_credit_notification_content("#{@exampleresponsepath}/content_054.xml").length > 0, "Hash should not be empty"
51
- end
52
-
53
- def test_method_listnewdescriptors_should_return_array_of_descriptors_when_parsing_download_file_list
54
- @parser.animate_response("#{@exampleresponsepath}/download_filelist_response.xml")
55
- assert @parser.list_new_descriptors.kind_of?(Array), "Type not an array" # Array can be empty
56
- end
57
-
58
- def test_method_listdescriptors_should_return_array_of_descriptors_when_parsing_download_file_list
59
- @parser.animate_response("#{@exampleresponsepath}/download_filelist_response.xml")
60
- assert @parser.list_all_descriptors.kind_of?(Array), "Type not an array"
61
- assert @parser.list_all_descriptors.length > 0, "Array should not be empty"
62
- end
63
-
64
- def test_method_selectdescriptor_should_return_file_information_with_file_reference
65
- @parser.animate_response("#{@exampleresponsepath}/download_filelist_response.xml")
66
- collection = @parser.list_new_descriptors
67
- sampler = collection[0]
68
- sample = sampler.sample
69
-
70
- assert @parser.select_descriptor(sample.fileReference).kind_of?(Array), "Does not return an array"
71
- assert @parser.select_descriptor(sample.fileReference).length > 0, "Should return an array with length more than 0"
72
- end
73
- end