epics 2.10.0 → 3.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/.semaphore/semaphore.yml +17 -8
  4. data/CHANGELOG.md +97 -0
  5. data/EBICS_REFERENCES.md +169 -0
  6. data/README.md +219 -50
  7. data/lib/epics/azv.rb +3 -10
  8. data/lib/epics/b2b.rb +3 -10
  9. data/lib/epics/bka.rb +3 -14
  10. data/lib/epics/builders/body_builder/base.rb +26 -0
  11. data/lib/epics/builders/body_builder/v2.rb +9 -0
  12. data/lib/epics/builders/body_builder/v3.rb +9 -0
  13. data/lib/epics/builders/body_builder.rb +6 -0
  14. data/lib/epics/builders/data_encryption_info_builder.rb +29 -0
  15. data/lib/epics/builders/data_transfer_builder/base.rb +52 -0
  16. data/lib/epics/builders/data_transfer_builder/v2.rb +9 -0
  17. data/lib/epics/builders/data_transfer_builder/v3.rb +12 -0
  18. data/lib/epics/builders/data_transfer_builder.rb +6 -0
  19. data/lib/epics/builders/header_builder/base.rb +26 -0
  20. data/lib/epics/builders/header_builder/v2.rb +9 -0
  21. data/lib/epics/builders/header_builder/v3.rb +9 -0
  22. data/lib/epics/builders/header_builder.rb +6 -0
  23. data/lib/epics/builders/mutable_builder.rb +28 -0
  24. data/lib/epics/builders/order_details_builder/base.rb +100 -0
  25. data/lib/epics/builders/order_details_builder/v2.rb +21 -0
  26. data/lib/epics/builders/order_details_builder/v3.rb +51 -0
  27. data/lib/epics/builders/order_details_builder.rb +10 -0
  28. data/lib/epics/builders/request_builder.rb +25 -0
  29. data/lib/epics/builders/static_builder/base.rb +75 -0
  30. data/lib/epics/builders/static_builder/v2.rb +9 -0
  31. data/lib/epics/builders/static_builder/v3.rb +9 -0
  32. data/lib/epics/builders/static_builder.rb +9 -0
  33. data/lib/epics/builders/transfer_receipt_builder.rb +19 -0
  34. data/lib/epics/builders/xml_builder/base.rb +92 -0
  35. data/lib/epics/builders/xml_builder/v24.rb +31 -0
  36. data/lib/epics/builders/xml_builder/v25.rb +31 -0
  37. data/lib/epics/builders/xml_builder/v3.rb +31 -0
  38. data/lib/epics/builders/xml_builder.rb +7 -0
  39. data/lib/epics/builders.rb +13 -0
  40. data/lib/epics/c2s.rb +3 -10
  41. data/lib/epics/c52.rb +2 -14
  42. data/lib/epics/c53.rb +2 -14
  43. data/lib/epics/c54.rb +2 -14
  44. data/lib/epics/c5n.rb +3 -14
  45. data/lib/epics/ccs.rb +3 -10
  46. data/lib/epics/cct.rb +3 -10
  47. data/lib/epics/cd1.rb +3 -10
  48. data/lib/epics/cdb.rb +3 -10
  49. data/lib/epics/cdd.rb +3 -10
  50. data/lib/epics/cds.rb +3 -10
  51. data/lib/epics/cdz.rb +3 -14
  52. data/lib/epics/cip.rb +3 -10
  53. data/lib/epics/client.rb +491 -123
  54. data/lib/epics/crypt/aes.rb +56 -0
  55. data/lib/epics/crypt/x_509.rb +52 -0
  56. data/lib/epics/crypt.rb +5 -0
  57. data/lib/epics/crz.rb +3 -14
  58. data/lib/epics/factories/crypt/aes_factory.rb +5 -0
  59. data/lib/epics/factories/crypt.rb +4 -0
  60. data/lib/epics/factories/request_factory/base.rb +236 -0
  61. data/lib/epics/factories/request_factory/v2.rb +194 -0
  62. data/lib/epics/factories/request_factory/v24.rb +32 -0
  63. data/lib/epics/factories/request_factory/v25.rb +31 -0
  64. data/lib/epics/factories/request_factory/v3.rb +305 -0
  65. data/lib/epics/factories/request_factory.rb +8 -0
  66. data/lib/epics/factories.rb +5 -0
  67. data/lib/epics/fdl.rb +3 -18
  68. data/lib/epics/ful.rb +6 -0
  69. data/lib/epics/generic_request.rb +31 -92
  70. data/lib/epics/generic_upload_request.rb +14 -67
  71. data/lib/epics/haa.rb +3 -9
  72. data/lib/epics/hac.rb +3 -14
  73. data/lib/epics/handlers/auth_signature_handler.rb +102 -0
  74. data/lib/epics/handlers/order_data_handler/base.rb +98 -0
  75. data/lib/epics/handlers/order_data_handler/v2.rb +39 -0
  76. data/lib/epics/handlers/order_data_handler/v24.rb +11 -0
  77. data/lib/epics/handlers/order_data_handler/v25.rb +11 -0
  78. data/lib/epics/handlers/order_data_handler/v3.rb +41 -0
  79. data/lib/epics/handlers/order_data_handler.rb +8 -0
  80. data/lib/epics/handlers/user_signature_handler/base.rb +10 -0
  81. data/lib/epics/handlers/user_signature_handler/v2.rb +17 -0
  82. data/lib/epics/handlers/user_signature_handler/v3.rb +17 -0
  83. data/lib/epics/handlers/user_signature_handler.rb +6 -0
  84. data/lib/epics/handlers.rb +6 -0
  85. data/lib/epics/hev.rb +2 -15
  86. data/lib/epics/hia.rb +4 -55
  87. data/lib/epics/hkd.rb +3 -9
  88. data/lib/epics/hpb.rb +3 -13
  89. data/lib/epics/hpd.rb +3 -9
  90. data/lib/epics/htd.rb +3 -9
  91. data/lib/epics/ini.rb +4 -46
  92. data/lib/epics/keyring.rb +17 -0
  93. data/lib/epics/letter_renderer.rb +17 -22
  94. data/lib/epics/ptk.rb +3 -14
  95. data/lib/epics/response.rb +34 -29
  96. data/lib/epics/services/crypt_service.rb +62 -0
  97. data/lib/epics/services/digest_resolver/base.rb +30 -0
  98. data/lib/epics/services/digest_resolver/v2.rb +13 -0
  99. data/lib/epics/services/digest_resolver/v3.rb +19 -0
  100. data/lib/epics/services/digest_resolver.rb +6 -0
  101. data/lib/epics/services.rb +5 -0
  102. data/lib/epics/signature.rb +50 -0
  103. data/lib/epics/{key.rb → signature_algorithm/base.rb} +14 -21
  104. data/lib/epics/signature_algorithm/rsa.rb +50 -0
  105. data/lib/epics/signature_algorithm/rsapkcs1.rb +16 -0
  106. data/lib/epics/signature_algorithm/rsapss.rb +20 -0
  107. data/lib/epics/signature_algorithm.rb +2 -0
  108. data/lib/epics/sta.rb +3 -14
  109. data/lib/epics/version.rb +1 -1
  110. data/lib/epics/vmk.rb +3 -14
  111. data/lib/epics/wss.rb +3 -9
  112. data/lib/epics/xct.rb +3 -10
  113. data/lib/epics/xds.rb +3 -10
  114. data/lib/epics/xe2.rb +3 -10
  115. data/lib/epics/xe3.rb +3 -10
  116. data/lib/epics/xek.rb +5 -0
  117. data/lib/epics/yct.rb +6 -0
  118. data/lib/epics/z01.rb +2 -14
  119. data/lib/epics/z52.rb +2 -14
  120. data/lib/epics/z53.rb +2 -14
  121. data/lib/epics/z54.rb +2 -14
  122. data/lib/epics/zsr.rb +5 -0
  123. data/lib/epics.rb +69 -5
  124. data/lib/letter/ini.erb +27 -6
  125. data/spec/aes_spec.rb +46 -0
  126. data/spec/auth_signature_handler_spec.rb +58 -0
  127. data/spec/builders_spec.rb +616 -0
  128. data/spec/certificate_handling_spec.rb +189 -0
  129. data/spec/client_setup_block_spec.rb +41 -0
  130. data/spec/client_spec.rb +143 -91
  131. data/spec/crypt_service_spec.rb +132 -0
  132. data/spec/date_range_spec.rb +46 -0
  133. data/spec/digest_resolver_spec.rb +164 -0
  134. data/spec/fixtures/bank_x509.pem +3 -0
  135. data/spec/fixtures/xml/haa.xml +40 -1
  136. data/spec/fixtures/xml/haa_receipt.xml +33 -30
  137. data/spec/fixtures/xml/haa_response_h004.xml +4 -0
  138. data/spec/fixtures/xml/haa_response_h005.xml +38 -0
  139. data/spec/fixtures/xml/hia_request_order_data.xml +24 -1
  140. data/spec/fixtures/xml/hpb_request.xml +1 -1
  141. data/spec/fixtures/xml/hpb_response_x509.xml +16 -0
  142. data/spec/fixtures/xml/htd_order_data_h005.xml +55 -0
  143. data/spec/fixtures/xml/jruby/hia.xml +20 -22
  144. data/spec/fixtures/xml/jruby/ini.xml +1 -3
  145. data/spec/fixtures/xml/ruby/hia.xml +21 -1
  146. data/spec/fixtures/xml/ruby/ini.xml +21 -1
  147. data/spec/handlers_spec.rb +267 -0
  148. data/spec/hpb_malformed_certificate_spec.rb +36 -0
  149. data/spec/key_file_decryption_spec.rb +27 -0
  150. data/spec/key_file_preservation_spec.rb +78 -0
  151. data/spec/keyring_spec.rb +349 -0
  152. data/spec/middleware/parse_ebics_spec.rb +2 -1
  153. data/spec/order_id_spec.rb +65 -0
  154. data/spec/orders/azv_spec.rb +63 -7
  155. data/spec/orders/b2b_spec.rb +68 -3
  156. data/spec/orders/bka_spec.rb +34 -4
  157. data/spec/orders/c2s_spec.rb +62 -9
  158. data/spec/orders/c52_spec.rb +34 -4
  159. data/spec/orders/c53_spec.rb +34 -4
  160. data/spec/orders/c54_spec.rb +36 -4
  161. data/spec/orders/c5n_spec.rb +36 -4
  162. data/spec/orders/camt_parity_spec.rb +80 -0
  163. data/spec/orders/ccs_spec.rb +62 -9
  164. data/spec/orders/cct_spec.rb +83 -9
  165. data/spec/orders/cd1_spec.rb +50 -7
  166. data/spec/orders/cdb_spec.rb +64 -7
  167. data/spec/orders/cdd_spec.rb +64 -7
  168. data/spec/orders/cds_spec.rb +74 -0
  169. data/spec/orders/cdz_spec.rb +67 -4
  170. data/spec/orders/cip_spec.rb +61 -9
  171. data/spec/orders/crz_spec.rb +67 -4
  172. data/spec/orders/fdl_spec.rb +143 -13
  173. data/spec/orders/ful_spec.rb +63 -0
  174. data/spec/orders/haa_spec.rb +115 -9
  175. data/spec/orders/hac_spec.rb +89 -10
  176. data/spec/orders/hev_spec.rb +1 -6
  177. data/spec/orders/hia_spec.rb +25 -22
  178. data/spec/orders/hkd_spec.rb +23 -4
  179. data/spec/orders/hpb_spec.rb +7 -4
  180. data/spec/orders/hpd_spec.rb +23 -4
  181. data/spec/orders/htd_spec.rb +23 -4
  182. data/spec/orders/ini_spec.rb +23 -18
  183. data/spec/orders/ptk_spec.rb +27 -4
  184. data/spec/orders/sta_spec.rb +129 -11
  185. data/spec/orders/vmk_spec.rb +36 -4
  186. data/spec/orders/wss_spec.rb +29 -3
  187. data/spec/orders/x_509_certificate_spec.rb +9 -1
  188. data/spec/orders/xct_spec.rb +63 -0
  189. data/spec/orders/xds_spec.rb +13 -6
  190. data/spec/orders/xe2_spec.rb +64 -7
  191. data/spec/orders/xe3_spec.rb +64 -7
  192. data/spec/orders/xek_spec.rb +31 -0
  193. data/spec/orders/yct_spec.rb +43 -0
  194. data/spec/orders/z01_spec.rb +34 -4
  195. data/spec/orders/z52_spec.rb +34 -4
  196. data/spec/orders/z53_spec.rb +34 -4
  197. data/spec/orders/z54_spec.rb +36 -4
  198. data/spec/orders/zsr_spec.rb +31 -0
  199. data/spec/request_factory_spec.rb +444 -0
  200. data/spec/response_business_error_spec.rb +45 -0
  201. data/spec/response_validation_spec.rb +23 -0
  202. data/spec/{key_spec.rb → signature_algorithm/rsa_pss_spec.rb} +4 -13
  203. data/spec/support/ebics_matcher.rb +17 -9
  204. data/spec/support/ebics_shared_examples.rb +642 -0
  205. data/spec/support/h005_client_helper.rb +23 -0
  206. data/spec/upload_digest_spec.rb +69 -0
  207. data/spec/user_signature_handler_spec.rb +25 -0
  208. data/spec/version_support_error_spec.rb +76 -0
  209. data/spec/xsd/{ebics_hev.xsd → H000/ebics_hev.xsd} +0 -0
  210. data/spec/xsd/H003/ebics.xsd +11 -0
  211. data/spec/xsd/H003/ebics_keymgmt_request.xsd +555 -0
  212. data/spec/xsd/H003/ebics_keymgmt_response.xsd +131 -0
  213. data/spec/xsd/H003/ebics_orders.xsd +1811 -0
  214. data/spec/xsd/H003/ebics_request.xsd +354 -0
  215. data/spec/xsd/H003/ebics_response.xsd +161 -0
  216. data/spec/xsd/{ebics_signature.xsd → H003/ebics_signature.xsd} +0 -0
  217. data/spec/xsd/H003/ebics_types.xsd +2361 -0
  218. data/spec/xsd/H003/xmldsig-core-schema.xsd +318 -0
  219. data/spec/xsd/H004/ebics_signature.xsd +217 -0
  220. data/spec/xsd/H005/ebics_H005.xsd +11 -0
  221. data/spec/xsd/H005/ebics_keymgmt_request_H005.xsd +523 -0
  222. data/spec/xsd/H005/ebics_keymgmt_response_H005.xsd +137 -0
  223. data/spec/xsd/H005/ebics_orders_H005.xsd +2094 -0
  224. data/spec/xsd/H005/ebics_request_H005.xsd +349 -0
  225. data/spec/xsd/H005/ebics_response_H005.xsd +167 -0
  226. data/spec/xsd/H005/ebics_signature_S002.xsd +177 -0
  227. data/spec/xsd/H005/ebics_types_H005.xsd +1885 -0
  228. data/spec/xsd/H005/xmldsig-core-schema.xsd +318 -0
  229. metadata +200 -36
  230. data/lib/epics/header_request.rb +0 -58
  231. data/lib/epics/middleware/xmlsig.rb +0 -16
  232. data/lib/epics/signer.rb +0 -40
  233. data/lib/epics/x_509_certificate.rb +0 -15
  234. data/lib/letter/ini_with_certs.erb +0 -335
  235. data/spec/generic_upload_spec.rb +0 -58
  236. data/spec/hpb_spec.rb +0 -15
  237. data/spec/signer_spec.rb +0 -34
  238. /data/spec/xsd/{ebics_H004.xsd → H004/ebics_H004.xsd} +0 -0
  239. /data/spec/xsd/{ebics_keymgmt_request_H004.xsd → H004/ebics_keymgmt_request_H004.xsd} +0 -0
  240. /data/spec/xsd/{ebics_keymgmt_response_H004.xsd → H004/ebics_keymgmt_response_H004.xsd} +0 -0
  241. /data/spec/xsd/{ebics_orders_H004.xsd → H004/ebics_orders_H004.xsd} +0 -0
  242. /data/spec/xsd/{ebics_request_H004.xsd → H004/ebics_request_H004.xsd} +0 -0
  243. /data/spec/xsd/{ebics_response_H004.xsd → H004/ebics_response_H004.xsd} +0 -0
  244. /data/spec/xsd/{ebics_types_H004.xsd → H004/ebics_types_H004.xsd} +0 -0
  245. /data/spec/xsd/{xmldsig-core-schema.xsd → H004/xmldsig-core-schema.xsd} +0 -0
