epics 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36e7870a631e71236b0c9379770056d5c9c8d08f
4
- data.tar.gz: 59d5dfe38c22a0d71fc1b9a700bb145fa4f1059c
3
+ metadata.gz: af6bf6d6425c258c08814fc2c1c3b9a3b3073123
4
+ data.tar.gz: 1ee5bef16a6bf11f34f8aa60a79f3b11d8875122
5
5
  SHA512:
6
- metadata.gz: eb1d40e580bf49be94aba0618a2146113cecc2781f60a4a37a79650a5afd479e09ab459568cca018faf7b2adfab741af7f6184c82934d2fb01ac673423cef458
7
- data.tar.gz: 6d58b9dc15721089a511f908896b5c5b60a9628171fe0edb70f702b53a5a7346d788974c54e2ef50a46434c7906cf5190908ccf0e8d8095256df0221e87026f0
6
+ metadata.gz: 1afc8a8f34f6cde89869f5a5c4a24b09ae3bcb111da63ef81f97823fc187fa67120f86b0343c54a8841f4c43654e7be27b44804ca87ed479f3c27f6666d5ca6b
7
+ data.tar.gz: f57a864a565b4bd70731cde527052f5d17c6e304542f26a7937321e7045136ca53424287c082e132d870df0158c73cee4696873fd8fb815bfc90ac30549d9f32
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ ### 1.1.0
2
+
3
+ * [BUGFIX] Sending `Receipts` after downloading data, to circumvent download locks
4
+ * [BUGFIX] adding missing require statements
5
+ * adding HAC, HKD, C52 and C53 support
6
+ * less verbose object inspection for `Epics::Client`
7
+ * readme polishing
8
+
9
+ ### 1.0.0
10
+
11
+ * first release
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
- [![Build Status](https://magnum.travis-ci.com/railslove/epics.svg?token=EhFJyZWe1sxdBDmF2bzC&branch=master)](https://magnum.travis-ci.com/railslove/epics)
1
+ [![Build Status](https://travis-ci.org/railslove/epics.svg?branch=master)](https://travis-ci.org/railslove/epics)
2
+ [![Gem Version](https://badge.fury.io/rb/epics.svg)](http://badge.fury.io/rb/epics)
2
3
 
3
4
  # Epics
4
5
 
5
6
  EPICS is a ruby implementation of the [EBICS](http://www.ebics.org/) (Electronic Banking Internet Communication Standard)
6
7
 
8
+ The client support the complete initialization process comprising INI, HIA and HPB including the INI letter generation. It offers support for the most common download and upload order types (STA HAA HTD HPD PKT HAC HKD C52 C53 CD1 CDD CCT)
7
9
 
8
10
 
9
11
  ## Installation
@@ -14,10 +16,6 @@ Add this line to your application's Gemfile:
14
16
  gem 'epics'
15
17
  ```
16
18
 
17
- And then execute:
18
-
19
- $ bundle
20
-
21
19
  Or install it yourself as:
22
20
 
23
21
  $ gem install epics
@@ -94,6 +92,13 @@ e.HAA
94
92
 
95
93
  To get a list of all supported order types.
96
94
 
95
+
96
+ ## Need help? Having questions?
97
+
98
+ We have many years of experience in developing innovative applications for the finance sector and integration application with financial institutions. - you might want to have a look at our [portfolio](http://www.railslove.com/portfolio)
99
+ __If you need help we are happy to provide consulting or development services. Contact us: [team@railslove.com](mailto:team@railslove.com)__
100
+
101
+
97
102
  ## Usage
98
103
 
99
104
  ### Create a client
@@ -108,17 +113,6 @@ keys = File.read('/tmp/my.key')
108
113
  e = Epics::Client.new(keys, 'passphrase', 'url', 'host', 'user', 'partner')
109
114
  ```
110
115
 
111
- ### Lazy Mode
112
-
113
- Once you have a client, go ahead and start playing! There are 3 convinence methods
114
- that are hiding some strange names from you:
115
-
116
- * debit( _xml_ ) (submits a PAIN.008.003.02 document via CDD)
117
- * credit( _xml_ ) (submits a pain.001.003.03 document)
118
- * statements( _from_, _to_ ) (fetches an account statement via STA)
119
-
120
- If you need more sophisticated EBICS order types, please read the next section
121
- about the supported functionalities.
122
116
 
123
117
  ## Features
124
118
 
@@ -137,6 +131,7 @@ Currently this EPICS implementation supports the following order types:
137
131
  * HTD (user properties and settings)
138
132
  * HPD (the available bank parameters)
139
133
  * PKT (customer usage report in text format)
134
+ * HAC (customer usage report in xml format)
140
135
  * ... more coming soon
141
136
 
142
137
  Example:
@@ -177,14 +172,50 @@ puts e.CD1("i-am-a-PAIN-xml-file")
177
172
  # res is a the transaction id of the order
178
173
  ```
179
174
 
175
+ ### Lazy Mode
176
+
177
+ Once you have a client, go ahead and start playing! There are 3 convinence methods
178
+ that are hiding some strange names from you:
179
+
180
+ * debit( _xml_ ) (submits a PAIN.008.003.02 document via CDD)
181
+ * credit( _xml_ ) (submits a pain.001.003.03 document)
182
+ * statements( _from_, _to_ ) (fetches an account statement via STA)
183
+
184
+ If you need more sophisticated EBICS order types, please read the next section
185
+ about the supported functionalities.
186
+
187
+
188
+ ## Issues and Feature Requests
189
+
190
+ [Railslove](http://railslove.com) is commited to provide the best developer tools for integrating with financial institutions. Epics is one of our many tools and services.
191
+ If you are missing some features or something is not working as expected please create an issue.
192
+
193
+
194
+
180
195
  ## Supported Banks
181
196
 
197
+ This gem provides a full implementation of the Electronic Banking Internet Communication Standard and works with any bank that supports this standard. Please ask your bank if they support EBICS and what order types are available.
198
+
199
+ Besides EBCIS being a standard, some server implementations are slighty different.
200
+ Is Epics working with your institution?
201
+ Please help us to grow this list of supported banks:
202
+
182
203
  * Sofortbank
183
204
  * Deutsche Bank
205
+ * Sparkasse KölnBonn
206
+
207
+
208
+ ## Links
209
+
210
+ * [ebics.de](http://www.ebics.de/)
211
+ * [EBICS specification](http://www.ebics.de/index.php?id=30)
212
+ * [Common Integrative Implementation Guide to Supplement the EBICS Specification (pdf)](http://www.ebics.de/fileadmin/unsecured/specification/implementation_guide_DE/EBICS_Common_IG_basiert_auf_EBICS_2.5.pdf)
213
+ * [Die Deutsche Kreditwirtschaft](http://www.die-deutsche-kreditwirtschaft.de/)
214
+
184
215
 
185
216
  ## Contributing
186
217
 
187
- 0. Contact team@raislove.com for information about howto CLA
218
+ 0. Contact team@railslove.com for information about the CLA
188
219
  1. Fork it ( https://github.com/[my-github-username]/epics/fork )
189
220
  2. Create your feature branch (`git checkout -b my-new-feature`)
190
221
  3. Commit your changes (`git commit -am 'Add some feature'`)
@@ -192,6 +223,5 @@ puts e.CD1("i-am-a-PAIN-xml-file")
192
223
  5. Create a new Pull Request
193
224
 
194
225
 
195
-
196
-
197
- made with love by [railslove](http://www.railslove.com)
226
+ ------------
227
+ 2014 - built with love by [Railslove](http://railslove.com) and released under the [GNU LESSER GENERAL PUBLIC LICENSE](https://github.com/railslove/epics/blob/master/LICENSE.txt). We have built quite a number of FinTech products. If you need support we are happy to help. Please contact us at team@railslove.com.
data/epics.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  including the INI letter generation.
17
17
 
18
18
  Furthermore it offers support for the most common download types:
19
- STA HAA HTD HPD PKT
19
+ STA HAA HTD HPD PKT HAC HKD C52 C53
20
20
 
21
21
  And the following upload orders:
22
22
  CD1 CDD CCT
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.post_install_message += "Railslove as the maintainer is commited to provide extensive developer tools to make integrating financial institutions fun and easy.\n"
37
37
  spec.post_install_message += "Please create an issue on github (railslove/epics) if anything does not work as expected. And contact team@railslove.com if you are looking for support with your integration.\n"
38
38
  spec.post_install_message += "\e[32m" + ("*" * 60) + "\n\e[0m"
39
-
39
+
40
40
  spec.add_dependency "nokogiri"
41
41
  spec.add_dependency "gyoku"
42
42
  spec.add_dependency "faraday"
data/lib/epics.rb CHANGED
@@ -5,7 +5,8 @@ require 'json'
5
5
  require 'nokogiri'
6
6
  require 'gyoku'
7
7
  require 'faraday'
8
-
8
+ require 'securerandom'
9
+ require 'time'
9
10
  require "epics/version"
10
11
  require "epics/key"
11
12
  require "epics/mgf"
@@ -16,10 +17,14 @@ require "epics/middleware/parse_ebics"
16
17
  require "epics/generic_request"
17
18
  require "epics/generic_upload_request"
18
19
  require "epics/hpb"
20
+ require "epics/hkd"
19
21
  require "epics/htd"
20
22
  require "epics/haa"
21
23
  require "epics/sta"
24
+ require "epics/c52"
25
+ require "epics/c53"
22
26
  require "epics/ptk"
27
+ require "epics/hac"
23
28
  require "epics/hpd"
24
29
  require "epics/cd1"
25
30
  require "epics/cct"
data/lib/epics/c52.rb ADDED
@@ -0,0 +1,52 @@
1
+ class Epics::C52 < Epics::GenericRequest
2
+ attr_accessor :from, :to
3
+
4
+ def initialize(client, from, to)
5
+ super(client)
6
+ self.from = from
7
+ self.to = to
8
+ end
9
+
10
+ def header
11
+ {
12
+ :@authenticate => true,
13
+ static: {
14
+ "HostID" => host_id,
15
+ "Nonce" => nonce,
16
+ "Timestamp" => timestamp,
17
+ "PartnerID" => partner_id,
18
+ "UserID" => user_id,
19
+ "Product" => {
20
+ :@Language => "de",
21
+ :content! => "EPICS - a ruby ebics kernel"
22
+ },
23
+ "OrderDetails" => {
24
+ "OrderType" => "C52",
25
+ "OrderAttribute" => "DZHNN",
26
+ "StandardOrderParams" => {
27
+ "DateRange" => {
28
+ "Start" => from,
29
+ "End" => to
30
+ }
31
+ }
32
+ },
33
+ "BankPubKeyDigests" => {
34
+ "Authentication" => {
35
+ :@Version => "X002",
36
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
37
+ :content! => client.bank_x.public_digest
38
+ },
39
+ "Encryption" => {
40
+ :@Version => "E002",
41
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
42
+ :content! => client.bank_e.public_digest
43
+ }
44
+ },
45
+ "SecurityMedium" => "0000"
46
+ },
47
+ "mutable" => {
48
+ "TransactionPhase" => "Initialisation"
49
+ }
50
+ }
51
+ end
52
+ end
data/lib/epics/c53.rb ADDED
@@ -0,0 +1,52 @@
1
+ class Epics::C53 < Epics::GenericRequest
2
+ attr_accessor :from, :to
3
+
4
+ def initialize(client, from, to)
5
+ super(client)
6
+ self.from = from
7
+ self.to = to
8
+ end
9
+
10
+ def header
11
+ {
12
+ :@authenticate => true,
13
+ static: {
14
+ "HostID" => host_id,
15
+ "Nonce" => nonce,
16
+ "Timestamp" => timestamp,
17
+ "PartnerID" => partner_id,
18
+ "UserID" => user_id,
19
+ "Product" => {
20
+ :@Language => "de",
21
+ :content! => "EPICS - a ruby ebics kernel"
22
+ },
23
+ "OrderDetails" => {
24
+ "OrderType" => "C53",
25
+ "OrderAttribute" => "DZHNN",
26
+ "StandardOrderParams" => {
27
+ "DateRange" => {
28
+ "Start" => from,
29
+ "End" => to
30
+ }
31
+ }
32
+ },
33
+ "BankPubKeyDigests" => {
34
+ "Authentication" => {
35
+ :@Version => "X002",
36
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
37
+ :content! => client.bank_x.public_digest
38
+ },
39
+ "Encryption" => {
40
+ :@Version => "E002",
41
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
42
+ :content! => client.bank_e.public_digest
43
+ }
44
+ },
45
+ "SecurityMedium" => "0000"
46
+ },
47
+ "mutable" => {
48
+ "TransactionPhase" => "Initialisation"
49
+ }
50
+ }
51
+ end
52
+ end
data/lib/epics/client.rb CHANGED
@@ -16,6 +16,13 @@ class Epics::Client
16
16
  self.partner_id = partner_id
17
17
  end
18
18
 
19
+ def inspect
20
+ "#<#{self.class}:#{self.object_id}
21
+ @keys=#{self.keys.keys},
22
+ @user_id=#{self.user_id},
23
+ @partner_id=#{self.partner_id}"
24
+ end
25
+
19
26
  def e
20
27
  keys["E002"]
21
28
  end
@@ -124,6 +131,14 @@ class Epics::Client
124
131
  download(Epics::STA, from, to)
125
132
  end
126
133
 
134
+ def C52(from, to)
135
+ download(Epics::C52, from, to)
136
+ end
137
+
138
+ def C53(from, to)
139
+ download(Epics::C53, from, to)
140
+ end
141
+
127
142
  def HAA
128
143
  Nokogiri::XML(download(Epics::HAA)).at_xpath("//xmlns:OrderTypes").content.split(/\s/)
129
144
  end
@@ -140,10 +155,18 @@ class Epics::Client
140
155
  download(Epics::HPD)
141
156
  end
142
157
 
158
+ def HKD
159
+ download(Epics::HKD)
160
+ end
161
+
143
162
  def PTK(from, to)
144
163
  download(Epics::PTK, from, to)
145
164
  end
146
165
 
166
+ def HAC(from, to)
167
+ download(Epics::HAC, from, to)
168
+ end
169
+
147
170
  def save_keys(path)
148
171
  File.write(path, dump_keys)
149
172
  end
@@ -152,9 +175,7 @@ class Epics::Client
152
175
 
153
176
  def upload(order_type, document)
154
177
  order = order_type.new(self, document)
155
-
156
178
  res = post(url, order.to_xml).body
157
-
158
179
  order.transaction_id = res.transaction_id
159
180
 
160
181
  res = post(url, order.to_transfer_xml).body
@@ -165,6 +186,11 @@ class Epics::Client
165
186
  def download(order_type, *args)
166
187
  document = order_type.new(self, *args)
167
188
  res = post(url, document.to_xml).body
189
+ document.transaction_id = res.transaction_id
190
+
191
+ if res.segmented? && res.last_segment?
192
+ post(url, document.to_receipt_xml).body
193
+ end
168
194
 
169
195
  res.order_data
170
196
  end
@@ -1,6 +1,7 @@
1
1
  class Epics::GenericRequest
2
2
  extend Forwardable
3
3
  attr_accessor :client
4
+ attr_accessor :transaction_id
4
5
 
5
6
  def initialize(client)
6
7
  self.client = client
@@ -81,6 +82,34 @@ class Epics::GenericRequest
81
82
  }), nil, "utf-8").to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
82
83
  end
83
84
 
85
+ def to_receipt_xml
86
+ Nokogiri::XML.parse(Gyoku.xml({
87
+ root => {
88
+ :"@xmlns:ds" => "http://www.w3.org/2000/09/xmldsig#",
89
+ :@xmlns => "urn:org:ebics:H004",
90
+ :@Version => "H004",
91
+ :@Revision => "1",
92
+ "header" => {
93
+ :@authenticate => true,
94
+ "static" => {
95
+ "HostID" => host_id,
96
+ "TransactionID" => transaction_id
97
+ },
98
+ "mutable" => {
99
+ "TransactionPhase" => "Receipt"
100
+ }
101
+ },
102
+ "AuthSignature" => auth_signature,
103
+ "body" => {
104
+ "TransferReceipt" => {
105
+ :@authenticate => true,
106
+ "ReceiptCode" => 0
107
+ }
108
+ }
109
+ }
110
+ }), nil, "utf-8").to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
111
+ end
112
+
84
113
  def to_xml
85
114
  Nokogiri::XML.parse(Gyoku.xml( {
86
115
  root => {
@@ -2,7 +2,6 @@ class Epics::GenericUploadRequest < Epics::GenericRequest
2
2
 
3
3
  attr_accessor :key
4
4
  attr_accessor :document
5
- attr_accessor :transaction_id
6
5
 
7
6
  def initialize(client, document)
8
7
  super(client)
data/lib/epics/hac.rb ADDED
@@ -0,0 +1,52 @@
1
+ class Epics::HAC < Epics::GenericRequest
2
+ attr_accessor :from, :to
3
+
4
+ def initialize(client, from, to)
5
+ super(client)
6
+ self.from = from
7
+ self.to = to
8
+ end
9
+
10
+ def header
11
+ {
12
+ :@authenticate => true,
13
+ static: {
14
+ "HostID" => host_id,
15
+ "Nonce" => nonce,
16
+ "Timestamp" => timestamp,
17
+ "PartnerID" => partner_id,
18
+ "UserID" => user_id,
19
+ "Product" => {
20
+ :@Language => "de",
21
+ :content! => "EPICS - a ruby ebics kernel"
22
+ },
23
+ "OrderDetails" => {
24
+ "OrderType" => "HAC",
25
+ "OrderAttribute" => "DZHNN",
26
+ "StandardOrderParams" => {
27
+ "DateRange" => {
28
+ "Start" => from,
29
+ "End" => to
30
+ }
31
+ }
32
+ },
33
+ "BankPubKeyDigests" => {
34
+ "Authentication" => {
35
+ :@Version => "X002",
36
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
37
+ :content! => client.bank_x.public_digest
38
+ },
39
+ "Encryption" => {
40
+ :@Version => "E002",
41
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
42
+ :content! => client.bank_e.public_digest
43
+ }
44
+ },
45
+ "SecurityMedium" => "0000"
46
+ },
47
+ "mutable" => {
48
+ "TransactionPhase" => "Initialisation"
49
+ }
50
+ }
51
+ end
52
+ end
data/lib/epics/hkd.rb ADDED
@@ -0,0 +1,40 @@
1
+ class Epics::HKD < Epics::GenericRequest
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" => "HKD",
18
+ "OrderAttribute" => "DZHNN",
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
+ },
35
+ "mutable" => {
36
+ "TransactionPhase" => "Initialisation"
37
+ }
38
+ }
39
+ end
40
+ end
@@ -8,7 +8,7 @@ class Epics::Response
8
8
  end
9
9
 
10
10
  def technical_error?
11
- technical_code != "000000"
11
+ !["011000", "000000"].include?(technical_code)
12
12
  end
13
13
 
14
14
  def technical_code
@@ -16,7 +16,7 @@ class Epics::Response
16
16
  end
17
17
 
18
18
  def business_error?
19
- business_code != "000000" && business_code != ""
19
+ !["", "000000"].include?(business_code)
20
20
  end
21
21
 
22
22
  def business_code
@@ -27,6 +27,14 @@ class Epics::Response
27
27
  !technical_error? & !business_error?
28
28
  end
29
29
 
30
+ def last_segment?
31
+ !!doc.at_xpath("//xmlns:header/xmlns:mutable/*[@lastSegment='true']")
32
+ end
33
+
34
+ def segmented?
35
+ !!doc.at_xpath("//xmlns:header/xmlns:mutable/xmlns:SegmentNumber")
36
+ end
37
+
30
38
  def return_code
31
39
  doc.xpath("//xmlns:ReturnCode").last.content
32
40
  rescue NoMethodError
@@ -38,7 +46,7 @@ class Epics::Response
38
46
  end
39
47
 
40
48
  def transaction_id
41
- doc.xpath("//xmlns:TransactionID").first.content
49
+ doc.xpath("//xmlns:header/xmlns:static/xmlns:TransactionID").text
42
50
  end
43
51
 
44
52
  def digest_valid?
data/lib/epics/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Epics
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
data/spec/client_spec.rb CHANGED
@@ -22,6 +22,14 @@ RSpec.describe Epics::Client do
22
22
 
23
23
  end
24
24
 
25
+ describe '#inspect' do
26
+ it 'will not print the complete object' do
27
+ expect(subject.inspect).to include("@keys=#{subject.keys.keys}")
28
+ expect(subject.inspect).to include("@user_id=#{subject.user_id}")
29
+ expect(subject.inspect).to include("@partner_id=#{subject.partner_id}")
30
+ end
31
+ end
32
+
25
33
  describe '#e' do
26
34
  it 'the encryption key' do
27
35
  expect(subject.e.public_digest).to eq("rwIxSUJAVEFDQ0sdYe+CybdspMllDG6ArNtdCzUbT1E=")
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ebicsResponse xmlns="urn:org:ebics:H004" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:org:ebics:H004 http://www.ebics.org/H004/ebics_response_H004.xsd" Version="H004" Revision="1">
3
+ <header authenticate="true">
4
+ <static>
5
+ <TransactionID>ECD6F062AAEDFA77250526A68CBEC549</TransactionID>
6
+ <NumSegments>1</NumSegments>
7
+ </static>
8
+ <mutable>
9
+ <TransactionPhase>Initialisation</TransactionPhase>
10
+ <SegmentNumber lastSegment="true">1</SegmentNumber>
11
+ <ReturnCode>000000</ReturnCode>
12
+ <ReportText>[EBICS_OK] OK</ReportText>
13
+ </mutable>
14
+ </header>
15
+ <AuthSignature>
16
+ <ds:SignedInfo>
17
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
18
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
19
+ <ds:Reference URI="#xpointer(//*[@authenticate='true'])">
20
+ <ds:Transforms>
21
+ <ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
22
+ </ds:Transforms>
23
+ <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
24
+ <ds:DigestValue>OnY4VczV+1XfplpMS/SCKFWn+FDMge40X8TJ9pA6HEI=</ds:DigestValue>
25
+ </ds:Reference>
26
+ </ds:SignedInfo>
27
+ <ds:SignatureValue>Qiz8clr/Ym+wLpB8CzTuxKP5rgIR2P4SaX8O4gGZx0Di8Lzd4hsBO3koqIuX11NRZo0RYA5E/IKQCoYLepkcM4QHvLT37YidbrXsTZe6cml/yF8OdyRAcd/9U7AoA9GKENFk4lnBFfZYmM4ADK6wVOCE/ABaOk0NeCDDbxrKA75tfTxwxTvQBfUOHZ87LrZxuQf//L9pzmtI07/7GbsQX8ZceQq40SpBFZn/oRvT/Q38Qu2ZO59MZexJn+BTzlhpfv9fQGF/sgXkdhUkPTEW3nL4j7ehasq3CtySGO2RnEppohEvJ4m07RDtEY3OWyAAZoPFVpvnECM6pOLbIuR40w==</ds:SignatureValue>
28
+ </AuthSignature>
29
+ <body>
30
+ <DataTransfer>
31
+ <DataEncryptionInfo authenticate="true">
32
+ <EncryptionPubKeyDigest Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" Version="E002">IUW05JB5cuCzRYYa4kIAZ2ehYVrLI3lKvxZvo1uP+ug=</EncryptionPubKeyDigest>
33
+ <TransactionKey>CPdd6ODXrCxHWpYrwS/5a3NIZ1R2SDscHHJSONc2I7g8ara7qv5Ra7H03W+336DPQLZQxH+EBRWdE2FQ1vrVTcypK6fkFarmO1dEtQt6Ka89AozC7aQMyp4yGl+zlF+XvFkJXZbRXgoEOPsgcG0xM6nKLXnr1ThYRFOoAasigLDGwqxliyhoR94F9dL7YB8Le/uZeRj78mNp4smkE5ZKKyPhwVx+0IW78YuVCSC2c2qbsMmm4evAvycdpLfuuoG4KVlNMIlvkKeBfMZFELcmeKKm85D2zPYkZ7cqG2IfAAp5qdS6K8P7RY4gtjUhOtP5mi8bZt/ZcjioUmIR9dAMnA==</TransactionKey>
34
+ </DataEncryptionInfo>
35
+ <OrderData>lJ/v1HvOYAZKTPkxULH4mOcUy01+EaAsxLzCPhtieAo9m5AtU5URdyBVfmclHbtWe3ELb02lR37bChynq0Esqpljxx7CiB+kl/bVs7XkNQQmtGPlh08O7ApJ7AHdKPFFvE+SM2OWpSwUrqJGtmyaU6s+RM66o/3Q0wvKi4y3+Q2jm8nkiWZpPfNt52g4ReE9Ge86o+L+EBOBgZm634L5Z/i6pq908mXBAklPdk1ERdEgWONaOeYYmB70FToplR1gINJEF2CnfAtD/wV+DuQFPDth+EWHqhe3a4xO0d9eJ55ou2QCYOPUC2g/qz1sp7GR74W7P5IWJdmnUEuPFsKJ6OvM+1V8S06jZGDa/QhUGDK8F3G/TMP09W1MsrlQTRr3YQ5H43+pMY7I6Jysze+X9OKZZTTpv4GmYm1USjmraGyMuPF3j9hrlmpttK+1gg2WzytCJO44YsZp9ckls8JNK4bT5uwTuomKZoRgmiIOTcMh4VP7V28TWj2XdF+T6rBFILTvQyXMOzvbe1kLwg2O31JDBdJ8X1fHCYJxKsIrYCSDPz4sha8h7QmHrCSFmjoXb+LUElnbLXZVRkY5/Dc73EM6Es3wAgjwSJK2asRqdqU0PhbS5qpIlgYKsNcb+Wes</OrderData>
36
+ </DataTransfer>
37
+ <ReturnCode authenticate="true">000000</ReturnCode>
38
+ <TimestampBankParameter authenticate="true">2013-12-09T15:14:30.000Z</TimestampBankParameter>
39
+ </body>
40
+ </ebicsResponse>
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ebicsResponse xmlns="urn:org:ebics:H004" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:org:ebics:H004 http://www.ebics.org/H004/ebics_response_H004.xsd" Version="H004" Revision="1">
3
+ <header authenticate="true">
4
+ <static>
5
+ <TransactionID>ECD6F062AAEDFA77250526A68CBEC549</TransactionID>
6
+ <NumSegments>2</NumSegments>
7
+ </static>
8
+ <mutable>
9
+ <TransactionPhase>Initialisation</TransactionPhase>
10
+ <SegmentNumber lastSegment="false">1</SegmentNumber>
11
+ <ReturnCode>000000</ReturnCode>
12
+ <ReportText>[EBICS_OK] OK</ReportText>
13
+ </mutable>
14
+ </header>
15
+ <AuthSignature>
16
+ <ds:SignedInfo>
17
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
18
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
19
+ <ds:Reference URI="#xpointer(//*[@authenticate='true'])">
20
+ <ds:Transforms>
21
+ <ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
22
+ </ds:Transforms>
23
+ <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
24
+ <ds:DigestValue>OnY4VczV+1XfplpMS/SCKFWn+FDMge40X8TJ9pA6HEI=</ds:DigestValue>
25
+ </ds:Reference>
26
+ </ds:SignedInfo>
27
+ <ds:SignatureValue>Qiz8clr/Ym+wLpB8CzTuxKP5rgIR2P4SaX8O4gGZx0Di8Lzd4hsBO3koqIuX11NRZo0RYA5E/IKQCoYLepkcM4QHvLT37YidbrXsTZe6cml/yF8OdyRAcd/9U7AoA9GKENFk4lnBFfZYmM4ADK6wVOCE/ABaOk0NeCDDbxrKA75tfTxwxTvQBfUOHZ87LrZxuQf//L9pzmtI07/7GbsQX8ZceQq40SpBFZn/oRvT/Q38Qu2ZO59MZexJn+BTzlhpfv9fQGF/sgXkdhUkPTEW3nL4j7ehasq3CtySGO2RnEppohEvJ4m07RDtEY3OWyAAZoPFVpvnECM6pOLbIuR40w==</ds:SignatureValue>
28
+ </AuthSignature>
29
+ <body>
30
+ <DataTransfer>
31
+ <DataEncryptionInfo authenticate="true">
32
+ <EncryptionPubKeyDigest Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" Version="E002">IUW05JB5cuCzRYYa4kIAZ2ehYVrLI3lKvxZvo1uP+ug=</EncryptionPubKeyDigest>
33
+ <TransactionKey>CPdd6ODXrCxHWpYrwS/5a3NIZ1R2SDscHHJSONc2I7g8ara7qv5Ra7H03W+336DPQLZQxH+EBRWdE2FQ1vrVTcypK6fkFarmO1dEtQt6Ka89AozC7aQMyp4yGl+zlF+XvFkJXZbRXgoEOPsgcG0xM6nKLXnr1ThYRFOoAasigLDGwqxliyhoR94F9dL7YB8Le/uZeRj78mNp4smkE5ZKKyPhwVx+0IW78YuVCSC2c2qbsMmm4evAvycdpLfuuoG4KVlNMIlvkKeBfMZFELcmeKKm85D2zPYkZ7cqG2IfAAp5qdS6K8P7RY4gtjUhOtP5mi8bZt/ZcjioUmIR9dAMnA==</TransactionKey>
34
+ </DataEncryptionInfo>
35
+ <OrderData>lJ/v1HvOYAZKTPkxULH4mOcUy01+EaAsxLzCPhtieAo9m5AtU5URdyBVfmclHbtWe3ELb02lR37bChynq0Esqpljxx7CiB+kl/bVs7XkNQQmtGPlh08O7ApJ7AHdKPFFvE+SM2OWpSwUrqJGtmyaU6s+RM66o/3Q0wvKi4y3+Q2jm8nkiWZpPfNt52g4ReE9Ge86o+L+EBOBgZm634L5Z/i6pq908mXBAklPdk1ERdEgWONaOeYYmB70FToplR1gINJEF2CnfAtD/wV+DuQFPDth+EWHqhe3a4xO0d9eJ55ou2QCYOPUC2g/qz1sp7GR74W7P5IWJdmnUEuPFsKJ6OvM+1V8S06jZGDa/QhUGDK8F3G/TMP09W1MsrlQTRr3YQ5H43+pMY7I6Jysze+X9OKZZTTpv4GmYm1USjmraGyMuPF3j9hrlmpttK+1gg2WzytCJO44YsZp9ckls8JNK4bT5uwTuomKZoRgmiIOTcMh4VP7V28TWj2XdF+T6rBFILTvQyXMOzvbe1kLwg2O31JDBdJ8X1fHCYJxKsIrYCSDPz4sha8h7QmHrCSFmjoXb+LUElnbLXZVRkY5/Dc73EM6Es3wAgjwSJK2asRqdqU0PhbS5qpIlgYKsNcb+Wes</OrderData>
36
+ </DataTransfer>
37
+ <ReturnCode authenticate="true">000000</ReturnCode>
38
+ <TimestampBankParameter authenticate="true">2013-12-09T15:14:30.000Z</TimestampBankParameter>
39
+ </body>
40
+ </ebicsResponse>
@@ -0,0 +1,11 @@
1
+ RSpec.describe Epics::C52 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') }
4
+
5
+ subject { described_class.new(client, "2014-09-01", "2014-09-30") }
6
+
7
+ describe '#to_xml' do
8
+ specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ RSpec.describe Epics::C53 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') }
4
+
5
+ subject { described_class.new(client, "2014-09-01", "2014-09-30") }
6
+
7
+ describe '#to_xml' do
8
+ specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ RSpec.describe Epics::HAC 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') }
4
+
5
+ subject { described_class.new(client, "2014-09-01", "2014-09-30") }
6
+
7
+ describe '#to_xml' do
8
+ specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
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') }
4
+
5
+ subject { described_class.new(client) }
6
+
7
+ describe '#to_xml' do
8
+ specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
9
+ end
10
+
11
+ end
@@ -8,4 +8,10 @@ RSpec.describe Epics::STA do
8
8
  specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
9
9
  end
10
10
 
11
+ describe '#to_receipt_xml' do
12
+ before { subject.transaction_id = SecureRandom.hex(16) }
13
+
14
+ specify { expect(subject.to_receipt_xml).to be_a_valid_ebics_doc }
15
+ end
16
+
11
17
  end
@@ -1,21 +1,25 @@
1
1
  RSpec.describe Epics::Response do
2
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') }
3
- subject { described_class.new( client, File.read('spec/fixtures/xml/upload_init_response.xml') ) }
3
+ subject { described_class.new( client, ebics_response ) }
4
4
 
5
5
  describe '#digest_valid?' do
6
+ let(:ebics_response) { File.read('spec/fixtures/xml/upload_init_response.xml') }
7
+
6
8
  it 'checks if //ds:DigestValue matches the calculated digest' do
7
9
  expect(subject.digest_valid?).to be(true)
8
10
  end
9
11
  end
10
12
 
11
13
  describe '#signature_valid?' do
14
+ let(:ebics_response) { File.read('spec/fixtures/xml/upload_init_response.xml') }
15
+
12
16
  it 'checks if the signature value can be verified with the bank key' do
13
17
  expect(subject.signature_valid?).to be(true)
14
18
  end
15
19
  end
16
20
 
17
21
  describe '#public_digest_valid?' do
18
- subject { described_class.new( client, File.read('spec/fixtures/xml/hpb_response.xml') ) }
22
+ let(:ebics_response) { File.read('spec/fixtures/xml/hpb_response.xml') }
19
23
 
20
24
  it "checks if //xmlns:EncryptionPubKeyDigest matches the user encryption key" do
21
25
  expect(subject.public_digest_valid?).to be(true)
@@ -23,12 +27,54 @@ RSpec.describe Epics::Response do
23
27
  end
24
28
 
25
29
  describe 'order_data' do
30
+ let(:ebics_response) { File.read('spec/fixtures/xml/hpb_response.xml') }
26
31
  let(:order_data) { File.read('spec/fixtures/xml/hpb_response_order.xml') }
27
- subject { described_class.new( client, File.read('spec/fixtures/xml/hpb_response.xml') ) }
28
32
 
29
33
  it "retrieves the decrypted order data" do
30
34
  expect(subject.order_data).to eq(order_data)
31
35
  end
32
36
  end
33
37
 
38
+ describe '#transaction_id' do
39
+ let(:ebics_response) { File.read('spec/fixtures/xml/sta_response.xml') }
40
+ it 'pulls the transaction_id from the response' do
41
+ expect(subject.transaction_id).to eq('ECD6F062AAEDFA77250526A68CBEC549')
42
+ end
43
+ end
44
+
45
+ describe '#last_segment?' do
46
+ describe 'when its the last segement' do
47
+ let(:ebics_response) { File.read('spec/fixtures/xml/sta_response.xml') }
48
+
49
+ it 'will be true' do
50
+ expect(subject.last_segment?).to be(true)
51
+ end
52
+ end
53
+
54
+ describe 'when there are more segments' do
55
+ let(:ebics_response) { File.read('spec/fixtures/xml/sta_response_continued.xml') }
56
+ it 'will be false' do
57
+ expect(subject.last_segment?).to be(false)
58
+ end
59
+ end
60
+ end
61
+
62
+ describe '#segmented?' do
63
+ describe 'when the response is segemnted' do
64
+ let(:ebics_response) { File.read('spec/fixtures/xml/sta_response.xml') }
65
+
66
+ it 'will be true' do
67
+ expect(subject.segmented?).to be(true)
68
+ end
69
+ end
70
+
71
+ describe 'when the response is not segemnted' do
72
+ let(:ebics_response) { File.read('spec/fixtures/xml/hpb_response.xml') }
73
+
74
+ it 'will be false' do
75
+ expect(subject.segmented?).to be(false)
76
+ end
77
+ end
78
+ end
79
+
34
80
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Brillert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-21 00:00:00.000000000 Z
11
+ date: 2014-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -143,7 +143,7 @@ description: |2
143
143
  including the INI letter generation.
144
144
 
145
145
  Furthermore it offers support for the most common download types:
146
- STA HAA HTD HPD PKT
146
+ STA HAA HTD HPD PKT HAC HKD C52 C53
147
147
 
148
148
  And the following upload orders:
149
149
  CD1 CDD CCT
@@ -156,6 +156,7 @@ files:
156
156
  - ".gitignore"
157
157
  - ".rspec"
158
158
  - ".travis.yml"
159
+ - CHANGELOG.md
159
160
  - CONTRIBUTING.md
160
161
  - Gemfile
161
162
  - LICENSE.txt
@@ -163,6 +164,8 @@ files:
163
164
  - Rakefile
164
165
  - epics.gemspec
165
166
  - lib/epics.rb
167
+ - lib/epics/c52.rb
168
+ - lib/epics/c53.rb
166
169
  - lib/epics/cct.rb
167
170
  - lib/epics/cd1.rb
168
171
  - lib/epics/cdd.rb
@@ -171,7 +174,9 @@ files:
171
174
  - lib/epics/generic_request.rb
172
175
  - lib/epics/generic_upload_request.rb
173
176
  - lib/epics/haa.rb
177
+ - lib/epics/hac.rb
174
178
  - lib/epics/hia.rb
179
+ - lib/epics/hkd.rb
175
180
  - lib/epics/hpb.rb
176
181
  - lib/epics/hpd.rb
177
182
  - lib/epics/htd.rb
@@ -206,16 +211,22 @@ files:
206
211
  - spec/fixtures/xml/htd_order_data.xml
207
212
  - spec/fixtures/xml/ini.xml
208
213
  - spec/fixtures/xml/signature_pub_key_order_data.xml
214
+ - spec/fixtures/xml/sta_response.xml
215
+ - spec/fixtures/xml/sta_response_continued.xml
209
216
  - spec/fixtures/xml/upload_init_response.xml
210
217
  - spec/hpb_spec.rb
211
218
  - spec/key_spec.rb
212
219
  - spec/mgf_spec.rb
213
220
  - spec/middleware/parse_ebics_spec.rb
221
+ - spec/orders/c52_spec.rb
222
+ - spec/orders/c53_spec.rb
214
223
  - spec/orders/cct_spec.rb
215
224
  - spec/orders/cd1_spec.rb
216
225
  - spec/orders/cdd_spec.rb
217
226
  - spec/orders/haa_spec.rb
227
+ - spec/orders/hac_spec.rb
218
228
  - spec/orders/hia_spec.rb
229
+ - spec/orders/hkd_spec.rb
219
230
  - spec/orders/hpb_spec.rb
220
231
  - spec/orders/hpd_spec.rb
221
232
  - spec/orders/htd_spec.rb
@@ -287,16 +298,22 @@ test_files:
287
298
  - spec/fixtures/xml/htd_order_data.xml
288
299
  - spec/fixtures/xml/ini.xml
289
300
  - spec/fixtures/xml/signature_pub_key_order_data.xml
301
+ - spec/fixtures/xml/sta_response.xml
302
+ - spec/fixtures/xml/sta_response_continued.xml
290
303
  - spec/fixtures/xml/upload_init_response.xml
291
304
  - spec/hpb_spec.rb
292
305
  - spec/key_spec.rb
293
306
  - spec/mgf_spec.rb
294
307
  - spec/middleware/parse_ebics_spec.rb
308
+ - spec/orders/c52_spec.rb
309
+ - spec/orders/c53_spec.rb
295
310
  - spec/orders/cct_spec.rb
296
311
  - spec/orders/cd1_spec.rb
297
312
  - spec/orders/cdd_spec.rb
298
313
  - spec/orders/haa_spec.rb
314
+ - spec/orders/hac_spec.rb
299
315
  - spec/orders/hia_spec.rb
316
+ - spec/orders/hkd_spec.rb
300
317
  - spec/orders/hpb_spec.rb
301
318
  - spec/orders/hpd_spec.rb
302
319
  - spec/orders/htd_spec.rb