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,14 +0,0 @@
1
- <c2b:ApplicationResponse xmlns:c2b="http://bxd.fi/xmldata/"><c2b:CustomerId>679155330</c2b:CustomerId><c2b:Timestamp>2010-09-10T10:20:38+02:00</c2b:Timestamp><c2b:ResponseCode>00</c2b:ResponseCode><c2b:ResponseText>OK.</c2b:ResponseText><c2b:Encrypted>false</c2b:Encrypted><c2b:Compressed>false</c2b:Compressed><c2b:UserFileTypes><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>HAELASKUT</c2b:FileType><c2b:FileTypeName>E-invoice to payer FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-FI3329501800008512</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-FI5229501800000022</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-FI7429501800000014</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-FI8319503000004327</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>HTMKTL</c2b:FileType><c2b:FileTypeName>Reference payments (html) FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000010</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000051</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000014</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000022</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>HTMKTO</c2b:FileType><c2b:FileTypeName>Account statement (html) FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000010</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000051</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000012445</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000086423</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000014</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000022</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>HYLLASKUT</c2b:FileType><c2b:FileTypeName>Rejected e-invoices to sender FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-00370011111111</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>INFO</c2b:FileType><c2b:FileTypeName>Info</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId/><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>N</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>KORKO</c2b:FileType><c2b:FileTypeName>Interest</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId/><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>N</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>KTL</c2b:FileType><c2b:FileTypeName>Reference Payments FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000010</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000051</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000014</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000022</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>LAHLASKUT</c2b:FileType><c2b:FileTypeName>E-invoice from invoicer FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Upload</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-00370011111111</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>LMP300</c2b:FileType><c2b:FileTypeName>Bill Payment service FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Upload</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-011111111</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>LMPPAL</c2b:FileType><c2b:FileTypeName>Bill payment service feedback FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-011111111</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>?</c2b:ServiceId><c2b:ServiceIdOwnerName>?</c2b:ServiceIdOwnerName><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText>?</c2b:ServiceIdText></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>NDCORPAYL</c2b:FileType><c2b:FileTypeName>Corporate payments - feedback FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-111111111</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>NDCORPAYS</c2b:FileType><c2b:FileTypeName>Corporate payments FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Upload</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-111111111</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>TITO</c2b:FileType><c2b:FileTypeName>Account Statement FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000010</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000051</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000012445</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000086423</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000014</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000022</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>TS</c2b:FileType><c2b:FileTypeName>Salaries and pensions FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Upload</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-123456789</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>TSPAL</c2b:FileType><c2b:FileTypeName>Salaries and pensions feedback FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-123456789</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>?</c2b:ServiceId><c2b:ServiceIdOwnerName>?</c2b:ServiceIdOwnerName><c2b:ServiceIdType>O</c2b:ServiceIdType><c2b:ServiceIdText>?</c2b:ServiceIdText></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>TXTKTL</c2b:FileType><c2b:FileTypeName>Reference payments (txt) FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000010</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000051</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000014</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000022</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>TXTKTO</c2b:FileType><c2b:FileTypeName>Account statement (txt) FI</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000010</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000000051</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000012445</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-19503000086423</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000014</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService><c2b:FileTypeService><c2b:ServiceId>NDEAFIHHXXX-FI1-EUR-29501800000022</c2b:ServiceId><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>A</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType><c2b:UserFileType><c2b:TargetId>11111111A1</c2b:TargetId><c2b:FileType>VKEUR</c2b:FileType><c2b:FileTypeName>Rates of exchange</c2b:FileTypeName><c2b:Country>FI</c2b:Country><c2b:Direction>Download</c2b:Direction><c2b:FileTypeServices><c2b:FileTypeService><c2b:ServiceId/><c2b:ServiceIdOwnerName/><c2b:ServiceIdType>N</c2b:ServiceIdType><c2b:ServiceIdText/></c2b:FileTypeService></c2b:FileTypeServices></c2b:UserFileType></c2b:UserFileTypes><Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
2
- <SignedInfo>
3
- <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
4
- <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
5
- <Reference URI="">
6
- <Transforms>
7
- <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
8
- <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
9
- </Transforms>
10
- <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
11
- <DigestValue>gNqDLvLt1Y3ma0hEFfZe3HR4hYg=</DigestValue>
12
- </Reference>
13
- </SignedInfo>
14
- <SignatureValue>stMf9BuVXOD8XFxvJ3eTAxNfP0j/bm22YNJCpGLjN4TgRHBrS0OgY0WgG8O1TmptlGc63MyhwddGdIj9uYob7/q7uAhG1teY0bRCEvPc4uobDcZ2Umoqt66B2X4CuKIrdCeJNY/GBiSPIW3scA+y19F3rsnzIO3eUqZ7t8osyAk=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIID2TCCAsGgAwIBAgIEAKwkgTANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQGEwJTRTEeMBwGA1UEChMVTm9yZGVhIEJhbmsgQUIgKHB1YmwpMSYwJAYDVQQDEx1Ob3JkZWEgQ29ycG9yYXRlIFNlcnZlciBDQSAwMTEUMBIGA1UEBRMLNTE2NDA2LTAxMjAwHhcNMDgxMDE3MTIzMDQxWhcNMTAxMDE3MTIzMDQxWjBmMQswCQYDVQQGEwJTRTEeMBwGA1UECgwVTm9yZGVhIEJhbmsgQUIgKHB1YmwpMRIwEAYDVQQLDAlOb3JkZWEgSVQxIzAhBgNVBAMMGkZpbGUgVHJhbnNmZXIgV2ViIFNlcnZpY2VzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI78vhz4V6P2jWj4LPIbBv2GDg6DWPhMT0fD90mu+/N+P2wn5RcIyEVpxWWRyP+oDqq5bW+J0Ni0GF9qRB8aTSBXaZ3AHH+tWWwxXk10RhZ47fNH+yzF7HDHmVJ++OkOpELlmUDb5tX+m+qtdL8nkIywvTYBMOrp3lGgWw1NiBMwIDAQABo4IBDDCCAQgwCQYDVR0TBAIwADARBgNVHQ4ECgQISLk+63zpZ78wEwYDVR0jBAwwCoAIRMeT2dl7VsEwNwYIKwYBBQUHAQEEKzApMCcGCCsGAQUFBzABhhtodHRwOi8vb2NzcC5ub3JkZWEuc2UvU0NBMDEwDgYDVR0PAQH/BAQDAgWgMIGJBgNVHR8EgYEwfzB9oHugeYZ3bGRhcDovL2xkYXAubmIuc2UvY249Tm9yZGVhJTIwQ29ycG9yYXRlJTIwU2VydmVyJTIwQ0ElMjAwMSxvPU5vcmRlYSUyMEJhbmslMjBBQiUyMChwdWJsKSxjPVNFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwDQYJKoZIhvcNAQEFBQADggEBAKqnBbdpbOhhJQLasFA8wUzHciMK6ACGIIPbaxU1X/aKVIpZ+rS92OB0TcIqmcBoAXLyFmzOjNPZCxntp/xC2J1y3Sd0Nbh/6LpwNLkbleinakaR4WnRdV3u38yzC2eczAIIZj/rnxylwh++JmfOdK8/T5ynKYJYx5UoMcG8WICmBRfEWId5/5hrr7PiN5neryz0zRUnmG4r9ML0X93C59yTmjcZXoVZwxIkwfzDTZxlPT1m/sAjOCnSHHuCMmJSXXWOeYJLIOdASgVOl7x6xdKKw6uOD0F2IC1xjpB3XBYMR2jxcb6SSyAkXgBNCPUGFUUkcUOk3+KwIu2Cjp7u1Ro=</X509Certificate><X509IssuerSerial><X509IssuerName>serialNumber=516406-0120, CN=Nordea Corporate Server CA 01, O=Nordea Bank AB (publ), C=SE</X509IssuerName><X509SerialNumber>11281537</X509SerialNumber></X509IssuerSerial></X509Data></KeyInfo></Signature></c2b:ApplicationResponse>
@@ -1,14 +0,0 @@
1
- <c2b:ApplicationResponse xmlns:c2b="http://bxd.fi/xmldata/"><c2b:CustomerId>679155330</c2b:CustomerId><c2b:Timestamp>2010-09-13T13:06:34.16+03:00</c2b:Timestamp><c2b:ResponseCode>00</c2b:ResponseCode><c2b:ResponseText>OK.</c2b:ResponseText><c2b:Encrypted>false</c2b:Encrypted><c2b:Compressed>false</c2b:Compressed><c2b:AmountTotal>2312.00</c2b:AmountTotal><c2b:TransactionCount>3</c2b:TransactionCount><Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
2
- <SignedInfo>
3
- <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
4
- <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
5
- <Reference URI="">
6
- <Transforms>
7
- <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
8
- <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
9
- </Transforms>
10
- <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
11
- <DigestValue>zXN3gtukcU0Hrn5fEJvhkLKMVIs=</DigestValue>
12
- </Reference>
13
- </SignedInfo>
14
- <SignatureValue>ud/gAtrrxg+B28CMV/BPaRSSRqmqNdWjsnoEm3yT9avvq8MV39reVXi/RULw+lSJUQYXDFgfkRxRVUKK71T4PlrdlMK8gfqvREVvPdLXqmtdEvuGXa+YGfeRMgO+IE7mnvb9hTsZi2TBSle/w9BHjrfv1mrg0cFwCovcro5JUXw=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIID2TCCAsGgAwIBAgIEAKwkgTANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQGEwJTRTEeMBwGA1UEChMVTm9yZGVhIEJhbmsgQUIgKHB1YmwpMSYwJAYDVQQDEx1Ob3JkZWEgQ29ycG9yYXRlIFNlcnZlciBDQSAwMTEUMBIGA1UEBRMLNTE2NDA2LTAxMjAwHhcNMDgxMDE3MTIzMDQxWhcNMTAxMDE3MTIzMDQxWjBmMQswCQYDVQQGEwJTRTEeMBwGA1UECgwVTm9yZGVhIEJhbmsgQUIgKHB1YmwpMRIwEAYDVQQLDAlOb3JkZWEgSVQxIzAhBgNVBAMMGkZpbGUgVHJhbnNmZXIgV2ViIFNlcnZpY2VzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI78vhz4V6P2jWj4LPIbBv2GDg6DWPhMT0fD90mu+/N+P2wn5RcIyEVpxWWRyP+oDqq5bW+J0Ni0GF9qRB8aTSBXaZ3AHH+tWWwxXk10RhZ47fNH+yzF7HDHmVJ++OkOpELlmUDb5tX+m+qtdL8nkIywvTYBMOrp3lGgWw1NiBMwIDAQABo4IBDDCCAQgwCQYDVR0TBAIwADARBgNVHQ4ECgQISLk+63zpZ78wEwYDVR0jBAwwCoAIRMeT2dl7VsEwNwYIKwYBBQUHAQEEKzApMCcGCCsGAQUFBzABhhtodHRwOi8vb2NzcC5ub3JkZWEuc2UvU0NBMDEwDgYDVR0PAQH/BAQDAgWgMIGJBgNVHR8EgYEwfzB9oHugeYZ3bGRhcDovL2xkYXAubmIuc2UvY249Tm9yZGVhJTIwQ29ycG9yYXRlJTIwU2VydmVyJTIwQ0ElMjAwMSxvPU5vcmRlYSUyMEJhbmslMjBBQiUyMChwdWJsKSxjPVNFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwDQYJKoZIhvcNAQEFBQADggEBAKqnBbdpbOhhJQLasFA8wUzHciMK6ACGIIPbaxU1X/aKVIpZ+rS92OB0TcIqmcBoAXLyFmzOjNPZCxntp/xC2J1y3Sd0Nbh/6LpwNLkbleinakaR4WnRdV3u38yzC2eczAIIZj/rnxylwh++JmfOdK8/T5ynKYJYx5UoMcG8WICmBRfEWId5/5hrr7PiN5neryz0zRUnmG4r9ML0X93C59yTmjcZXoVZwxIkwfzDTZxlPT1m/sAjOCnSHHuCMmJSXXWOeYJLIOdASgVOl7x6xdKKw6uOD0F2IC1xjpB3XBYMR2jxcb6SSyAkXgBNCPUGFUUkcUOk3+KwIu2Cjp7u1Ro=</X509Certificate><X509IssuerSerial><X509IssuerName>serialNumber=516406-0120, CN=Nordea Corporate Server CA 01, O=Nordea Bank AB (publ), C=SE</X509IssuerName><X509SerialNumber>11281537</X509SerialNumber></X509IssuerSerial></X509Data></KeyInfo></Signature></c2b:ApplicationResponse>
data/lib/sepa/payload.rb DELETED
@@ -1,109 +0,0 @@
1
- module Sepa
2
- class Payload
3
- def initialize(debtor, payments)
4
- @debtor_name = debtor.fetch(:name)
5
- @debtor_address = debtor.fetch(:address)
6
- @debtor_country = debtor.fetch(:country)
7
- @debtor_postcode = debtor.fetch(:postcode)
8
- @debtor_town = debtor.fetch(:town)
9
- @debtor_customer_id = debtor.fetch(:customer_id)
10
-
11
- unless @payments = payments
12
- fail KeyError, 'No payments provided for the payload.'
13
- end
14
-
15
- @doc = build
16
- end
17
-
18
- def to_xml
19
- @doc.to_xml
20
- end
21
-
22
- # Checks whether the payload validates against the schema.
23
- def valid?
24
- @xsd ||= load_schema
25
- @xsd.valid?(@doc)
26
- end
27
-
28
- # Errors that a schema validation of the document produces.
29
- def errors
30
- @xsd ||= load_schema
31
- @xsd.validate(@doc).collect { |e| e.message }
32
- end
33
-
34
- private
35
-
36
- def build
37
- doc = build_root
38
- doc = build_group_header(doc)
39
- add_payments(doc)
40
- end
41
-
42
- # Gets the number of transactions in this payload.
43
- def number_of_transactions
44
- count = 0
45
- @payments.each { |payment| count += payment.number_of_transactions }
46
- count
47
- end
48
-
49
- # Builds the root and pain elements with namespace and schema definitions.
50
- def build_root
51
- builder = Nokogiri::XML::Builder.new do |xml|
52
- xml.Document(
53
- xmlns: 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.02',
54
- 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
55
- 'xsi:schemaLocation' => 'urn:iso:std:iso:20022:tech:xsd:pain.001.' \
56
- '001.02 pain.001.001.02.xsd'
57
- ) {
58
- xml.send 'pain.001.001.02'
59
- }
60
- end
61
-
62
- builder.doc
63
- end
64
-
65
- # Builds the group header.
66
- def build_group_header(root_e)
67
- builder = Nokogiri::XML::Builder.with(root_e.at('Document > *')) do |xml|
68
- xml.GrpHdr {
69
- xml.MsgId SecureRandom.hex(17)
70
- xml.CreDtTm Time.new.iso8601
71
- xml.BtchBookg 'true'
72
- xml.NbOfTxs number_of_transactions
73
- xml.Grpg 'MIXD'
74
- xml.InitgPty {
75
- xml.Nm @debtor_name
76
- xml.PstlAdr {
77
- xml.AdrLine @debtor_address
78
- xml.AdrLine "#{@debtor_country}-#{@debtor_postcode}"
79
- xml.StrtNm @debtor_address
80
- xml.PstCd "#{@debtor_country}-#{@debtor_postcode}"
81
- xml.TwnNm @debtor_town
82
- xml.Ctry @debtor_country
83
- }
84
- }
85
- }
86
- end
87
-
88
- builder.doc
89
- end
90
-
91
- # Adds all the payments specified in the parameters to the payload.
92
- def add_payments(root_e)
93
- @payments.each do |payment|
94
- root_e.at(
95
- '/xmlns:Document/xmlns:pain.001.001.02',
96
- 'xmlns' => 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.02'
97
- ).add_child(payment.to_node)
98
- end
99
-
100
- root_e
101
- end
102
-
103
- def load_schema
104
- schemas_path = File.expand_path('../../../lib/sepa/xml_schemas', __FILE__)
105
- xsd = Nokogiri::XML::Schema(File.read("#{schemas_path}/pain.001.001.02.xsd"))
106
- end
107
-
108
- end
109
- end
data/lib/sepa/payment.rb DELETED
@@ -1,97 +0,0 @@
1
- module Sepa
2
- class Payment
3
- def initialize(debtor, params)
4
- @payment_info_id = params.fetch(:payment_info_id)
5
- @execution_date = params.fetch(:execution_date)
6
- @salary_or_pension = params[:salary_or_pension]
7
-
8
- @debtor_name = debtor.fetch(:name)
9
- @debtor_address = debtor.fetch(:address)
10
- @debtor_country = debtor.fetch(:country)
11
- @debtor_postcode = debtor.fetch(:postcode)
12
- @debtor_town = debtor.fetch(:town)
13
- @debtor_customer_id = debtor.fetch(:customer_id)
14
- @debtor_iban = debtor.fetch(:iban)
15
- @debtor_bic = debtor.fetch(:bic)
16
-
17
- @transactions = params.fetch(:transactions)
18
- end
19
-
20
- # Returns a Nokogiri::XML::Node of the payment.
21
- def to_node
22
- node = build.doc.root
23
- add_transactions(node)
24
- end
25
-
26
- # Returns the number of transactions in this payment.
27
- def number_of_transactions
28
- @transactions.count
29
- end
30
-
31
- private
32
-
33
- # Builds the payment.
34
- def build
35
- Nokogiri::XML::Builder.new do |xml|
36
- xml.PmtInf {
37
- xml.PmtInfId @payment_info_id
38
- xml.PmtMtd 'TRF'
39
-
40
- xml.PmtTpInf {
41
- xml.SvcLvl {
42
- xml.Cd 'SEPA'
43
- }
44
-
45
- # Needs to be specified in case the payment contains salaris or
46
- # pensions.
47
- if @salary_or_pension
48
- xml.CtgyPurp 'SALA'
49
- end
50
- }
51
-
52
- xml.ReqdExctnDt @execution_date
53
- xml.Dbtr {
54
- xml.Nm @debtor_name
55
- xml.PstlAdr {
56
- xml.AdrLine @debtor_address
57
- xml.AdrLine "#{@debtor_country}-#{@debtor_postcode} " \
58
- "#{@debtor_town}"
59
- xml.Ctry @debtor_country
60
- }
61
-
62
- xml.Id {
63
- xml.OrgId {
64
- if @debtor_customer_id
65
- xml.BkPtyId @debtor_customer_id
66
- end
67
- }
68
- }
69
- }
70
-
71
- xml.DbtrAcct {
72
- xml.Id {
73
- xml.IBAN @debtor_iban
74
- }
75
- }
76
-
77
- xml.DbtrAgt {
78
- xml.FinInstnId {
79
- xml.BIC @debtor_bic
80
- }
81
- }
82
-
83
- xml.ChrgBr 'SLEV'
84
- }
85
- end
86
- end
87
-
88
- # Adds the transactions specified in the params hash to the payment.
89
- def add_transactions(node)
90
- @transactions.each do |transaction|
91
- node.add_child(transaction.to_node)
92
- end
93
-
94
- node
95
- end
96
- end
97
- end
@@ -1,15 +0,0 @@
1
- module Sepa
2
- class SenderVerifier
3
- def initialize(soap_response)
4
- @soap_response = Nokogiri::XML(soap_response)
5
- end
6
-
7
- def get_digest_values
8
- @soap_response.remove_namespaces!
9
- digest_nodes = @soap_response.xpath("//Reference/dsig:DigestValue")
10
- end
11
-
12
- def calculate_digest
13
- end
14
- end
15
- end
@@ -1,7 +0,0 @@
1
- module Sepa
2
- class Signature
3
- # This class contains signature attributes, could be used to add
4
- # functionality to confirm sender from crendentials
5
- attr_accessor :digestValue, :signatureValue, :X509Certificate, :X509IssuerName
6
- end
7
- end
@@ -1,47 +0,0 @@
1
- module Sepa
2
- module DanskeSoapRequest
3
- # Holding methods needed only for Danske Services SOAP
4
- private
5
-
6
- def find_correct_build(params)
7
- command = params.fetch(:command)
8
-
9
- case command
10
- when :get_bank_certificate
11
- build_get_bank_certificate_request(params)
12
- end
13
- end
14
-
15
- # Builds : Get Bank Certificate
16
- # ------------------------------------------------------------------------
17
- def build_get_bank_certificate_request(params)
18
- ar = Base64.decode64 @ar
19
- command = params.fetch(:command)
20
- sender_id = params.fetch(:customer_id)
21
- request_id = params.fetch(:request_id)
22
-
23
- body = load_body_template(command)
24
-
25
- set_bank_certificate_body_contents(body, sender_id, request_id)
26
- add_bank_certificate_body_to_soap(ar, body)
27
- end
28
-
29
- def set_bank_certificate_body_contents(body, sender_id, request_id)
30
- set_node(body, 'pkif|SenderId', sender_id)
31
- set_node(body, 'pkif|CustomerId', sender_id)
32
- set_node(body, 'pkif|RequestId', request_id)
33
- set_node(body, 'pkif|Timestamp', Time.now.iso8601)
34
- set_node(body, 'pkif|InterfaceVersion', 1)
35
- end
36
-
37
- def add_bank_certificate_body_to_soap(ar, body)
38
- ar = Nokogiri::XML(ar)
39
-
40
- ar = ar.at_css('elem|GetBankCertificateRequest')
41
- body.at_css('pkif|GetBankCertificateIn').add_child(ar)
42
-
43
- body
44
- end
45
- # ------------------------------------------------------------------------
46
- end
47
- end
@@ -1,68 +0,0 @@
1
- module Sepa
2
- module NordeaSoapRequest
3
- # Holding methods needed only for Danske Services SOAP
4
- private
5
-
6
- def find_correct_build(params)
7
- command = params.fetch(:command)
8
-
9
- case command
10
- when :get_certificate
11
- build_certificate_request(params)
12
- when :get_user_info,:download_file_list,:download_file,:upload_file
13
- build_common_request(params)
14
- end
15
- end
16
-
17
- # Builds : Get Certificate
18
- # ------------------------------------------------------------------------
19
- def build_certificate_request(params)
20
- command = params.fetch(:command)
21
- ar = @ar
22
- sender_id = params.fetch(:customer_id)
23
-
24
- body = load_body_template(command)
25
- set_body_contents(body, ar, sender_id)
26
- end
27
-
28
- def set_body_contents(body, ar, sender_id)
29
- set_node(body, 'cer|ApplicationRequest', ar)
30
- set_node(body, 'cer|SenderId', sender_id)
31
- set_node(body, 'cer|RequestId', SecureRandom.hex(17))
32
- set_node(body, 'cer|Timestamp', Time.now.iso8601)
33
-
34
- body
35
- end
36
- # ------------------------------------------------------------------------
37
-
38
- # Builds : Get User Info, Download File, Download File List, Upload File
39
- # ------------------------------------------------------------------------
40
- def build_common_request(params)
41
- command = params.fetch(:command)
42
- ar = @ar
43
- sender_id = params.fetch(:customer_id)
44
- lang = params.fetch(:language)
45
- receiver_id = params.fetch(:target_id)
46
- private_key = params.fetch(:private_key)
47
- cert = params.fetch(:cert)
48
-
49
- header = load_header_template(@template_path)
50
- body = load_body_template(command)
51
-
52
- common_set_body_contents(body, ar, sender_id, lang, receiver_id)
53
- process_header(header,body, private_key, cert)
54
- add_body_to_header(header, body)
55
- end
56
-
57
- def common_set_body_contents(body, ar, sender_id, lang, receiver_id)
58
- set_node(body, 'bxd|ApplicationRequest', ar)
59
- set_node(body, 'bxd|SenderId', sender_id)
60
- set_node(body, 'bxd|RequestId', SecureRandom.hex(17))
61
- set_node(body, 'bxd|Timestamp', Time.now.iso8601)
62
- set_node(body, 'bxd|Language', lang)
63
- set_node(body, 'bxd|UserAgent',
64
- "Sepa Transfer Library version " + VERSION)
65
- set_node(body, 'bxd|ReceiverId', receiver_id)
66
- end
67
- end
68
- end
@@ -1,178 +0,0 @@
1
- module Sepa
2
- class Transaction
3
- def initialize(params)
4
- @instruction_id = params[:instruction_id]
5
- @end_to_end_id = params.fetch(:end_to_end_id)
6
-
7
- # If the parameters contains an invoice bundle, the amount is taken from
8
- # them.
9
- if params[:invoice_bundle]
10
- @amount = 0
11
- params[:invoice_bundle].each do |invoice|
12
- @amount += invoice.fetch(:amount).to_f
13
- end
14
- else
15
- @amount = params.fetch(:amount)
16
- end
17
-
18
- @currency = params.fetch(:currency)
19
- @bic = params.fetch(:bic)
20
- @name = params.fetch(:name)
21
- @address = params.fetch(:address)
22
- @country = params.fetch(:country)
23
- @postcode = params.fetch(:postcode)
24
- @town = params.fetch(:town)
25
- @iban = params.fetch(:iban)
26
- @reference = params[:reference]
27
- @message = params[:message]
28
- @salary = params[:salary]
29
- @pension = params[:pension]
30
- @social_security_number = params[:social_security_number]
31
- @invoice_bundle = params[:invoice_bundle]
32
- end
33
-
34
- # Returns a Nokogiri::XML::Node of the transaction.
35
- def to_node
36
- build.doc.root
37
- end
38
-
39
- private
40
-
41
- # Builds the transaction
42
- def build
43
- Nokogiri::XML::Builder.new do |xml|
44
- xml.CdtTrfTxInf {
45
- xml.PmtId {
46
- if @instruction_id
47
- xml.InstrId @instruction_id
48
- end
49
-
50
- xml.EndToEndId @end_to_end_id
51
- }
52
-
53
- xml.Amt {
54
- xml.InstdAmt(@amount, :Ccy => @currency)
55
- }
56
-
57
- xml.CdtrAgt {
58
- xml.FinInstnId {
59
- xml.BIC @bic
60
- }
61
- }
62
-
63
- xml.Cdtr {
64
- xml.Nm @name
65
- xml.PstlAdr {
66
- xml.AdrLine @address
67
- xml.AdrLine("#{@country}-#{@postcode} " \
68
- "#{@town}")
69
- xml.StrtNm @address
70
- xml.PstCd "#{@country}-#{@postcode}"
71
- xml.TwnNm @town
72
- xml.Ctry @country
73
- }
74
-
75
- # Social security number needs to be added in case the transaction
76
- # contains a salary.
77
- if @salary
78
- xml.Id {
79
- xml.PrvtId {
80
- xml.SclSctyNb @social_security_number
81
- }
82
- }
83
- end
84
- }
85
-
86
- xml.CdtrAcct {
87
- xml.Id {
88
- xml.IBAN @iban
89
- }
90
- }
91
-
92
- # If the transaction contains a pension, this element needs to be
93
- # specified.
94
- if @pension
95
- xml.Purp {
96
- xml.Cd 'PENS'
97
- }
98
- end
99
-
100
- xml.RmtInf {
101
-
102
- # In case this transaction contains an invoice bundle, a Strd
103
- # element is added for each invoice either with an invoice number
104
- # or a reference.
105
- if @invoice_bundle
106
- message = ''
107
- @invoice_bundle.each do |invoice|
108
-
109
- if invoice[:amount].to_f < 0
110
- amount = "#{invoice[:amount].to_f.abs}-"
111
- else
112
- amount = invoice[:amount]
113
- end
114
-
115
- if invoice[:reference]
116
- message += "RFS/#{invoice[:reference]}/" \
117
- "#{invoice[:currency]}#{amount}/"
118
- elsif invoice[:invoice_number]
119
- message += "#{invoice[:type]}/#{invoice[:invoice_number]}/" \
120
- "#{invoice[:currency]}#{amount}/"
121
- end
122
- end
123
-
124
- xml.Ustrd message
125
-
126
- @invoice_bundle.each do |invoice|
127
- xml.Strd {
128
- xml.RfrdDocInf {
129
- xml.RfrdDocTp {
130
- xml.Cd invoice.fetch(:type)
131
- }
132
-
133
- if invoice[:invoice_number]
134
- xml.RfrdDocNb invoice[:invoice_number]
135
- end
136
- }
137
- xml.RfrdDocAmt {
138
- if invoice.fetch(:amount).to_f > 0
139
- xml.RmtdAmt(invoice[:amount],
140
- :Ccy => invoice[:currency])
141
- else
142
- xml.CdtNoteAmt(invoice[:amount].to_f.abs,
143
- :Ccy => invoice[:currency])
144
- end
145
- }
146
-
147
- if invoice[:reference]
148
- xml.CdtrRefInf {
149
- xml.CdtrRefTp {
150
- xml.Cd 'SCOR'
151
- }
152
-
153
- xml.CdtrRef invoice[:reference]
154
- }
155
- end
156
- }
157
- end
158
-
159
- elsif @reference
160
- xml.Strd {
161
- xml.CdtrRefInf {
162
- xml.CdtrRefTp {
163
- xml.Cd 'SCOR'
164
- }
165
-
166
- xml.CdtrRef @reference
167
- }
168
- }
169
-
170
- else
171
- xml.Ustrd @message
172
- end
173
- }
174
- }
175
- end
176
- end
177
- end
178
- end
@@ -1,16 +0,0 @@
1
- module Sepa
2
- class Userfiletype
3
-
4
- attr_accessor :targetId, :fileType, :fileTypeName, :country, :direction, :filetypeServices
5
- # Add incoming filetypeservice to array
6
- def add_filetypeservice(ftservice)
7
- filetypeServices<<ftservice
8
- end
9
-
10
- # To get parts of array possible options
11
- def get_filetypeservices
12
- # Add condition checking
13
- filetypeServices
14
- end
15
- end
16
- end