@@ -1,11 +1,30 @@
1
1
  RSpec.describe Epics::HKD do
2
-
3
- let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS') }
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS', version:) }
4
3
 
5
4
  subject { described_class.new(client) }
6
5
 
7
- describe '#to_xml' do
8
- specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
6
+ describe 'order attributes' do
7
+ let(:version) { Epics::Keyring::VERSION_25 }
8
+
9
+ it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
10
+ it { expect(subject.to_xml).to include('<OrderType>HKD</OrderType>') }
11
+ end
12
+
13
+ include_examples '#to_xml'
14
+
15
+ describe 'H004 request structure' do
16
+ let(:version) { Epics::Keyring::VERSION_25 }
17
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
18
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
19
+
20
+ include_examples 'a valid ebicsRequest download', order_type: 'HKD'
9
21
  end
10
22
 
23
+ describe 'H003 request structure' do
24
+ let(:version) { Epics::Keyring::VERSION_24 }
25
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
26
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
27
+
28
+ include_examples 'a valid ebicsRequest download', order_type: 'HKD', ebics_version: 'H003'
29
+ end
11
30
  end
@@ -1,11 +1,14 @@
1
1
  RSpec.describe Epics::HPB do
2
-
3
- let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS') }
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS', version:) }
4
3
 
