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.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.semaphore/semaphore.yml +17 -8
- data/CHANGELOG.md +97 -0
- data/EBICS_REFERENCES.md +169 -0
- data/README.md +219 -50
- data/lib/epics/azv.rb +3 -10
- data/lib/epics/b2b.rb +3 -10
- data/lib/epics/bka.rb +3 -14
- data/lib/epics/builders/body_builder/base.rb +26 -0
- data/lib/epics/builders/body_builder/v2.rb +9 -0
- data/lib/epics/builders/body_builder/v3.rb +9 -0
- data/lib/epics/builders/body_builder.rb +6 -0
- data/lib/epics/builders/data_encryption_info_builder.rb +29 -0
- data/lib/epics/builders/data_transfer_builder/base.rb +52 -0
- data/lib/epics/builders/data_transfer_builder/v2.rb +9 -0
- data/lib/epics/builders/data_transfer_builder/v3.rb +12 -0
- data/lib/epics/builders/data_transfer_builder.rb +6 -0
- data/lib/epics/builders/header_builder/base.rb +26 -0
- data/lib/epics/builders/header_builder/v2.rb +9 -0
- data/lib/epics/builders/header_builder/v3.rb +9 -0
- data/lib/epics/builders/header_builder.rb +6 -0
- data/lib/epics/builders/mutable_builder.rb +28 -0
- data/lib/epics/builders/order_details_builder/base.rb +100 -0
- data/lib/epics/builders/order_details_builder/v2.rb +21 -0
- data/lib/epics/builders/order_details_builder/v3.rb +51 -0
- data/lib/epics/builders/order_details_builder.rb +10 -0
- data/lib/epics/builders/request_builder.rb +25 -0
- data/lib/epics/builders/static_builder/base.rb +75 -0
- data/lib/epics/builders/static_builder/v2.rb +9 -0
- data/lib/epics/builders/static_builder/v3.rb +9 -0
- data/lib/epics/builders/static_builder.rb +9 -0
- data/lib/epics/builders/transfer_receipt_builder.rb +19 -0
- data/lib/epics/builders/xml_builder/base.rb +92 -0
- data/lib/epics/builders/xml_builder/v24.rb +31 -0
- data/lib/epics/builders/xml_builder/v25.rb +31 -0
- data/lib/epics/builders/xml_builder/v3.rb +31 -0
- data/lib/epics/builders/xml_builder.rb +7 -0
- data/lib/epics/builders.rb +13 -0
- data/lib/epics/c2s.rb +3 -10
- data/lib/epics/c52.rb +2 -14
- data/lib/epics/c53.rb +2 -14
- data/lib/epics/c54.rb +2 -14
- data/lib/epics/c5n.rb +3 -14
- data/lib/epics/ccs.rb +3 -10
- data/lib/epics/cct.rb +3 -10
- data/lib/epics/cd1.rb +3 -10
- data/lib/epics/cdb.rb +3 -10
- data/lib/epics/cdd.rb +3 -10
- data/lib/epics/cds.rb +3 -10
- data/lib/epics/cdz.rb +3 -14
- data/lib/epics/cip.rb +3 -10
- data/lib/epics/client.rb +491 -123
- data/lib/epics/crypt/aes.rb +56 -0
- data/lib/epics/crypt/x_509.rb +52 -0
- data/lib/epics/crypt.rb +5 -0
- data/lib/epics/crz.rb +3 -14
- data/lib/epics/factories/crypt/aes_factory.rb +5 -0
- data/lib/epics/factories/crypt.rb +4 -0
- data/lib/epics/factories/request_factory/base.rb +236 -0
- data/lib/epics/factories/request_factory/v2.rb +194 -0
- data/lib/epics/factories/request_factory/v24.rb +32 -0
- data/lib/epics/factories/request_factory/v25.rb +31 -0
- data/lib/epics/factories/request_factory/v3.rb +305 -0
- data/lib/epics/factories/request_factory.rb +8 -0
- data/lib/epics/factories.rb +5 -0
- data/lib/epics/fdl.rb +3 -18
- data/lib/epics/ful.rb +6 -0
- data/lib/epics/generic_request.rb +31 -92
- data/lib/epics/generic_upload_request.rb +14 -67
- data/lib/epics/haa.rb +3 -9
- data/lib/epics/hac.rb +3 -14
- data/lib/epics/handlers/auth_signature_handler.rb +102 -0
- data/lib/epics/handlers/order_data_handler/base.rb +98 -0
- data/lib/epics/handlers/order_data_handler/v2.rb +39 -0
- data/lib/epics/handlers/order_data_handler/v24.rb +11 -0
- data/lib/epics/handlers/order_data_handler/v25.rb +11 -0
- data/lib/epics/handlers/order_data_handler/v3.rb +41 -0
- data/lib/epics/handlers/order_data_handler.rb +8 -0
- data/lib/epics/handlers/user_signature_handler/base.rb +10 -0
- data/lib/epics/handlers/user_signature_handler/v2.rb +17 -0
- data/lib/epics/handlers/user_signature_handler/v3.rb +17 -0
- data/lib/epics/handlers/user_signature_handler.rb +6 -0
- data/lib/epics/handlers.rb +6 -0
- data/lib/epics/hev.rb +2 -15
- data/lib/epics/hia.rb +4 -55
- data/lib/epics/hkd.rb +3 -9
- data/lib/epics/hpb.rb +3 -13
- data/lib/epics/hpd.rb +3 -9
- data/lib/epics/htd.rb +3 -9
- data/lib/epics/ini.rb +4 -46
- data/lib/epics/keyring.rb +17 -0
- data/lib/epics/letter_renderer.rb +17 -22
- data/lib/epics/ptk.rb +3 -14
- data/lib/epics/response.rb +34 -29
- data/lib/epics/services/crypt_service.rb +62 -0
- data/lib/epics/services/digest_resolver/base.rb +30 -0
- data/lib/epics/services/digest_resolver/v2.rb +13 -0
- data/lib/epics/services/digest_resolver/v3.rb +19 -0
- data/lib/epics/services/digest_resolver.rb +6 -0
- data/lib/epics/services.rb +5 -0
- data/lib/epics/signature.rb +50 -0
- data/lib/epics/{key.rb → signature_algorithm/base.rb} +14 -21
- data/lib/epics/signature_algorithm/rsa.rb +50 -0
- data/lib/epics/signature_algorithm/rsapkcs1.rb +16 -0
- data/lib/epics/signature_algorithm/rsapss.rb +20 -0
- data/lib/epics/signature_algorithm.rb +2 -0
- data/lib/epics/sta.rb +3 -14
- data/lib/epics/version.rb +1 -1
- data/lib/epics/vmk.rb +3 -14
- data/lib/epics/wss.rb +3 -9
- data/lib/epics/xct.rb +3 -10
- data/lib/epics/xds.rb +3 -10
- data/lib/epics/xe2.rb +3 -10
- data/lib/epics/xe3.rb +3 -10
- data/lib/epics/xek.rb +5 -0
- data/lib/epics/yct.rb +6 -0
- data/lib/epics/z01.rb +2 -14
- data/lib/epics/z52.rb +2 -14
- data/lib/epics/z53.rb +2 -14
- data/lib/epics/z54.rb +2 -14
- data/lib/epics/zsr.rb +5 -0
- data/lib/epics.rb +69 -5
- data/lib/letter/ini.erb +27 -6
- data/spec/aes_spec.rb +46 -0
- data/spec/auth_signature_handler_spec.rb +58 -0
- data/spec/builders_spec.rb +616 -0
- data/spec/certificate_handling_spec.rb +189 -0
- data/spec/client_setup_block_spec.rb +41 -0
- data/spec/client_spec.rb +143 -91
- data/spec/crypt_service_spec.rb +132 -0
- data/spec/date_range_spec.rb +46 -0
- data/spec/digest_resolver_spec.rb +164 -0
- data/spec/fixtures/bank_x509.pem +3 -0
- data/spec/fixtures/xml/haa.xml +40 -1
- data/spec/fixtures/xml/haa_receipt.xml +33 -30
- data/spec/fixtures/xml/haa_response_h004.xml +4 -0
- data/spec/fixtures/xml/haa_response_h005.xml +38 -0
- data/spec/fixtures/xml/hia_request_order_data.xml +24 -1
- data/spec/fixtures/xml/hpb_request.xml +1 -1
- data/spec/fixtures/xml/hpb_response_x509.xml +16 -0
- data/spec/fixtures/xml/htd_order_data_h005.xml +55 -0
- data/spec/fixtures/xml/jruby/hia.xml +20 -22
- data/spec/fixtures/xml/jruby/ini.xml +1 -3
- data/spec/fixtures/xml/ruby/hia.xml +21 -1
- data/spec/fixtures/xml/ruby/ini.xml +21 -1
- data/spec/handlers_spec.rb +267 -0
- data/spec/hpb_malformed_certificate_spec.rb +36 -0
- data/spec/key_file_decryption_spec.rb +27 -0
- data/spec/key_file_preservation_spec.rb +78 -0
- data/spec/keyring_spec.rb +349 -0
- data/spec/middleware/parse_ebics_spec.rb +2 -1
- data/spec/order_id_spec.rb +65 -0
- data/spec/orders/azv_spec.rb +63 -7
- data/spec/orders/b2b_spec.rb +68 -3
- data/spec/orders/bka_spec.rb +34 -4
- data/spec/orders/c2s_spec.rb +62 -9
- data/spec/orders/c52_spec.rb +34 -4
- data/spec/orders/c53_spec.rb +34 -4
- data/spec/orders/c54_spec.rb +36 -4
- data/spec/orders/c5n_spec.rb +36 -4
- data/spec/orders/camt_parity_spec.rb +80 -0
- data/spec/orders/ccs_spec.rb +62 -9
- data/spec/orders/cct_spec.rb +83 -9
- data/spec/orders/cd1_spec.rb +50 -7
- data/spec/orders/cdb_spec.rb +64 -7
- data/spec/orders/cdd_spec.rb +64 -7
- data/spec/orders/cds_spec.rb +74 -0
- data/spec/orders/cdz_spec.rb +67 -4
- data/spec/orders/cip_spec.rb +61 -9
- data/spec/orders/crz_spec.rb +67 -4
- data/spec/orders/fdl_spec.rb +143 -13
- data/spec/orders/ful_spec.rb +63 -0
- data/spec/orders/haa_spec.rb +115 -9
- data/spec/orders/hac_spec.rb +89 -10
- data/spec/orders/hev_spec.rb +1 -6
- data/spec/orders/hia_spec.rb +25 -22
- data/spec/orders/hkd_spec.rb +23 -4
- data/spec/orders/hpb_spec.rb +7 -4
- data/spec/orders/hpd_spec.rb +23 -4
- data/spec/orders/htd_spec.rb +23 -4
- data/spec/orders/ini_spec.rb +23 -18
- data/spec/orders/ptk_spec.rb +27 -4
- data/spec/orders/sta_spec.rb +129 -11
- data/spec/orders/vmk_spec.rb +36 -4
- data/spec/orders/wss_spec.rb +29 -3
- data/spec/orders/x_509_certificate_spec.rb +9 -1
- data/spec/orders/xct_spec.rb +63 -0
- data/spec/orders/xds_spec.rb +13 -6
- data/spec/orders/xe2_spec.rb +64 -7
- data/spec/orders/xe3_spec.rb +64 -7
- data/spec/orders/xek_spec.rb +31 -0
- data/spec/orders/yct_spec.rb +43 -0
- data/spec/orders/z01_spec.rb +34 -4
- data/spec/orders/z52_spec.rb +34 -4
- data/spec/orders/z53_spec.rb +34 -4
- data/spec/orders/z54_spec.rb +36 -4
- data/spec/orders/zsr_spec.rb +31 -0
- data/spec/request_factory_spec.rb +444 -0
- data/spec/response_business_error_spec.rb +45 -0
- data/spec/response_validation_spec.rb +23 -0
- data/spec/{key_spec.rb → signature_algorithm/rsa_pss_spec.rb} +4 -13
- data/spec/support/ebics_matcher.rb +17 -9
- data/spec/support/ebics_shared_examples.rb +642 -0
- data/spec/support/h005_client_helper.rb +23 -0
- data/spec/upload_digest_spec.rb +69 -0
- data/spec/user_signature_handler_spec.rb +25 -0
- data/spec/version_support_error_spec.rb +76 -0
- data/spec/xsd/{ebics_hev.xsd → H000/ebics_hev.xsd} +0 -0
- data/spec/xsd/H003/ebics.xsd +11 -0
- data/spec/xsd/H003/ebics_keymgmt_request.xsd +555 -0
- data/spec/xsd/H003/ebics_keymgmt_response.xsd +131 -0
- data/spec/xsd/H003/ebics_orders.xsd +1811 -0
- data/spec/xsd/H003/ebics_request.xsd +354 -0
- data/spec/xsd/H003/ebics_response.xsd +161 -0
- data/spec/xsd/{ebics_signature.xsd → H003/ebics_signature.xsd} +0 -0
- data/spec/xsd/H003/ebics_types.xsd +2361 -0
- data/spec/xsd/H003/xmldsig-core-schema.xsd +318 -0
- data/spec/xsd/H004/ebics_signature.xsd +217 -0
- data/spec/xsd/H005/ebics_H005.xsd +11 -0
- data/spec/xsd/H005/ebics_keymgmt_request_H005.xsd +523 -0
- data/spec/xsd/H005/ebics_keymgmt_response_H005.xsd +137 -0
- data/spec/xsd/H005/ebics_orders_H005.xsd +2094 -0
- data/spec/xsd/H005/ebics_request_H005.xsd +349 -0
- data/spec/xsd/H005/ebics_response_H005.xsd +167 -0
- data/spec/xsd/H005/ebics_signature_S002.xsd +177 -0
- data/spec/xsd/H005/ebics_types_H005.xsd +1885 -0
- data/spec/xsd/H005/xmldsig-core-schema.xsd +318 -0
- metadata +200 -36
- data/lib/epics/header_request.rb +0 -58
- data/lib/epics/middleware/xmlsig.rb +0 -16
- data/lib/epics/signer.rb +0 -40
- data/lib/epics/x_509_certificate.rb +0 -15
- data/lib/letter/ini_with_certs.erb +0 -335
- data/spec/generic_upload_spec.rb +0 -58
- data/spec/hpb_spec.rb +0 -15
- data/spec/signer_spec.rb +0 -34
- /data/spec/xsd/{ebics_H004.xsd → H004/ebics_H004.xsd} +0 -0
- /data/spec/xsd/{ebics_keymgmt_request_H004.xsd → H004/ebics_keymgmt_request_H004.xsd} +0 -0
- /data/spec/xsd/{ebics_keymgmt_response_H004.xsd → H004/ebics_keymgmt_response_H004.xsd} +0 -0
- /data/spec/xsd/{ebics_orders_H004.xsd → H004/ebics_orders_H004.xsd} +0 -0
- /data/spec/xsd/{ebics_request_H004.xsd → H004/ebics_request_H004.xsd} +0 -0
- /data/spec/xsd/{ebics_response_H004.xsd → H004/ebics_response_H004.xsd} +0 -0
- /data/spec/xsd/{ebics_types_H004.xsd → H004/ebics_types_H004.xsd} +0 -0
- /data/spec/xsd/{xmldsig-core-schema.xsd → H004/xmldsig-core-schema.xsd} +0 -0
data/spec/orders/fdl_spec.rb
CHANGED
|
@@ -1,39 +1,123 @@
|
|
|
1
1
|
RSpec.describe Epics::FDL 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(:file_format) { 'camt.xxx.cfonb120.stm.Oby' }
|
|
4
4
|
|
|
5
5
|
context 'with file_format' do
|
|
6
6
|
subject(:order) { described_class.new(client, file_format: file_format) }
|
|
7
7
|
|
|
8
|
+
include_examples '#to_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
|
|
9
|
+
describe '#to_xml H005' do
|
|
10
|
+
let(:version) { Epics::Keyring::VERSION_30 }
|
|
11
|
+
it('raises VersionSupportError') { expect { subject.to_xml }.to raise_error(Epics::VersionSupportError) }
|
|
12
|
+
end
|
|
13
|
+
include_examples '#to_receipt_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
|
|
14
|
+
|
|
8
15
|
describe '#to_xml' do
|
|
9
|
-
|
|
16
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
10
17
|
|
|
11
18
|
it 'does includes a date range as standard order parameter' do
|
|
12
19
|
expect(order.to_xml).to include('<FDLOrderParams><FileFormat>camt.xxx.cfonb120.stm.Oby</FileFormat></FDLOrderParams>')
|
|
13
20
|
end
|
|
14
21
|
end
|
|
15
22
|
|
|
16
|
-
describe '
|
|
17
|
-
|
|
23
|
+
describe 'H004 request structure' do
|
|
24
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
25
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
26
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
27
|
+
|
|
28
|
+
include_examples 'a valid ebicsRequest download with FDLOrderParams',
|
|
29
|
+
order_type: 'FDL', file_format: 'camt.xxx.cfonb120.stm.Oby'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe 'H004 receipt structure' do
|
|
33
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
34
|
+
let(:xml) do
|
|
35
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
36
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
37
|
+
end
|
|
38
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
18
39
|
|
|
19
|
-
|
|
40
|
+
include_examples 'a valid ebicsRequest receipt'
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe 'H003 request structure' do
|
|
44
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
45
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
46
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
47
|
+
|
|
48
|
+
include_examples 'a valid ebicsRequest download with FDLOrderParams',
|
|
49
|
+
order_type: 'FDL', file_format: 'camt.xxx.cfonb120.stm.Oby', ebics_version: 'H003'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe 'H003 receipt structure' do
|
|
53
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
54
|
+
let(:xml) do
|
|
55
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
56
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
57
|
+
end
|
|
58
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
59
|
+
|
|
60
|
+
include_examples 'a valid ebicsRequest receipt', ebics_version: 'H003'
|
|
20
61
|
end
|
|
21
62
|
|
|
22
63
|
context 'with DateRange' do
|
|
23
64
|
subject(:order) { described_class.new(client, file_format: file_format, from: Date.new(2024, 1, 1), to: Date.new(2024, 1, 2)) }
|
|
24
65
|
|
|
66
|
+
include_examples '#to_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
|
|
67
|
+
describe '#to_xml H005' do
|
|
68
|
+
let(:version) { Epics::Keyring::VERSION_30 }
|
|
69
|
+
it('raises VersionSupportError') { expect { subject.to_xml }.to raise_error(Epics::VersionSupportError) }
|
|
70
|
+
end
|
|
71
|
+
include_examples '#to_receipt_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
|
|
72
|
+
|
|
25
73
|
describe '#to_xml' do
|
|
26
|
-
|
|
74
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
27
75
|
|
|
28
76
|
it 'does includes a date range as optional order parameter' do
|
|
29
77
|
expect(order.to_xml).to include('<FDLOrderParams><DateRange><Start>2024-01-01</Start><End>2024-01-02</End></DateRange><FileFormat>camt.xxx.cfonb120.stm.Oby</FileFormat></FDLOrderParams>')
|
|
30
78
|
end
|
|
31
79
|
end
|
|
32
80
|
|
|
33
|
-
describe '
|
|
34
|
-
|
|
81
|
+
describe 'H004 request structure' do
|
|
82
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
83
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
84
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
85
|
+
|
|
86
|
+
include_examples 'a valid ebicsRequest download with FDLOrderParams and date range',
|
|
87
|
+
order_type: 'FDL', file_format: 'camt.xxx.cfonb120.stm.Oby',
|
|
88
|
+
from: '2024-01-01', to: '2024-01-02'
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
describe 'H004 receipt structure' do
|
|
92
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
93
|
+
let(:xml) do
|
|
94
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
95
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
96
|
+
end
|
|
97
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
98
|
+
|
|
99
|
+
include_examples 'a valid ebicsRequest receipt'
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
describe 'H003 request structure' do
|
|
103
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
104
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
105
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
35
106
|
|
|
36
|
-
|
|
107
|
+
include_examples 'a valid ebicsRequest download with FDLOrderParams and date range',
|
|
108
|
+
order_type: 'FDL', file_format: 'camt.xxx.cfonb120.stm.Oby',
|
|
109
|
+
from: '2024-01-01', to: '2024-01-02', ebics_version: 'H003'
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
describe 'H003 receipt structure' do
|
|
113
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
114
|
+
let(:xml) do
|
|
115
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
116
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
117
|
+
end
|
|
118
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
119
|
+
|
|
120
|
+
include_examples 'a valid ebicsRequest receipt', ebics_version: 'H003'
|
|
37
121
|
end
|
|
38
122
|
end
|
|
39
123
|
end
|
|
@@ -41,18 +125,64 @@ RSpec.describe Epics::FDL do
|
|
|
41
125
|
context 'without file_format' do
|
|
42
126
|
subject(:order) { described_class.new(client) }
|
|
43
127
|
|
|
128
|
+
describe 'order attributes' do
|
|
129
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
130
|
+
|
|
131
|
+
it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
|
|
132
|
+
it { expect(subject.to_xml).to include('<OrderType>FDL</OrderType>') }
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
include_examples '#to_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
|
|
136
|
+
describe '#to_xml H005' do
|
|
137
|
+
let(:version) { Epics::Keyring::VERSION_30 }
|
|
138
|
+
it('raises VersionSupportError') { expect { subject.to_xml }.to raise_error(Epics::VersionSupportError) }
|
|
139
|
+
end
|
|
140
|
+
include_examples '#to_receipt_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
|
|
141
|
+
|
|
44
142
|
describe '#to_xml' do
|
|
45
|
-
|
|
143
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
46
144
|
|
|
47
145
|
it 'does not include a standard order parameter' do
|
|
48
146
|
expect(order.to_xml).to include('<FDLOrderParams><FileFormat/></FDLOrderParams>')
|
|
49
147
|
end
|
|
50
148
|
end
|
|
51
149
|
|
|
52
|
-
describe '
|
|
53
|
-
|
|
150
|
+
describe 'H004 request structure' do
|
|
151
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
152
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
153
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
154
|
+
|
|
155
|
+
include_examples 'a valid ebicsRequest download', order_type: 'FDL'
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
describe 'H004 receipt structure' do
|
|
159
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
160
|
+
let(:xml) do
|
|
161
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
162
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
163
|
+
end
|
|
164
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
165
|
+
|
|
166
|
+
include_examples 'a valid ebicsRequest receipt'
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
describe 'H003 request structure' do
|
|
170
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
171
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
172
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
173
|
+
|
|
174
|
+
include_examples 'a valid ebicsRequest download', order_type: 'FDL', ebics_version: 'H003'
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
describe 'H003 receipt structure' do
|
|
178
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
179
|
+
let(:xml) do
|
|
180
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
181
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
182
|
+
end
|
|
183
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
54
184
|
|
|
55
|
-
|
|
185
|
+
include_examples 'a valid ebicsRequest receipt', ebics_version: 'H003'
|
|
56
186
|
end
|
|
57
187
|
end
|
|
58
188
|
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
RSpec.describe Epics::FUL 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, file_format: 'pain.001.001.02') }
|
|
6
|
+
|
|
7
|
+
describe 'order attributes' do
|
|
8
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
9
|
+
|
|
10
|
+
it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
|
|
11
|
+
it { expect(subject.to_xml).to include('<OrderType>FUL</OrderType>') }
|
|
12
|
+
it { expect(subject.to_xml).to include('<FileFormat>pain.001.001.02</FileFormat>') }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
include_examples '#to_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
|
|
16
|
+
include_examples '#to_transfer_xml', versions: [Epics::Keyring::VERSION_24, Epics::Keyring::VERSION_25]
|
|
17
|
+
|
|
18
|
+
describe '#to_xml H005' do
|
|
19
|
+
let(:version) { Epics::Keyring::VERSION_30 }
|
|
20
|
+
it('raises VersionSupportError') { expect { subject.to_xml }.to raise_error(Epics::VersionSupportError) }
|
|
21
|
+
end
|
|
22
|
+
|
|
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 upload with FULOrderParams',
|
|
30
|
+
order_type: 'FUL', order_attribute: 'DZHNN', file_format: 'pain.001.001.02'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe 'H004 transfer structure' do
|
|
34
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
35
|
+
let(:xml) do
|
|
36
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
37
|
+
Nokogiri::XML(subject.to_transfer_xml)
|
|
38
|
+
end
|
|
39
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
40
|
+
|
|
41
|
+
include_examples 'a valid ebicsRequest transfer'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
describe 'H003 request structure' do
|
|
45
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
46
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
47
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
48
|
+
|
|
49
|
+
include_examples 'a valid ebicsRequest upload with FULOrderParams',
|
|
50
|
+
order_type: 'FUL', order_attribute: 'DZHNN', file_format: 'pain.001.001.02', 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
|
data/spec/orders/haa_spec.rb
CHANGED
|
@@ -1,33 +1,139 @@
|
|
|
1
1
|
RSpec.describe Epics::HAA 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
|
-
before
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
before { allow(SecureRandom).to receive(:hex).with(16).and_return('95149241ead8ae7dbb72cabe966bf0e3') }
|
|
7
|
+
before { allow(Time).to receive(:now).and_return(Time.parse('2017-10-17T19:56:33Z')) }
|
|
8
|
+
|
|
9
|
+
describe 'order attributes' do
|
|
10
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
11
|
+
|
|
12
|
+
it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
|
|
13
|
+
it { expect(subject.to_xml).to include('<OrderType>HAA</OrderType>') }
|
|
10
14
|
end
|
|
11
15
|
|
|
16
|
+
include_examples '#to_xml'
|
|
17
|
+
include_examples '#to_receipt_xml'
|
|
18
|
+
|
|
12
19
|
describe '#to_xml' do
|
|
13
|
-
|
|
20
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
14
21
|
|
|
15
22
|
describe 'validate against fixture' do
|
|
16
|
-
let(:signature_order_data) {
|
|
23
|
+
let(:signature_order_data) {
|
|
24
|
+
doc = Nokogiri::XML(File.read(File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'haa.xml')))
|
|
25
|
+
doc.xpath('//text()').each { |node| node.content = '' if node.text =~ /\A\s+\z/m }
|
|
26
|
+
doc
|
|
27
|
+
}
|
|
17
28
|
|
|
18
|
-
it
|
|
29
|
+
it 'will match exactly' do
|
|
19
30
|
expect(Nokogiri::XML(subject.to_xml)).to be_equivalent_to(signature_order_data)
|
|
20
31
|
end
|
|
21
32
|
end
|
|
22
33
|
end
|
|
23
34
|
|
|
24
35
|
describe '#to_receipt_xml' do
|
|
36
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
37
|
+
|
|
25
38
|
describe 'validate against fixture' do
|
|
26
39
|
let(:signature_order_data) { Nokogiri::XML(File.read(File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'haa_receipt.xml'))) }
|
|
27
40
|
|
|
28
|
-
it
|
|
41
|
+
it 'will match exactly' do
|
|
29
42
|
expect(Nokogiri::XML(subject.to_receipt_xml)).to be_equivalent_to(signature_order_data)
|
|
30
43
|
end
|
|
31
44
|
end
|
|
32
45
|
end
|
|
46
|
+
|
|
47
|
+
describe 'H004 request structure' do
|
|
48
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
49
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
50
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
51
|
+
|
|
52
|
+
include_examples 'a valid ebicsRequest download', order_type: 'HAA'
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
describe 'H004 receipt structure' do
|
|
56
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
57
|
+
let(:xml) do
|
|
58
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
59
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
60
|
+
end
|
|
61
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
62
|
+
|
|
63
|
+
include_examples 'a valid ebicsRequest receipt'
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
describe 'H003 request structure' do
|
|
67
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
68
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
69
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
70
|
+
|
|
71
|
+
include_examples 'a valid ebicsRequest download', order_type: 'HAA', ebics_version: 'H003'
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
describe 'H003 receipt structure' do
|
|
75
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
76
|
+
let(:xml) do
|
|
77
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
78
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
79
|
+
end
|
|
80
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
81
|
+
|
|
82
|
+
include_examples 'a valid ebicsRequest receipt', ebics_version: 'H003'
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe 'H005 receipt structure' do
|
|
86
|
+
let(:version) { Epics::Keyring::VERSION_30 }
|
|
87
|
+
let(:xml) do
|
|
88
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
89
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
90
|
+
end
|
|
91
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H005' } }
|
|
92
|
+
|
|
93
|
+
include_examples 'a valid ebicsRequest receipt', ebics_version: 'H005'
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
describe 'H005 request structure validation' do
|
|
97
|
+
let(:version) { Epics::Keyring::VERSION_30 }
|
|
98
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
99
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H005' } }
|
|
100
|
+
|
|
101
|
+
it 'has ebicsRequest root with H005 namespace and Version' do
|
|
102
|
+
root = xml.root
|
|
103
|
+
expect(root.name).to eq('ebicsRequest')
|
|
104
|
+
expect(root.namespace.href).to eq('urn:org:ebics:H005')
|
|
105
|
+
expect(root['Version']).to eq('H005')
|
|
106
|
+
expect(root['Revision']).to eq('1')
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it 'has header with authenticate=true' do
|
|
110
|
+
header = xml.at_xpath('//e:header', ns)
|
|
111
|
+
expect(header).not_to be_nil
|
|
112
|
+
expect(header['authenticate']).to eq('true')
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it 'has AdminOrderType HAA' do
|
|
116
|
+
expect(xml.at_xpath('//e:header/e:static/e:OrderDetails/e:AdminOrderType', ns).text).to eq('HAA')
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it 'does not have OrderType or OrderAttribute' do
|
|
120
|
+
expect(xml.at_xpath('//e:header/e:static/e:OrderDetails/e:OrderType', ns)).to be_nil
|
|
121
|
+
expect(xml.at_xpath('//e:header/e:static/e:OrderDetails/e:OrderAttribute', ns)).to be_nil
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
it 'has PartnerID and UserID' do
|
|
125
|
+
expect(xml.at_xpath('//e:header/e:static/e:PartnerID', ns)).not_to be_nil
|
|
126
|
+
expect(xml.at_xpath('//e:header/e:static/e:UserID', ns)).not_to be_nil
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
it 'has AuthSignature element' do
|
|
130
|
+
expect(xml.at_xpath('//e:AuthSignature', ns)).not_to be_nil
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
it 'has an empty body (no DataTransfer)' do
|
|
134
|
+
body = xml.at_xpath('//e:body', ns)
|
|
135
|
+
expect(body).not_to be_nil
|
|
136
|
+
expect(body.at_xpath('e:DataTransfer', ns)).to be_nil
|
|
137
|
+
end
|
|
138
|
+
end
|
|
33
139
|
end
|
data/spec/orders/hac_spec.rb
CHANGED
|
@@ -1,39 +1,118 @@
|
|
|
1
1
|
RSpec.describe Epics::HAC 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:
|
|
5
|
+
subject(:order) { described_class.new(client, from: Date.parse('2014-09-01'), to: Date.parse('2014-09-30')) }
|
|
6
|
+
|
|
7
|
+
include_examples '#to_xml'
|
|
8
|
+
include_examples '#to_receipt_xml'
|
|
6
9
|
|
|
7
10
|
describe '#to_xml' do
|
|
8
|
-
|
|
11
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
9
12
|
|
|
10
13
|
it 'does includes a date range as standard order parameter' do
|
|
11
14
|
expect(order.to_xml).to include('<StandardOrderParams><DateRange><Start>2014-09-01</Start><End>2014-09-30</End></DateRange></StandardOrderParams>')
|
|
12
15
|
end
|
|
13
16
|
end
|
|
14
17
|
|
|
15
|
-
describe '
|
|
16
|
-
|
|
18
|
+
describe 'H004 request structure' do
|
|
19
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
20
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
21
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
22
|
+
|
|
23
|
+
include_examples 'a valid ebicsRequest download with date range',
|
|
24
|
+
order_type: 'HAC', from: '2014-09-01', to: '2014-09-30'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe 'H004 receipt structure' do
|
|
28
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
29
|
+
let(:xml) do
|
|
30
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
31
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
32
|
+
end
|
|
33
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
34
|
+
|
|
35
|
+
include_examples 'a valid ebicsRequest receipt'
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
describe 'H003 request structure' do
|
|
39
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
40
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
41
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
17
42
|
|
|
18
|
-
|
|
43
|
+
include_examples 'a valid ebicsRequest download with date range',
|
|
44
|
+
order_type: 'HAC', from: '2014-09-01', to: '2014-09-30', ebics_version: 'H003'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe 'H003 receipt structure' do
|
|
48
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
49
|
+
let(:xml) do
|
|
50
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
51
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
52
|
+
end
|
|
53
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
54
|
+
|
|
55
|
+
include_examples 'a valid ebicsRequest receipt', ebics_version: 'H003'
|
|
19
56
|
end
|
|
20
57
|
end
|
|
21
58
|
|
|
22
59
|
context 'without date range' do
|
|
23
60
|
subject(:order) { described_class.new(client) }
|
|
24
61
|
|
|
62
|
+
describe 'order attributes' do
|
|
63
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
64
|
+
|
|
65
|
+
it { expect(subject.to_xml).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
|
|
66
|
+
it { expect(subject.to_xml).to include('<OrderType>HAC</OrderType>') }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
include_examples '#to_xml'
|
|
70
|
+
include_examples '#to_receipt_xml'
|
|
71
|
+
|
|
25
72
|
describe '#to_xml' do
|
|
26
|
-
|
|
73
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
27
74
|
|
|
28
75
|
it 'does not include a standard order parameter' do
|
|
29
76
|
expect(order.to_xml).to include('<StandardOrderParams/>')
|
|
30
77
|
end
|
|
31
78
|
end
|
|
32
79
|
|
|
33
|
-
describe '
|
|
34
|
-
|
|
80
|
+
describe 'H004 request structure' do
|
|
81
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
82
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
83
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
84
|
+
|
|
85
|
+
include_examples 'a valid ebicsRequest download', order_type: 'HAC'
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
describe 'H004 receipt structure' do
|
|
89
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
90
|
+
let(:xml) do
|
|
91
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
92
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
93
|
+
end
|
|
94
|
+
let(:ns) { { 'e' => 'urn:org:ebics:H004' } }
|
|
95
|
+
|
|
96
|
+
include_examples 'a valid ebicsRequest receipt'
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
describe 'H003 request structure' do
|
|
100
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
101
|
+
let(:xml) { Nokogiri::XML(subject.to_xml) }
|
|
102
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
103
|
+
|
|
104
|
+
include_examples 'a valid ebicsRequest download', order_type: 'HAC', ebics_version: 'H003'
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
describe 'H003 receipt structure' do
|
|
108
|
+
let(:version) { Epics::Keyring::VERSION_24 }
|
|
109
|
+
let(:xml) do
|
|
110
|
+
subject.transaction_id = SecureRandom.hex(16)
|
|
111
|
+
Nokogiri::XML(subject.to_receipt_xml)
|
|
112
|
+
end
|
|
113
|
+
let(:ns) { { 'e' => 'http://www.ebics.org/H003' } }
|
|
35
114
|
|
|
36
|
-
|
|
115
|
+
include_examples 'a valid ebicsRequest receipt', ebics_version: 'H003'
|
|
37
116
|
end
|
|
38
117
|
end
|
|
39
118
|
end
|
data/spec/orders/hev_spec.rb
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
RSpec.describe Epics::HEV do
|
|
2
|
-
|
|
3
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') }
|
|
4
3
|
|
|
5
|
-
let(:xsd) { Nokogiri::XML::Schema(File.open( File.join( File.dirname(__FILE__), '..', 'xsd', 'ebics_hev.xsd') )) }
|
|
6
|
-
let(:validator) { xsd.valid?(Nokogiri::XML(subject.to_xml)) }
|
|
7
|
-
|
|
8
4
|
subject { described_class.new(client) }
|
|
9
5
|
|
|
10
6
|
describe '#to_xml' do
|
|
11
|
-
specify { expect(
|
|
7
|
+
specify { expect(subject.to_xml).to be_a_valid_ebics_doc('H000') }
|
|
12
8
|
end
|
|
13
|
-
|
|
14
9
|
end
|
data/spec/orders/hia_spec.rb
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
RSpec.describe Epics::HIA 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')) }
|
|
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
|
|
|
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>HIA</OrderType>') }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
include_examples '#to_xml'
|
|
14
|
+
|
|
7
15
|
describe '#to_xml' do
|
|
8
|
-
|
|
16
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
9
17
|
|
|
10
18
|
describe 'validate against fixture' do
|
|
11
|
-
let(:hia)
|
|
12
|
-
|
|
13
|
-
end
|
|
19
|
+
let(:hia) { Nokogiri::XML(File.read(File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', RUBY_ENGINE, 'hia.xml'))) }
|
|
20
|
+
before { allow(Time).to receive(:now).and_return(Time.parse('2014-10-10T11:16:00Z')) }
|
|
14
21
|
|
|
15
22
|
it 'will match exactly' do
|
|
16
23
|
expect(Nokogiri::XML(subject.to_xml)).to be_equivalent_to(hia)
|
|
@@ -19,13 +26,13 @@ RSpec.describe Epics::HIA do
|
|
|
19
26
|
end
|
|
20
27
|
|
|
21
28
|
describe '#order_data' do
|
|
22
|
-
|
|
29
|
+
let(:version) { Epics::Keyring::VERSION_25 }
|
|
30
|
+
|
|
31
|
+
specify { expect(subject.order_data).to be_a_valid_ebics_doc(version) }
|
|
23
32
|
|
|
24
33
|
describe 'validate against fixture' do
|
|
25
|
-
let(:hia_request_order_data)
|
|
26
|
-
|
|
27
|
-
'hia_request_order_data.xml')))
|
|
28
|
-
end
|
|
34
|
+
let(:hia_request_order_data) { Nokogiri::XML(File.read(File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'hia_request_order_data.xml'))) }
|
|
35
|
+
before { allow(Time).to receive(:now).and_return(Time.parse('2014-10-10T11:16:00Z')) }
|
|
29
36
|
|
|
30
37
|
it 'will match exactly' do
|
|
31
38
|
expect(Nokogiri::XML(subject.order_data)).to be_equivalent_to(hia_request_order_data)
|
|
@@ -34,21 +41,17 @@ RSpec.describe Epics::HIA do
|
|
|
34
41
|
|
|
35
42
|
context 'with x509 certificate' do
|
|
36
43
|
let(:client) do
|
|
37
|
-
client = Epics::Client.new(key, 'secret', 'https://194.180.18.30/ebicsweb/ebicsweb', 'SIZBN001', 'EBIX', 'EBICS')
|
|
38
|
-
client.
|
|
39
|
-
|
|
40
|
-
e: generate_x_509_crt(client.e.key, '/C=GB/O=TestOrg/CN=test.example.org')
|
|
41
|
-
}
|
|
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_authentication.certificate = Epics::Crypt::X509.new(generate_x_509_crt(client.authentication_key.key, '/C=GB/O=TestOrg/CN=test.example.org'))
|
|
46
|
+
client.keyring.user_encryption.certificate = Epics::Crypt::X509.new(generate_x_509_crt(client.encryption_key.key, '/C=GB/O=TestOrg/CN=test.example.org'))
|
|
42
47
|
client
|
|
43
48
|
end
|
|
44
49
|
|
|
45
50
|
it 'includes x509 certificate' do
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
expect(subject.order_data).to include(
|
|
49
|
-
expect(subject.order_data).to include(
|
|
50
|
-
expect(subject.order_data).to include("<ds:X509Certificate>#{x_crt.data}</ds:X509Certificate>")
|
|
51
|
-
expect(subject.order_data).to include("<ds:X509Certificate>#{e_crt.data}</ds:X509Certificate>")
|
|
51
|
+
expect(subject.order_data).to include('<ds:X509IssuerName>CN=test.example.org,O=TestOrg,C=GB</ds:X509IssuerName>')
|
|
52
|
+
expect(subject.order_data).to include('<ds:X509SerialNumber>1</ds:X509SerialNumber>')
|
|
53
|
+
expect(subject.order_data).to include("<ds:X509Certificate>#{client.keyring.user_authentication.certificate.data}</ds:X509Certificate>")
|
|
54
|
+
expect(subject.order_data).to include("<ds:X509Certificate>#{client.keyring.user_encryption.certificate.data}</ds:X509Certificate>")
|
|
52
55
|
end
|
|
53
56
|
end
|
|
54
57
|
end
|