epics 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +6 -0
  5. data/CONTRIBUTING.md +5 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +165 -0
  8. data/README.md +197 -0
  9. data/Rakefile +7 -0
  10. data/epics.gemspec +50 -0
  11. data/lib/epics.rb +35 -0
  12. data/lib/epics/cct.rb +42 -0
  13. data/lib/epics/cd1.rb +42 -0
  14. data/lib/epics/cdd.rb +42 -0
  15. data/lib/epics/client.rb +216 -0
  16. data/lib/epics/error.rb +324 -0
  17. data/lib/epics/generic_request.rb +99 -0
  18. data/lib/epics/generic_upload_request.rb +89 -0
  19. data/lib/epics/haa.rb +40 -0
  20. data/lib/epics/hia.rb +78 -0
  21. data/lib/epics/hpb.rb +29 -0
  22. data/lib/epics/hpd.rb +40 -0
  23. data/lib/epics/htd.rb +40 -0
  24. data/lib/epics/ini.rb +69 -0
  25. data/lib/epics/key.rb +79 -0
  26. data/lib/epics/mgf.rb +41 -0
  27. data/lib/epics/middleware/parse_ebics.rb +15 -0
  28. data/lib/epics/middleware/xmlsig.rb +18 -0
  29. data/lib/epics/ptk.rb +52 -0
  30. data/lib/epics/response.rb +93 -0
  31. data/lib/epics/signer.rb +40 -0
  32. data/lib/epics/sta.rb +52 -0
  33. data/lib/epics/version.rb +3 -0
  34. data/lib/letter/ini.erb +231 -0
  35. data/spec/client_spec.rb +98 -0
  36. data/spec/fixtures/a006.pem +28 -0
  37. data/spec/fixtures/bank_e.pem +6 -0
  38. data/spec/fixtures/e002.pem +28 -0
  39. data/spec/fixtures/x002.pem +28 -0
  40. data/spec/fixtures/xml/cd1.xml +87 -0
  41. data/spec/fixtures/xml/ebics_business_nok.xml +21 -0
  42. data/spec/fixtures/xml/ebics_technical_nok.xml +12 -0
  43. data/spec/fixtures/xml/hia.xml +2 -0
  44. data/spec/fixtures/xml/hia_request_order_data.xml +2 -0
  45. data/spec/fixtures/xml/hpb.xml +34 -0
  46. data/spec/fixtures/xml/hpb_request.xml +34 -0
  47. data/spec/fixtures/xml/hpb_response.xml +21 -0
  48. data/spec/fixtures/xml/hpb_response_order.xml +22 -0
  49. data/spec/fixtures/xml/htd_order_data.xml +153 -0
  50. data/spec/fixtures/xml/ini.xml +2 -0
  51. data/spec/fixtures/xml/signature_pub_key_order_data.xml +2 -0
  52. data/spec/fixtures/xml/upload_init_response.xml +31 -0
  53. data/spec/hpb_spec.rb +15 -0
  54. data/spec/key_spec.rb +35 -0
  55. data/spec/mgf_spec.rb +36 -0
  56. data/spec/middleware/parse_ebics_spec.rb +18 -0
  57. data/spec/orders/cct_spec.rb +17 -0
  58. data/spec/orders/cd1_spec.rb +17 -0
  59. data/spec/orders/cdd_spec.rb +17 -0
  60. data/spec/orders/haa_spec.rb +11 -0
  61. data/spec/orders/hia_spec.rb +34 -0
  62. data/spec/orders/hpb_spec.rb +11 -0
  63. data/spec/orders/hpd_spec.rb +11 -0
  64. data/spec/orders/htd_spec.rb +11 -0
  65. data/spec/orders/ini_spec.rb +36 -0
  66. data/spec/orders/ptk_spec.rb +11 -0
  67. data/spec/orders/sta_spec.rb +11 -0
  68. data/spec/response_spec.rb +34 -0
  69. data/spec/signer_spec.rb +34 -0
  70. data/spec/spec_helper.rb +43 -0
  71. data/spec/support/ebics_matcher.rb +22 -0
  72. data/spec/xsd/ebics_H004.xsd +11 -0
  73. data/spec/xsd/ebics_hev.xsd +135 -0
  74. data/spec/xsd/ebics_keymgmt_request_H004.xsd +543 -0
  75. data/spec/xsd/ebics_keymgmt_response_H004.xsd +137 -0
  76. data/spec/xsd/ebics_orders_H004.xsd +1892 -0
  77. data/spec/xsd/ebics_request_H004.xsd +355 -0
  78. data/spec/xsd/ebics_response_H004.xsd +166 -0
  79. data/spec/xsd/ebics_signature.xsd +217 -0
  80. data/spec/xsd/ebics_types_H004.xsd +2426 -0
  81. data/spec/xsd/xmldsig-core-schema.xsd +318 -0
  82. metadata +319 -0