5
4
  subject { described_class.new(client) }
6
5
 
7
- describe '#to_xml' do
8
- specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
6
+ describe 'order attributes' do
7
+ let(:version) { Epics::Keyring::VERSION_25 }
8
+
9
+ it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
10
+ it { expect(subject.to_xml).to include('<OrderType>HPB</OrderType>') }
9
11
  end
10
12
 
13
+ include_examples '#to_xml'
11
14
  end
@@ -1,11 +1,30 @@
1
1
  RSpec.describe Epics::HPD do
2
-
3
- let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS') }
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS', version:) }
4
3
 
5
4
  subject { described_class.new(client) }
6
5
 
7
- describe '#to_xml' do
8
- specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
6
+ describe 'order attributes' do
7
+ let(:version) { Epics::Keyring::VERSION_25 }
8
+
9
+ it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
10
+ it { expect(subject.to_xml).to include('<OrderType>HPD</OrderType>') }
11
+ end
12
+
13
+ include_examples '#to_xml'
14
+
15
+ describe 'H004 request structure' do
16
+ let(:version) { Epics::Keyring::VERSION_25 }
17
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
18
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
19
+
20
+ include_examples 'a valid ebicsRequest download', order_type: 'HPD'
9
21
  end
10
22
 
23
+ describe 'H003 request structure' do
24
+ let(:version) { Epics::Keyring::VERSION_24 }
25
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
26
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
27
+
28
+ include_examples 'a valid ebicsRequest download', order_type: 'HPD', ebics_version: 'H003'
29
+ end
11
30
  end