data/lib/epics.rb ADDED
@@ -0,0 +1,35 @@
1
+ require 'openssl'
2
+ require 'base64'
3
+ require 'erb'
4
+ require 'json'
5
+ require 'nokogiri'
6
+ require 'gyoku'
7
+ require 'faraday'
8
+
9
+ require "epics/version"
10
+ require "epics/key"
11
+ require "epics/mgf"
12
+ require "epics/response"
13
+ require "epics/error"
14
+ require "epics/middleware/xmlsig"
15
+ require "epics/middleware/parse_ebics"
16
+ require "epics/generic_request"
17
+ require "epics/generic_upload_request"
18
+ require "epics/hpb"
19
+ require "epics/htd"
20
+ require "epics/haa"
21
+ require "epics/sta"
22
+ require "epics/ptk"
23
+ require "epics/hpd"
24
+ require "epics/cd1"
25
+ require "epics/cct"
26
+ require "epics/cdd"
27
+ require "epics/hia"
28
+ require "epics/ini"
29
+ require "epics/signer"
30
+ require "epics/client"
31
+
32
+ module Epics
33
+
34
+ end
35
+ Ebics = Epics
data/lib/epics/cct.rb ADDED
@@ -0,0 +1,42 @@
1
+ class Epics::CCT < Epics::GenericUploadRequest
2
+
3
+ def header
4
+ {
5
+ :@authenticate => true,
6
+ static: {
7
+ "HostID" => host_id,
8
+ "Nonce" => nonce,
9
+ "Timestamp" => timestamp,
10
+ "PartnerID" => partner_id,
11
+ "UserID" => user_id,
12
+ "Product" => {
13
+ :@Language => "de",
14
+ :content! => "EPICS - a ruby ebics kernel"
15
+ },
16
+ "OrderDetails" => {
17
+ "OrderType" => "CD1",
18
+ "OrderAttribute" => "OZHNN",
19
+ "StandardOrderParams/" => ""
20
+ },
21
+ "BankPubKeyDigests" => {
22
+ "Authentication" => {
23
+ :@Version => "X002",
24
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
25
+ :content! => client.bank_x.public_digest
26
+ },
27
+ "Encryption" => {
28
+ :@Version => "E002",
29
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
30
+ :content! => client.bank_e.public_digest
31
+ }
32
+ },
33
+ "SecurityMedium" => "0000",
34
+ "NumSegments" => 1
35
+ },
36
+ "mutable" => {
37
+ "TransactionPhase" => "Initialisation"
38
+ }
39
+ }
40
+ end
41
+
42
+ end
data/lib/epics/cd1.rb ADDED
@@ -0,0 +1,42 @@
1
+ class Epics::CD1 < Epics::GenericUploadRequest
2
+
3
+ def header
4
+ {
5
+ :@authenticate => true,
6
+ static: {
7
+ "HostID" => host_id,
8
+ "Nonce" => nonce,
9
+ "Timestamp" => timestamp,
10
+ "PartnerID" => partner_id,
11
+ "UserID" => user_id,
12
+ "Product" => {
13
+ :@Language => "de",
14
+ :content! => "EPICS - a ruby ebics kernel"
15
+ },
16
+ "OrderDetails" => {
17
+ "OrderType" => "CD1",
18
+ "OrderAttribute" => "OZHNN",
19
+ "StandardOrderParams/" => ""
20
+ },
21
+ "BankPubKeyDigests" => {
22
+ "Authentication" => {
23
+ :@Version => "X002",
24
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
25
+ :content! => client.bank_x.public_digest
26
+ },
27
+ "Encryption" => {
28
+ :@Version => "E002",
29
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
30
+ :content! => client.bank_e.public_digest
31
+ }
32
+ },
33
+ "SecurityMedium" => "0000",
34
+ "NumSegments" => 1
35
+ },
36
+ "mutable" => {
37
+ "TransactionPhase" => "Initialisation"
38
+ }
39
+ }
40
+ end
41
+
42
+ end
data/lib/epics/cdd.rb ADDED
@@ -0,0 +1,42 @@
1
+ class Epics::CDD < Epics::GenericUploadRequest
2
+
3
+ def header
4
+ {
5
+ :@authenticate => true,
6
+ static: {
7
+ "HostID" => host_id,
8
+ "Nonce" => nonce,
9
+ "Timestamp" => timestamp,
10
+ "PartnerID" => partner_id,
11
+ "UserID" => user_id,
12
+ "Product" => {
13
+ :@Language => "de",
14
+ :content! => "EPICS - a ruby ebics kernel"
15
+ },
16
+ "OrderDetails" => {
17
+ "OrderType" => "CDD",
18
+ "OrderAttribute" => "OZHNN",
19
+ "StandardOrderParams/" => ""
20
+ },
21
+ "BankPubKeyDigests" => {
22
+ "Authentication" => {
23
+ :@Version => "X002",
24
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
25
+ :content! => client.bank_x.public_digest
26
+ },
27
+ "Encryption" => {
28
+ :@Version => "E002",
29
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
30
+ :content! => client.bank_e.public_digest
31
+ }
32
+ },
33
+ "SecurityMedium" => "0000",
34
+ "NumSegments" => 1
35
+ },
36
+ "mutable" => {
37
+ "TransactionPhase" => "Initialisation"
38
+ }
39
+ }
40
+ end
41
+
42
+ end
@@ -0,0 +1,216 @@
1
+ class Epics::Client
2
+ extend Forwardable
3
+
4
+ attr_accessor :passphrase, :url, :host_id, :user_id, :partner_id, :keys, :keys_content
5
+ attr_writer :iban, :bic, :name
6
+
7
+ def_delegators :connection, :post
8
+
9
+ def initialize(keys_content, passphrase, url, host_id, user_id, partner_id)
10
+ self.keys_content = keys_content.respond_to?(:read) ? keys_content.read : keys_content if keys_content
11
+ self.passphrase = passphrase
12
+ self.keys = extract_keys if keys_content
13
+ self.url = url
14
+ self.host_id = host_id
15
+ self.user_id = user_id
16
+ self.partner_id = partner_id
17
+ end
18
+
19
+ def e
20
+ keys["E002"]
21
+ end
22
+
23
+ def a
24
+ keys["A006"]
25
+ end
26
+
27
+ def x
28
+ keys["X002"]
29
+ end
30
+
31
+ def bank_e
32
+ keys["#{host_id.upcase}.E002"]
33
+ end
34
+
35
+ def bank_x
36
+ keys["#{host_id.upcase}.X002"]
37
+ end
38
+
39
+ def name
40
+ @name ||= (self.HTD; @name)
41
+ end
42
+
43
+ def iban
44
+ @iban ||= (self.HTD; @iban)
45
+ end
46
+
47
+ def bic
48
+ @bic ||= (self.HTD; @bic)
49
+ end
50
+
51
+ def self.setup(passphrase, url, host_id, user_id, partner_id, keysize = 2048)
52
+ client = Client.new(nil, passphrase, url, host_id, user_id, partner_id)
53
+ client.keys = %w(A006 X002 E002).each_with_object({}) do |type, memo|
54
+ memo[type] = Epics::Key.new( OpenSSL::PKey::RSA.generate(keysize) )
55
+ end
56
+
57
+ client
58
+ end
59
+
60
+ def ini_letter(bankname)
61
+ raw = File.read(File.join(File.dirname(__FILE__), '../letter/', 'ini.erb'))
62
+ ERB.new(raw).result(binding)
63
+ end
64
+
65
+ def save_ini_letter(bankname, path)
66
+ File.write(path, ini_letter(bankname))
67
+ path
68
+ end
69
+
70
+ def credit(document)
71
+ @client.CCT(document)
72
+ end
73
+
74
+ def debit(document, type = :CDD)
75
+ @client.send(type, document)
76
+ end
77
+
78
+ def statements(from, to, type = :STA)
79
+ @client.send(type, from, to)
80
+ end
81
+
82
+ def HIA
83
+ respnse = post(url, Epics::HIA.new(self).to_xml).body
84
+
85
+ respnse.ok?
86
+ end
87
+
88
+ def INI
89
+ respnse = post(url, Epics::INI.new(self).to_xml).body
90
+
91
+ respnse.ok?
92
+ end
93
+
94
+ def HPB
95
+ Nokogiri::XML(download(Epics::HPB)).xpath("//xmlns:PubKeyValue").each do |node|
96
+ type = node.parent.last_element_child.content
97
+
98
+ modulus = Base64.decode64(node.at_xpath(".//ds:Modulus").content)
99
+ exponent = Base64.decode64(node.at_xpath(".//ds:Exponent").content)
100
+
101
+ bank = OpenSSL::PKey::RSA.new
102
+ bank.n = OpenSSL::BN.new(modulus, 2)
103
+ bank.e = OpenSSL::BN.new(exponent, 2)
104
+
105
+ self.keys["#{host_id.upcase}.#{type}"] = Epics::Key.new(bank)
106
+ end
107
+
108
+ [bank_x, bank_e]
109
+ end
110
+
111
+ def CD1(document)
112
+ upload(Epics::CD1, document)
113
+ end
114
+
115
+ def CDD(document)
116
+ upload(Epics::CDD, document)
117
+ end
118
+
119
+ def CCT(document)
120
+ upload(Epics::CCT, document)
121
+ end
122
+
123
+ def STA(from, to)
124
+ download(Epics::STA, from, to)
125
+ end
126
+
127
+ def HAA
128
+ Nokogiri::XML(download(Epics::HAA)).at_xpath("//xmlns:OrderTypes").content.split(/\s/)
129
+ end
130
+
131
+ def HTD
132
+ Nokogiri::XML(download(Epics::HTD)).tap do |htd|
133
+ @iban ||= htd.at_xpath("//xmlns:AccountNumber[@international='true']").text
134
+ @bic ||= htd.at_xpath("//xmlns:BankCode[@international='true']").text
135
+ @name ||= htd.at_xpath("//xmlns:Name").text
136
+ end.to_xml
137
+ end
138
+
139
+ def HPD
140
+ download(Epics::HPD)
141
+ end
142
+
143
+ def PTK(from, to)
144
+ download(Epics::PTK, from, to)
145
+ end
146
+
147
+ def save_keys(path)
148
+ File.write(path, dump_keys)
149
+ end
150
+
151
+ private
152
+
153
+ def upload(order_type, document)
154
+ order = order_type.new(self, document)
155
+
156
+ res = post(url, order.to_xml).body
157
+
158
+ order.transaction_id = res.transaction_id
159
+
160
+ res = post(url, order.to_transfer_xml).body
161
+
162
+ res.transaction_id
163
+ end
164
+
165
+ def download(order_type, *args)
166
+ document = order_type.new(self, *args)
167
+ res = post(url, document.to_xml).body
168
+
169
+ res.order_data
170
+ end
171
+
172
+ def connection
173
+ @connection ||= Faraday.new do |faraday|
174
+ faraday.use Epics::XMLSIG, { client: self }
175
+ faraday.use Epics::ParseEbics, { client: self}
176
+ # faraday.response :logger # log requests to STDOUT
177
+ faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
178
+ end
179
+ end
180
+
181
+ def extract_keys
182
+ JSON.load(self.keys_content).each_with_object({}) do |(type, key), memo|
183
+ memo[type] = Epics::Key.new(decrypt(key)) if key
184
+ end
185
+ end
186
+
187
+ def dump_keys
188
+ JSON.dump(keys.each_with_object({}) {|(k,v),m| m[k]= encrypt(v.key.to_pem)})
189
+ end
190
+
191
+ def cipher
192
+ @cipher ||= OpenSSL::Cipher::Cipher.new("aes-256-cbc")
193
+ end
194
+
195
+ def encrypt(data)
196
+ salt = OpenSSL::Random.random_bytes(8)
197
+
198
+ setup_cipher(:encrypt, self.passphrase, salt)
199
+ Base64.strict_encode64([salt, cipher.update(data) + cipher.final].join)
200
+ end
201
+
202
+ def decrypt(data)
203
+ data = Base64.strict_decode64(data)
204
+ salt = data[0..7]
205
+ data = data[8..-1]
206
+
207
+ setup_cipher(:decrypt, self.passphrase, salt)
208
+ cipher.update(data) + cipher.final
209
+ end
210
+
211
+ def setup_cipher(method, passphrase, salt)
212
+ cipher.send(method)
213
+ cipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(passphrase, salt, 1, cipher.key_len)
214
+ end
215
+
216
+ end
@@ -0,0 +1,324 @@
1
+ class Epics::Error < StandardError
2
+ def to_s
3
+ [@error.fetch("symbol", "EPICS_UNKNOWN"), @error.fetch("short_text", "unknown")].join(" - ")
4
+ end
5
+
6
+ def initialize(code)
7
+ @code = code
8
+ @error = self.class::ERRORS.fetch(code, {})
9
+ end
10
+
11
+ class TechnicalError < self
12
+ ERRORS = {
13
+ "000000" => {
14
+ "symbol" => "EBICS_OK",
15
+ "short_text" => "OK",
16
+ "meaning" => "No technical errors occurred during processing of the EBICS request",
17
+ },
18
+ "011000" => {
19
+ "symbol" => "EBICS_DOWNLOAD_POSTPROCESS_DONE",
20
+ "short_text" => "Positive acknowledgement received",
21
+ "meaning" => "After receipt of a positive acknowledgement the download task was finished at the server's end and the EBICS transaction ended.",
22
+ },
23
+ "011001" => {
24
+ "symbol" => "EBICS_DOWNLOAD_POSTPROCESS_SKIPPED",
25
+ "short_text" => "Negative acknowledgement received",
26
+ "meaning" => "After receipt of a negative acknowledgement the transaction was ended at the server's end without finishing the download task",
27
+ },
28
+ "011101" => {
29
+ "symbol" => "EBICS_TX_SEGMENT_NUMBER_UNDERRUN",
30
+ "short_text" => "Segment number not reached",
31
+ "meaning" => "The total number of segments transmitted during transaction initialisation was not reached (i.e. the attribute @lastSegment was set to \"true\" before the specified segment number was reached)",
32
+ },
33
+ "031001" => {
34
+ "symbol" => "EBICS_ORDER_PARAMS_IGNORED",
35
+ "short_text" => "Unknown order parameters are ignored",
36
+ "meaning" => "E.g. OrderParams for Upload specified",
37
+ },
38
+ "061001" => {
39
+ "symbol" => "EBICS_AUTHENTICATION_FAILED",
40
+ "short_text" => "Authentication signature error",
41
+ "meaning" => "Verification of the authentication signature was not successful",
42
+ },
43
+ "061002" => {
44
+ "symbol" => "EBICS_INVALID_REQUEST",
45
+ "short_text" => "Message not EBICSconformant",
46
+ "meaning" => "The syntax of the received message does not conform with EBICS specifications",
47
+ },
48
+ "061099" => {
49
+ "symbol" => "EBICS_INTERNAL_ERROR",
50
+ "short_text" => "Internal EBICS error",
51
+ "meaning" => "An internal error occurred during",
52
+ },
53
+ "061101" => {
54
+ "symbol" => "EBICS_TX_RECOVERY_SYNC",
55
+ "short_text" => "Synchronisation necessary",
56
+ "meaning" => "Recovery of the transaction requires synchronisation between the customer system and the bank system Continuation of the transaction using the recovery point from the bank system's EBICS response",
57
+ },
58
+ "091002" => {
59
+ "symbol" => "EBICS_INVALID_USER_OR_USER_STATE",
60
+ "short_text" => "Subscriber unknown or subscriber state inadmissible",
61
+ "meaning" => "Either the initiating party is not known to the bank system or the subscriber state that is stored in the bank of the initiating party is inadmissible with regard to the order type",
62
+ },
63
+ "091003" => {
64
+ "symbol" => "EBICS_USER_UNKNOWN",
65
+ "short_text" => "Subscriber unknown",
66
+ "meaning" => "The initiating party is not known to the bank system",
67
+ },
68
+ "091004" => {
69
+ "symbol" => "EBICS_INVALID_USER_STATE",
70
+ "short_text" => "Subscriber state unknown",
71
+ "meaning" => "The subscriber state of the initiating party that is stored in the bank system is inadmissible with regard to the order type",
72
+ },
73
+ "091005" => {
74
+ "symbol" => "EBICS_INVALID_ORDER_TYPE",
75
+ "short_text" => "Order type inadmissible",
76
+ "meaning" => "The order type is unknown or not approved for use with EBICS",
77
+ },
78
+ "091006" => {
79
+ "symbol" => "EBICS_UNSUPPORTED_ORDER_TYPE",
80
+ "short_text" => "Order type not supported",
81
+ "meaning" => "The selected order type is optional with EBICS and is not supported by the financial institution",
82
+ },
83
+ "091007" => {
84
+ "symbol" => "EBICS_DISTRIBUTED_SIGNATURE_AUTHORISATION_FAILED",
85
+ "short_text" => "Subscriber possesses no authorisation of signature for the referenced order in the VEU administration (Request recent signature folder)",
86
+ "meaning" => "Retrieve recent signature folder with permissible orders of order type HVU (or HVZ, respectively)",
87
+ },
88
+ "091008" => {
89
+ "symbol" => "EBICS_BANK_PUBKEY_UPDATE_REQUIRED",
90
+ "short_text" => "Bank key invalid",
91
+ "meaning" => "The public bank key that is available to the subscriber is invalid",
92
+ },
93
+ "091009" => {
94
+ "symbol" => "EBICS_SEGMENT_SIZE_EXCEEDED",
95
+ "short_text" => "Segment size exceeded",
96
+ "meaning" => "The specified size of an upload order data segment (in the case of H003: 1 MB) has been exceeded",
97
+ },
98
+ "091010" => {
99
+ "symbol" => "EBICS_INVALID_XML",
100
+ "short_text" => "XML invalid according to EBICS XML schema",
101
+ "meaning" => "XML validation with EBICS schema failed or XML not well-formed",
102
+ },
103
+ "091011" => {
104
+ "symbol" => "EBICS_INVALID_HOST_ID",
105
+ "short_text" => "The transmitted HostID is unknown on the bank's side",
106
+ "meaning" => "The transmitted HostID is unknown on the bank's side. The use of this code is only provided for the HEV request Check the used HostID and correct it. Consultation with the bank, if necessary",
107
+ },
108
+ "091101" => {
109
+ "symbol" => "EBICS_TX_UNKNOWN_TXID",
110
+ "short_text" => "Transaction ID invalid",
111
+ "meaning" => "The supplied transaction ID is invalid",
112
+ },
113
+ "091102" => {
114
+ "symbol" => "EBICS_TX_ABORT",
115
+ "short_text" => "Transaction cancelled",
116
+ "meaning" => "The transaction was cancelled at the server's end since recovery of the transaction is not supported or is no longer possible due to the recovery counter being too high",
117
+ },
118
+ "091103" => {
119
+ "symbol" => "EBICS_TX_MESSAGE_REPLAY",
120
+ "short_text" => "Suspected Message replay (wrong time/time zone or nonce error)",
121
+ "meaning" => "A message replay has been identified (Nonce/Timestamp pair doubled) or the difference of clock time between client and server exceeds the (parametrisable) tolerance limit",
122
+ },
123
+ "091104" => {
124
+ "symbol" => "EBICS_TX_SEGMENT_NUMBER_EXCEEDED",
125
+ "short_text" => "Segment number exceeded",
126
+ "meaning" => "The total segment number from transaction initialisation was exceeded, i.e. the attribute @lastSegment was set to \"false\" when the last segment was transmitted",
127
+ },
128
+ "091112" => {
129
+ "symbol" => "EBICS_INVALID_ORDER_PARAMS",
130
+ "short_text" => "Invalid order parameters",
131
+ "meaning" => "The content of OrderParams is invalid, e.g. if starting off behind the end in case of StandardOrderParams, or, in case of HVT, fetchOffset is higher than NumOrderInfos (total number of particular order information of an order)",
132
+ },
133
+ "091113" => {
134
+ "symbol" => "EBICS_INVALID_REQUEST_CONTENT",
135
+ "short_text" => "Message content semantically not compliant to EBICS",
136
+ "meaning" => "The received message complies syntactically EBICS XML schema, but not semantically to the EBICS guidelines, e.g. IZV upload with UZHNN requires NumSegments = 0",
137
+ },
138
+ "091117" => {
139
+ "symbol" => "EBICS_MAX_ORDER_DATA_SIZE_EXCEEDED",
140
+ "short_text" => "The bank system does not support the requested order size",
141
+ "meaning" => "Upload or download of an order file of improper size (e.g. for HVT, IZV, STA)",
142
+ },
143
+ "091118" => {
144
+ "symbol" => "EBICS_MAX_SEGMENTS_EXCEEDED",
145
+ "short_text" => "Submitted number of segments for upload is too high",
146
+ "meaning" => "The bank system does not support the specified total number of segments for upload",
147
+ },
148
+ "091119" => {
149
+ "symbol" => "EBICS_MAX_TRANSACTIONS_EXCEEDED",
150
+ "short_text" => "Maximum number of parallel transactions per customer is exceeded",
151
+ "meaning" => "The maximum number of parallel EBICS transactions defined in the bank system for the customer has been exceeded",
152
+ },
153
+ "091120" => {
154
+ "symbol" => "EBICS_PARTNER_ID_MISMATCH",
155
+ "short_text" => "The partner ID (=customer ID) of the ES file is not identical to the partner ID (=customer ID) of the submitter.",
156
+ "meaning" => "On verifying the submitted signatures a partner ID was found in the document UserSignatureData that is not identical to the subscriber's partner ID in the request header",
157
+ },
158
+ "091121" => {
159
+ "symbol" => "EBICS_INCOMPATIBLE_ORDER_ATTRIBUTE",
160
+ "short_text" => "The specified order attribute is not compatible with the order in the bank system",
161
+ "meaning" => "Case 1) File with order attribute \"DZHNN\" or \"OZHNN\" submitted with an orderId or Case 2) File with order attribute \"UZHNN\" submitted without an orderId or with orderID which is already used for \"DZHNN\" File with order attribute \"DZHNN\" submitted with an orderId",
162
+ }
163
+ }
164
+ end
165
+
166
+ class BusinessError < self
167
+ ERRORS = {
168
+ "000000" => {
169
+ "symbol" => "EBICS_OK",
170
+ "short_text" => "OK",
171
+ "meaning" => "No technical errors occurred during processing of the EBICS request",
172
+ },
173
+ "011301" => {
174
+ "symbol" => "EBICS_NO_ONLINE_CHECKS",
175
+ "short_text" => "Optional preliminary verification is not supported by the bank system"
176
+ },
177
+ "091001" => {
178
+ "symbol" => "EBICS_DOWNLOAD_SIGNED_ONLY",
179
+ "short_text" => "The bank system only supports bank-technically signed download order data for the order in question"
180
+ },
181
+ "091002" => {
182
+ "symbol" => "EBICS_DOWNLOAD_UNSIGNED_ONLY",
183
+ "short_text" => "The bank system only supports unsigned download order data for the order in question"
184
+ },
185
+ "090003" => {
186
+ "symbol" => "EBICS_AUTHORISATION_ORDER_TYPE_FAILED",
187
+ "short_text" => "The subscriber is not entitled to submit orders of the selected order type"
188
+ },
189
+ "090004" => {
190
+ "symbol" => "EBICS_INVALID_ORDER_DATA_FORMAT",
191
+ "short_text" => "The transferred order data does not correspond with the specified format"
192
+ },
193
+ "090005" => {
194
+ "symbol" => "EBICS_NO_DOWNLOAD_DATA_AVAILABLE",
195
+ "short_text" => "No data are available at present for the selected download order type"
196
+ },
197
+ "090006" => {
198
+ "symbol" => "EBICS_UNSUPPORTED_REQUEST_FOR_ORDER_INSTANCE",
199
+ "short_text" => "The bank system does not support the selected order request for the concrete business transaction associated with this order"
200
+ },
201
+ "091105" => {
202
+ "symbol" => "EBICS_RECOVERY_NOT_SUPPORTED",
203
+ "short_text" => "The bank system does not support Recovery"
204
+ },
205
+ "091111" => {
206
+ "symbol" => "EBICS_INVALID_SIGNATURE_FILE_FORMAT",
207
+ "short_text" => "The submitted ES files do not comply with the defined format The ES file cannot be parsed syntactically (no business-related verification!)"
208
+ },
209
+ "091114" => {
210
+ "symbol" => "EBICS_ORDERID_UNKNOWN",
211
+ "short_text" => "The submitted order number is unknown"
212
+ },
213
+ "091115" => {
214
+ "symbol" => "EBICS_ORDERID_ALREADY_EXISTS",
215
+ "short_text" => "The submitted order number is already existent"
216
+ },
217
+ "091116" => {
218
+ "symbol" => "EBICS_PROCESSING_ERROR",
219
+ "short_text" => "During processing of the EBICS request, other business-related errors have ocurred"
220
+ },
221
+ "091201" => {
222
+ "symbol" => "EBICS_KEYMGMT_UNSUPPORTED_VERSION_SIGNATURE",
223
+ "short_text" => "The algorithm version of the bank-technical signature key is not supported by the financial institution (order types INI, HCS and PUB)"
224
+ },
225
+ "091202" => {
226
+ "symbol" => "EBICS_KEYMGMT_UNSUPPORTED_VERSION_AUTHENTICATION",
227
+ "short_text" => "The algorithm version of theauthentication key is notsupported by the financialinstitution (order types HIA,HSA and HCA)"
228
+ },
229
+ "091203" => {
230
+ "symbol" => "EBICS_KEYMGMT_UNSUPPORTED_VERSION_ENCRYPTION",
231
+ "short_text" => "The algorithm version of the encryption key is not supported by the financial institution (order types HIA, HSA and HCA) This error message is returned particularly when the process ID E001 is used which is invalid from schema version H003 on"
232
+ },
233
+ "091204" => {
234
+ "symbol" => "EBICS_KEYMGMT_KEYLENGTH_ERROR_SIGNATURE",
235
+ "short_text" => "The key length of the banktechnical signature key is not supported by the financial institution (order types INI and PUB or HCS)"
236
+ },
237
+ "091205" => {
238
+ "symbol" => "EBICS_KEYMGMT_KEYLENGTH_ERROR_AUTHENTICATION",
239
+ "short_text" => "The key length of the authentication key is not supported by the financial institution (order types HIA, HSA, HCS and HCA)"
240
+ },
241
+ "091206" => {
242
+ "symbol" => "EBICS_KEYMGMT_KEYLENGTH_ERROR_ENCRYPTION",
243
+ "short_text" => "The key length of the encryption key is not supported by the financial institution (order types HIA, HSA, HCS and HCA)"
244
+ },
245
+ "091207" => {
246
+ "symbol" => "EBICS_KEYMGMT_NO_X509_SUPPORT",
247
+ "short_text" => "The bank system does not support the evaluation of X.509 data (order types INI, HIA, HSA, PUB, HCA, HCS)"
248
+ },
249
+ "091208" => {
250
+ "symbol" => "EBICS_X509_CERTIFICATE_EXPIRED",
251
+ "short_text" => "certificate is not valid because it has expired"
252
+ },
253
+ "091209" => {
254
+ "symbol" => "EBICS_X509_ERTIFICATE_NOT_VALID_YET",
255
+ "short_text" => "certificate is not valid because it is not yet in effect"
256
+ },
257
+ "091210" => {
258
+ "symbol" => "EBICS_X509_WRONG_KEY_USAGE",
259
+ "short_text" => "When verifying the certificate key usage, it has been detected that the certificate has not been issued for the current use. (only applies when key management order types are used)"
260
+ },
261
+ "091211" => {
262
+ "symbol" => "EBICS_X509_WRONG_ALGORITHM",
263
+ "short_text" => "When verifying the certificate algorithm, it has been detected that the certificate has not been issued for the current use. (only applies when key management order types are used)"
264
+ },
265
+ "091212" => {
266
+ "symbol" => "EBICS_X509_INVALID_THUMBPRINT",
267
+ "short_text" => "Reserved for next version"
268
+ },
269
+ "091213" => {
270
+ "symbol" => "EBICS_X509_CTL_INVALID",
271
+ "short_text" => "When verifying the certificate, it has been detected that the certificate trust list (CTL) is not valid because, for example, it has expired."
272
+ },
273
+ "091214" => {
274
+ "symbol" => "EBICS_X509_UNKNOWN_CERTIFICATE_AUTHORITY",
275
+ "short_text" => "The chain cannot be verified due to an unknown certificate authority (CA) If OrderType = INI, PUB or HCS and X509v3 supported: The Reject of the Request is mandatory, if signature class <> \"T\""
276
+ },
277
+ "091215" => {
278
+ "symbol" => "EBICS_X509_INVALID_POLICY",
279
+ "short_text" => "Reserved for next version"
280
+ },
281
+ "091216" => {
282
+ "symbol" => "EBICS_X509_INVALID_BASIC_CONSTRAINTS",
283
+ "short_text" => "Reserved for next version"
284
+ },
285
+ "091217" => {
286
+ "symbol" => "EBICS_ONLY_X509_SUPPORT",
287
+ "short_text" => "With respect to certificates, the bank system only supports the evaluation of X.509 data"
288
+ },
289
+ "091218" => {
290
+ "symbol" => "EBICS_KEYMGMT_DUPLICATE_KEY",
291
+ "short_text" => "During the key management request, it has been detected that the key or certificate sent for authentication or for encryption is the same as the signature key/certificate (INI, HIA, PUB, HCS,..)"
292
+ },
293
+ "091219" => {
294
+ "symbol" => "EBICS_CERTIFICATES_VALIDATION_ERROR",
295
+ "short_text" => "The server is unable to match the certificate (ES key) with the previously declared information automatically."
296
+ },
297
+ "091301" => {
298
+ "symbol" => "EBICS_SIGNATURE_VERIFICATION_FAILED",
299
+ "short_text" => "Verification of the ES has failed In the case of asynchronouslyimplemented orders, the error can occur during preliminary verification."
300
+ },
301
+ "091302" => {
302
+ "symbol" => "EBICS_ACCOUNT_AUTHORISATION_FAILED",
303
+ "short_text" => "Preliminary verification of the account authorisation has failed"
304
+ },
305
+ "091303" => {
306
+ "symbol" => "EBICS_AMOUNT_CHECK_FAILED",
307
+ "short_text" => "Preliminary verification of the account amount limit has failed"
308
+ },
309
+ "091304" => {
310
+ "symbol" => "EBICS_SIGNER_UNKNOWN",
311
+ "short_text" => "A signatory of the order in question is not a valid subscriber."
312
+ },
313
+ "091305" => {
314
+ "symbol" => "EBICS_INVALID_SIGNER_STATE",
315
+ "short_text" => "The state of a signatory in the order in question is not admissible."
316
+ },
317
+ "091306" => {
318
+ "symbol" => "EBICS_DUPLICATE_SIGNATURE",
319
+ "short_text" => "The signatory has already signed the order on hand."
320
+ }
321
+ }
322
+ end
323
+
324
+ end