@@ -1,11 +1,30 @@
1
1
  RSpec.describe Epics::HTD do
2
-
3
- let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS') }
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS', version:) }
4
3
 
5
4
  subject { described_class.new(client) }
6
5
 
7
- describe '#to_xml' do
8
- specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
6
+ describe 'order attributes' do
7
+ let(:version) { Epics::Keyring::VERSION_25 }
8
+
9
+ it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
10
+ it { expect(subject.to_xml).to include('<OrderType>HTD</OrderType>') }
11
+ end
12
+
13
+ include_examples '#to_xml'
14
+
15
+ describe 'H004 request structure' do
16
+ let(:version) { Epics::Keyring::VERSION_25 }
17
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
18
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
19
+
20
+ include_examples 'a valid ebicsRequest download', order_type: 'HTD'
9
21
  end
10
22
 
23
+ describe 'H003 request structure' do
24
+ let(:version) { Epics::Keyring::VERSION_24 }
25
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
26
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
27
+
28
+ include_examples 'a valid ebicsRequest download', order_type: 'HTD', ebics_version: 'H003'
29
+ end
11
30
  end
@@ -1,17 +1,23 @@
1
1
  RSpec.describe Epics::INI do
2
- let(:client) { Epics::Client.new(key, 'secret', 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS') }
3
- let(:key) { File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')) }
4
- before { allow(subject).to receive(:timestamp) { '2014-10-10T11:16:00Z' } }
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS', version:) }
5
3
 
6
4
  subject { described_class.new(client) }
7
5
 
6
+ describe 'order attributes' do
7
+ let(:version) { Epics::Keyring::VERSION_25 }
8
+
9
+ it { expect(subject.to_xml).to include('<OrderAttribute>DZNNN</OrderAttribute>') }
10
+ it { expect(subject.to_xml).to include('<OrderType>INI</OrderType>') }
11
+ end
12
+
13
+ include_examples '#to_xml'
14
+
8
15
  describe '#to_xml' do
9
- specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
16
+ let(:version) { Epics::Keyring::VERSION_25 }
10
17
 
11
18
  describe 'validate against fixture' do
12
- let(:signature_order_data) do
13
- Nokogiri::XML(File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', 'xml', RUBY_ENGINE, 'ini.xml')))
14
- end
19
+ let(:signature_order_data) { Nokogiri::XML(File.read(File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', RUBY_ENGINE, 'ini.xml'))) }
20
+ before { allow(Time).to receive(:now).and_return(Time.parse('2014-10-10T11:16:00Z')) }
15
21
 
16
22
  it 'will match exactly' do
17
23
  expect(Nokogiri::XML(subject.to_xml)).to be_equivalent_to(signature_order_data)
@@ -20,13 +26,13 @@ RSpec.describe Epics::INI do
20
26
  end
21
27
 
22
28
  describe '#key_signature' do
23
- specify { expect(subject.key_signature).to be_a_valid_ebics_doc }
29
+ let(:version) { Epics::Keyring::VERSION_25 }
30
+
31
+ specify { expect(subject.key_signature).to be_a_valid_ebics_doc(version) }
24
32
 
25
33
  describe 'validate against fixture' do
26
- let(:signature_order_data) do
27
- Nokogiri::XML(File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', 'xml',
28
- 'signature_pub_key_order_data.xml')))
29
- end
34
+ let(:signature_order_data) { Nokogiri::XML(File.read(File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'signature_pub_key_order_data.xml'))) }
35
+ before { allow(Time).to receive(:now).and_return(Time.parse('2014-10-10T11:16:00Z')) }
30
36
 
31
37
  it 'will match exactly' do
32
38
  expect(Nokogiri::XML(subject.key_signature)).to be_equivalent_to(signature_order_data)
@@ -35,16 +41,15 @@ RSpec.describe Epics::INI do
35
41
 
36
42
  context 'with x509 certificate' do
37
43
  let(:client) do
38
- client = Epics::Client.new(key, 'secret', 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS')
39
- client.x_509_certificates_content = {a: generate_x_509_crt(client.a.key, '/C=GB/O=TestOrg/CN=test.example.org')}
44
+ client = Epics::Client.new(File.open(File.join(File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret', 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS')
45
+ client.keyring.user_signature.certificate = Epics::Crypt::X509.new(generate_x_509_crt(client.signature_key.key, '/C=GB/O=TestOrg/CN=test.example.org'))
40
46
  client
41
47
  end
42
48
 
43
49
  it 'includes x509 certificate' do
44
- a_crt = Epics::X509Certificate.new(client.x_509_certificates_content[:a])
45
- expect(subject.key_signature).to include('<ds:X509IssuerName>/C=GB/O=TestOrg/CN=test.example.org</ds:X509IssuerName>')
46
- expect(subject.key_signature).to include('<ds:X509SerialNumber>2</ds:X509SerialNumber>')
47
- expect(subject.key_signature).to include("<ds:X509Certificate>#{a_crt.data}</ds:X509Certificate>")
50
+ expect(subject.key_signature).to include('<ds:X509IssuerName>CN=test.example.org,O=TestOrg,C=GB</ds:X509IssuerName>')
51
+ expect(subject.key_signature).to include('<ds:X509SerialNumber>1</ds:X509SerialNumber>')
52
+ expect(subject.key_signature).to include("<ds:X509Certificate>#{client.keyring.user_signature.certificate.data}</ds:X509Certificate>")
48
53
  end
49
54
  end
50
55
  end
@@ -1,9 +1,32 @@
1
1
  RSpec.describe Epics::PTK do
2
- let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS') }
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS', version:) }
3
3
 
4
- subject { described_class.new(client, from: "2014-09-01", to: "2014-09-30") }
4
+ subject { described_class.new(client, from: Date.parse('2014-09-01'), to: Date.parse('2014-09-30')) }
5
5
 
6
- describe '#to_xml' do
7
- specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
6
+ describe 'order attributes' do
7
+ let(:version) { Epics::Keyring::VERSION_25 }
8
+
9
+ it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
10
+ it { expect(subject.to_xml).to include('<OrderType>PTK</OrderType>') }
11
+ end
12
+
13
+ include_examples '#to_xml'
14
+
15
+ describe 'H004 request structure' do
16
+ let(:version) { Epics::Keyring::VERSION_25 }
17
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
18
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
19
+
20
+ include_examples 'a valid ebicsRequest download with date range',
21
+ order_type: 'PTK', from: '2014-09-01', to: '2014-09-30'
22
+ end
23
+
24
+ describe 'H003 request structure' do
25
+ let(:version) { Epics::Keyring::VERSION_24 }
26
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
27
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
28
+
29
+ include_examples 'a valid ebicsRequest download with date range',
30
+ order_type: 'PTK', from: '2014-09-01', to: '2014-09-30', ebics_version: 'H003'
8
31
  end
9
32
  end
@@ -1,39 +1,157 @@
1
1
  RSpec.describe Epics::STA do
2
- let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS') }
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS', version:) }
3
3
 
4
4
  context 'with date range' do
5
- subject(:order) { described_class.new(client, from: "2014-09-01", to: "2014-09-30") }
5
+ subject(:order) { described_class.new(client, from: Date.parse('2014-09-01'), to: Date.parse('2014-09-30')) }
6
6
 
7
- describe '#to_xml' do
8
- specify { expect(order.to_xml).to be_a_valid_ebics_doc }
7
+ include_examples '#to_xml'
8
+ include_examples '#to_receipt_xml'
9
9
 
10
+ describe '#to_xml' do
11
+ let(:version) { Epics::Keyring::VERSION_25 }
10
12
  it 'does includes a date range as standard order parameter' do
11
13
  expect(order.to_xml).to include('<StandardOrderParams><DateRange><Start>2014-09-01</Start><End>2014-09-30</End></DateRange></StandardOrderParams>')
12
14
  end
13
15
  end
14
16
 
15
- describe '#to_receipt_xml' do
16
- before { order.transaction_id = SecureRandom.hex(16) }
17
+ describe 'H005 request structure' do
18
+ let(:version) { Epics::Keyring::VERSION_30 }
19
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
20
+ let(:ns) { { 'e' => 'urn:org:ebics:H005' } }
21
+
22
+ include_examples 'a valid ebicsRequest H005 download with date range',
23
+ service_name: 'EOP', msg_name: 'mt940', from: '2014-09-01', to: '2014-09-30'
24
+ end
25
+
26
+ describe 'H005 receipt structure' do
27
+ let(:version) { Epics::Keyring::VERSION_30 }
28
+ let(:xml) do
29
+ subject.transaction_id = SecureRandom.hex(16)
30
+ Nokogiri::XML(subject.to_receipt_xml)
31
+ end
32
+ let(:ns) { { 'e' => 'urn:org:ebics:H005' } }
17
33
 
18
- specify { expect(order.to_receipt_xml).to be_a_valid_ebics_doc }
34
+ include_examples 'a valid ebicsRequest H005 receipt'
35
+ end
36
+
37
+ describe 'H004 request structure' do
38
+ let(:version) { Epics::Keyring::VERSION_25 }
39
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
40
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
41
+
42
+ include_examples 'a valid ebicsRequest download with date range',
43
+ order_type: 'STA', from: '2014-09-01', to: '2014-09-30'
44
+ end
45
+
46
+ describe 'H004 receipt structure' do
47
+ let(:version) { Epics::Keyring::VERSION_25 }
48
+ let(:xml) do
49
+ subject.transaction_id = SecureRandom.hex(16)
50
+ Nokogiri::XML(subject.to_receipt_xml)
51
+ end
52
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
53
+
54
+ include_examples 'a valid ebicsRequest receipt'
55
+ end
56
+
57
+ describe 'H003 request structure' do
58
+ let(:version) { Epics::Keyring::VERSION_24 }
59
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
60
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
61
+
62
+ include_examples 'a valid ebicsRequest download with date range',
63
+ order_type: 'STA', from: '2014-09-01', to: '2014-09-30', ebics_version: 'H003'
64
+ end
65
+
66
+ describe 'H003 receipt structure' do
67
+ let(:version) { Epics::Keyring::VERSION_24 }
68
+ let(:xml) do
69
+ subject.transaction_id = SecureRandom.hex(16)
70
+ Nokogiri::XML(subject.to_receipt_xml)
71
+ end
72
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
73
+
74
+ include_examples 'a valid ebicsRequest receipt', ebics_version: 'H003'
19
75
  end
20
76
  end
21
77
 
22
78
  context 'without date range' do
23
79
  subject(:order) { described_class.new(client) }
24
80
 
81
+ describe 'order attributes' do
82
+ let(:version) { Epics::Keyring::VERSION_25 }
83
+
84
+ it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
85
+ it { expect(subject.to_xml).to include('<OrderType>STA</OrderType>') }
86
+ end
87
+
88
+ include_examples '#to_xml'
89
+ include_examples '#to_receipt_xml'
90
+
25
91
  describe '#to_xml' do
26
- specify { expect(order.to_xml).to be_a_valid_ebics_doc }
92
+ let(:version) { Epics::Keyring::VERSION_25 }
27
93
 
28
94
  it 'does not include a standard order parameter' do
29
95
  expect(order.to_xml).to include('<StandardOrderParams/>')
30
96
  end
31
97
  end
32
98
 
33
- describe '#to_receipt_xml' do
34
- before { order.transaction_id = SecureRandom.hex(16) }
99
+ describe 'H005 request structure' do
100
+ let(:version) { Epics::Keyring::VERSION_30 }
101
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
102
+ let(:ns) { { 'e' => 'urn:org:ebics:H005' } }
103
+
104
+ include_examples 'a valid ebicsRequest H005 download',
105
+ service_name: 'EOP', msg_name: 'mt940'
106
+ end
107
+
108
+ describe 'H005 receipt structure' do
109
+ let(:version) { Epics::Keyring::VERSION_30 }
110
+ let(:xml) do
111
+ subject.transaction_id = SecureRandom.hex(16)
112
+ Nokogiri::XML(subject.to_receipt_xml)
113
+ end
114
+ let(:ns) { { 'e' => 'urn:org:ebics:H005' } }
115
+
116
+ include_examples 'a valid ebicsRequest H005 receipt'
117
+ end
118
+
119
+ describe 'H004 request structure' do
120
+ let(:version) { Epics::Keyring::VERSION_25 }
121
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
122
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
123
+
124
+ include_examples 'a valid ebicsRequest download', order_type: 'STA'
125
+ end
126
+
127
+ describe 'H004 receipt structure' do
128
+ let(:version) { Epics::Keyring::VERSION_25 }
129
+ let(:xml) do
130
+ subject.transaction_id = SecureRandom.hex(16)
131
+ Nokogiri::XML(subject.to_receipt_xml)
132
+ end
133
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
134
+
135
+ include_examples 'a valid ebicsRequest receipt'
136
+ end
137
+
138
+ describe 'H003 request structure' do
139
+ let(:version) { Epics::Keyring::VERSION_24 }
140
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
141
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
142
+
143
+ include_examples 'a valid ebicsRequest download', order_type: 'STA', ebics_version: 'H003'
144
+ end
145
+
146
+ describe 'H003 receipt structure' do
147
+ let(:version) { Epics::Keyring::VERSION_24 }
148
+ let(:xml) do
149
+ subject.transaction_id = SecureRandom.hex(16)
150
+ Nokogiri::XML(subject.to_receipt_xml)
151
+ end
152
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
35
153
 
36
- specify { expect(order.to_receipt_xml).to be_a_valid_ebics_doc }
154
+ include_examples 'a valid ebicsRequest receipt', ebics_version: 'H003'
37
155
  end
38
156
  end
39
157
  end
@@ -1,9 +1,41 @@
1
1
  RSpec.describe Epics::VMK do
2
- let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS') }
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS', version:) }
3
3
 
4
- subject { described_class.new(client, from: "2014-09-01", to: "2014-09-30") }
4
+ subject { described_class.new(client, from: Date.parse('2014-09-01'), to: Date.parse('2014-09-30')) }
5
5
 
6
- describe '#to_xml' do
7
- specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
6
+ describe 'order attributes' do
7
+ let(:version) { Epics::Keyring::VERSION_25 }
8
+
9
+ it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
10
+ it { expect(subject.to_xml).to include('<OrderType>VMK</OrderType>') }
11
+ end
12
+
13
+ include_examples '#to_xml'
14
+
15
+ describe 'H005 request structure' do
16
+ let(:version) { Epics::Keyring::VERSION_30 }
17
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
18
+ let(:ns) { { 'e' => 'urn:org:ebics:H005' } }
19
+
20
+ include_examples 'a valid ebicsRequest H005 download with date range',
21
+ service_name: 'STM', msg_name: 'mt942', from: '2014-09-01', to: '2014-09-30'
22
+ end
23
+
24
+ describe 'H004 request structure' do
25
+ let(:version) { Epics::Keyring::VERSION_25 }
26
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
27
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
28
+
29
+ include_examples 'a valid ebicsRequest download with date range',
30
+ order_type: 'VMK', from: '2014-09-01', to: '2014-09-30'
31
+ end
32
+
33
+ describe 'H003 request structure' do
34
+ let(:version) { Epics::Keyring::VERSION_24 }
35
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
36
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
37
+
38
+ include_examples 'a valid ebicsRequest download with date range',
39
+ order_type: 'VMK', from: '2014-09-01', to: '2014-09-30', ebics_version: 'H003'
8
40
  end
9
41
  end
@@ -1,9 +1,35 @@
1
1
  RSpec.describe Epics::WSS do
2
- let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS') }
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS', version:) }
3
3
 
4
4
  subject { described_class.new(client) }
5
5
 
6
- describe '#to_xml' do
7
- specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
6
+ describe 'order attributes' do
7
+ let(:version) { Epics::Keyring::VERSION_25 }
8
+
9
+ it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
10
+ it { expect(subject.to_xml).to include('<OrderType>WSS</OrderType>') }
11
+ end
12
+
13
+ include_examples '#to_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
14
+
15
+ describe '#to_xml H005' do
16
+ let(:version) { Epics::Keyring::VERSION_30 }
17
+ it('raises VersionSupportError') { expect { subject.to_xml }.to raise_error(Epics::VersionSupportError) }
18
+ end
19
+
20
+ describe 'H004 request structure' do
21
+ let(:version) { Epics::Keyring::VERSION_25 }
22
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
23
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
24
+
25
+ include_examples 'a valid ebicsRequest download', order_type: 'WSS'
26
+ end
27
+
28
+ describe 'H003 request structure' do
29
+ let(:version) { Epics::Keyring::VERSION_24 }
30
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
31
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
32
+
33
+ include_examples 'a valid ebicsRequest download', order_type: 'WSS', ebics_version: 'H003'
8
34
  end
9
35
  end
@@ -1,4 +1,4 @@
1
- RSpec.describe Epics::X509Certificate do
1
+ RSpec.describe Epics::Crypt::X509 do
2
2
  subject(:x_509_certificate) { described_class.new(crt_content) }
3
3
 
4
4
  let(:key) { OpenSSL::PKey::RSA.new(2048) }
@@ -23,4 +23,12 @@ RSpec.describe Epics::X509Certificate do
23
23
  expect(x_509_certificate.data).to end_with('==')
24
24
  end
25
25
  end
26
+
27
+ describe '#fingerprint' do
28
+ it 'returns uppercase SHA256 hex digest' do
29
+ expect(x_509_certificate.fingerprint).to be_a(String)
30
+ expect(x_509_certificate.fingerprint.size).to eq(64)
31
+ expect(x_509_certificate.fingerprint).to match(/\A[0-9A-F]{64}\z/)
32
+ end
33
+ end
26
34
  end
@@ -0,0 +1,63 @@
1
+ RSpec.describe Epics::XCT do
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS', version:) }
3
+ let(:document) { File.read( File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'cd1.xml') ) }
4
+
5
+ subject { described_class.new(client, document) }
6
+
7
+ describe 'order attributes' do
8
+ let(:version) { Epics::Keyring::VERSION_25 }
9
+
10
+ it { expect(subject.to_xml).to include('<OrderAttribute>OZHNN</OrderAttribute>') }
11
+ it { expect(subject.to_xml).to include('<OrderType>XCT</OrderType>') }
12
+ end
13
+
14
+ include_examples '#to_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
15
+ include_examples '#to_transfer_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
16
+
17
+ # EBICS 3.0 defines no BTF service equivalent to XCT.
18
+ describe 'H005' do
19
+ let(:version) { Epics::Keyring::VERSION_30 }
20
+
21
+ it 'refuses to build a request rather than guessing a service' do
22
+ expect { subject.to_xml }.to raise_error(Epics::VersionSupportError)
23
+ end
24
+ end
25
+
26
+ describe 'H004 request structure' do
27
+ let(:version) { Epics::Keyring::VERSION_25 }
28
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
29
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
30
+
31
+ include_examples 'a valid ebicsRequest upload', order_type: 'XCT', order_attribute: 'OZHNN'
32
+ end
33
+
34
+ describe 'H004 transfer structure' do
35
+ let(:version) { Epics::Keyring::VERSION_25 }
36
+ let(:xml) do
37
+ subject.transaction_id = SecureRandom.hex(16)
38
+ Nokogiri::XML(subject.to_transfer_xml)
39
+ end
40
+ let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
41
+
42
+ include_examples 'a valid ebicsRequest transfer'
43
+ end
44
+
45
+ describe 'H003 request structure' do
46
+ let(:version) { Epics::Keyring::VERSION_24 }
47
+ let(:xml) { Nokogiri::XML(subject.to_xml) }
48
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
49
+
50
+ include_examples 'a valid ebicsRequest upload', order_type: 'XCT', order_attribute: 'OZHNN', ebics_version: 'H003'
51
+ end
52
+
53
+ describe 'H003 transfer structure' do
54
+ let(:version) { Epics::Keyring::VERSION_24 }
55
+ let(:xml) do
56
+ subject.transaction_id = SecureRandom.hex(16)
57
+ Nokogiri::XML(subject.to_transfer_xml)
58
+ end
59
+ let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
60
+
61
+ include_examples 'a valid ebicsRequest transfer', ebics_version: 'H003'
62
+ end
63
+ end
@@ -1,15 +1,22 @@
1
1
  RSpec.describe Epics::XDS do
2
- let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS') }
2
+ let(:client) { Epics::Client.new( File.open(File.join( File.dirname(__FILE__), '..', 'fixtures', 'SIZBN001.key')), 'secret' , 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS', version:) }
3
3
  let(:document) { File.read( File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'cd1.xml') ) }
4
+
4
5
  subject { described_class.new(client, document) }
5
6
 
6
- describe '#to_xml' do
7
- specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
7
+ describe 'order attributes' do
8
+ let(:version) { Epics::Keyring::VERSION_25 }
9
+
10
+ it { expect(subject.to_xml).to include('<OrderAttribute>OZHNN</OrderAttribute>') }
11
+ it { expect(subject.to_xml).to include('<OrderType>XDS</OrderType>') }
8
12
  end
9
13
 
10
- describe '#to_transfer_xml' do
11
- before { subject.transaction_id = SecureRandom.hex(16) }
14
+ include_examples '#to_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
15
+ include_examples '#to_transfer_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
12
16
 
13
- specify { expect(subject.to_transfer_xml).to be_a_valid_ebics_doc }
17
+ describe '#to_xml H005' do
18
+ let(:version) { Epics::Keyring::VERSION_30 }
19
+ it('raises VersionSupportError') { expect { subject.to_xml }.to raise_error(Epics::VersionSupportError) }
14
20
  end
21
+
15
22
  end