epics 1.5.0 → 1.5.1

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: ffb2fe355ff8d4811bff967cf20cf742cbd688a5
4
- data.tar.gz: 5edb7d8ee8bbc115a97646fa10eb41eff0780a9c
3
+ metadata.gz: ecad438a0c8a714c21a37886e6acad344ed255a4
4
+ data.tar.gz: 3555440053e69ad6827ce80f2503b428696ffd21
5
5
  SHA512:
6
- metadata.gz: 6d51f0ac477dac99702a10886ada30c5bb8bca9836cf4480b800a7717630d5b34183ef8246834e515e8e4a84753dbae11d0c031fe340c51e1af79c641e3ccd60
7
- data.tar.gz: cc2220b2f3456e12e68cdc392873439a2ae634303276130a444ab9b504e081266db6924d31b83fc3544aa17f4efb6d538bd40d8b5555b5a3e595fb2d831c835f
6
+ metadata.gz: a94e3e00b5bd98e9237a0c0e2d6c1a6dbd9c0d0f2662d587245200add1aed0f115fc7cc5dc1ec1043606e29fcd0cfc17b3b8c82ae17ad8d0bd7d4f42575726f5
7
+ data.tar.gz: cbe1262312b000848dd14018b78214693eea72dc11b10ad9e331718364d8bd3b9699e00a390d10ef647eb1e1712a3dcb919eaaef99f98a8bb65b4c9b6e18777a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 1.5.1
2
+
3
+ * [ENHANCEMENT] some banks are not returning the order_id in the second upload phase, we now fetch it already
4
+ from the first response to handle this different behaviour.
5
+ * [ENHANCEMENT] New order types: `AZV` (Auslandszahlungsverkehr). `CDS` and `CCS` for submitting SEPA credits/debits
6
+ as SRZ (Service Rechen Zentrum)
7
+
1
8
  ### 1.5.0
2
9
 
3
10
  * [ENHANCEMENT] support for fetching the C54 order type
data/lib/epics.rb CHANGED
@@ -18,6 +18,7 @@ require "epics/middleware/xmlsig"
18
18
  require "epics/middleware/parse_ebics"
19
19
  require "epics/generic_request"
20
20
  require "epics/generic_upload_request"
21
+ require "epics/azv"
21
22
  require "epics/hpb"
22
23
  require "epics/hkd"
23
24
  require "epics/htd"
@@ -32,8 +33,10 @@ require "epics/hac"
32
33
  require "epics/hpd"
33
34
  require "epics/cd1"
34
35
  require "epics/cct"
36
+ require "epics/ccs"
35
37
  require "epics/cdb"
36
38
  require "epics/cdd"
39
+ require "epics/cds"
37
40
  require "epics/hia"
38
41
  require "epics/ini"
39
42
  require "epics/signer"
data/lib/epics/azv.rb ADDED
@@ -0,0 +1,41 @@
1
+ class Epics::AZV < Epics::GenericUploadRequest
2
+ def header
3
+ {
4
+ :@authenticate => true,
5
+ static: {
6
+ "HostID" => host_id,
7
+ "Nonce" => nonce,
8
+ "Timestamp" => timestamp,
9
+ "PartnerID" => partner_id,
10
+ "UserID" => user_id,
11
+ "Product" => {
12
+ :@Language => "de",
13
+ :content! => "EPICS - a ruby ebics kernel"
14
+ },
15
+ "OrderDetails" => {
16
+ "OrderType" => "AZV",
17
+ "OrderAttribute" => "OZHNN",
18
+ "StandardOrderParams/" => ""
19
+ },
20
+ "BankPubKeyDigests" => {
21
+ "Authentication" => {
22
+ :@Version => "X002",
23
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
24
+ :content! => client.bank_x.public_digest
25
+ },
26
+ "Encryption" => {
27
+ :@Version => "E002",
28
+ :@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
29
+ :content! => client.bank_e.public_digest
30
+ }
31
+ },
32
+ "SecurityMedium" => "0000",
33
+ "NumSegments" => 1
34
+ },
35
+ "mutable" => {
36
+ "TransactionPhase" => "Initialisation"
37
+ }
38
+ }
39
+ end
40
+
41
+ end
data/lib/epics/ccs.rb ADDED
@@ -0,0 +1,9 @@
1
+ class Epics::CCS < Epics::CCT
2
+ def order_attribute
3
+ "DZHNN"
4
+ end
5
+
6
+ def order_type
7
+ 'CCS'
8
+ end
9
+ end
data/lib/epics/cdd.rb CHANGED
@@ -1,4 +1,11 @@
1
1
  class Epics::CDD < Epics::GenericUploadRequest
2
+ def order_attribute
3
+ 'OZHNN'
4
+ end
5
+
6
+ def order_type
7
+ 'CDD'
8
+ end
2
9
 
3
10
  def header
4
11
  {
@@ -14,8 +21,8 @@ class Epics::CDD < Epics::GenericUploadRequest
14
21
  :content! => "EPICS - a ruby ebics kernel"
15
22
  },
16
23
  "OrderDetails" => {
17
- "OrderType" => "CDD",
18
- "OrderAttribute" => "OZHNN",
24
+ "OrderType" => order_type,
25
+ "OrderAttribute" => order_attribute,
19
26
  "StandardOrderParams/" => ""
20
27
  },
21
28
  "BankPubKeyDigests" => {
data/lib/epics/cds.rb ADDED
@@ -0,0 +1,9 @@
1
+ class Epics::CDS < Epics::CDD
2
+ def order_attribute
3
+ "DZHNN"
4
+ end
5
+
6
+ def order_type
7
+ 'CDS'
8
+ end
9
+ end
data/lib/epics/client.rb CHANGED
@@ -115,6 +115,10 @@ class Epics::Client
115
115
  [bank_x, bank_e]
116
116
  end
117
117
 
118
+ def AZV(document)
119
+ upload(Epics::AZV, document)
120
+ end
121
+
118
122
  def CD1(document)
119
123
  upload(Epics::CD1, document)
120
124
  end
@@ -123,10 +127,18 @@ class Epics::Client
123
127
  upload(Epics::CDD, document)
124
128
  end
125
129
 
130
+ def CDS(document)
131
+ upload(Epics::CDS, document)
132
+ end
133
+
126
134
  def CCT(document)
127
135
  upload(Epics::CCT, document)
128
136
  end
129
137
 
138
+ def CCS(document)
139
+ upload(Epics::CCS, document)
140
+ end
141
+
130
142
  def STA(from = nil, to = nil)
131
143
  download(Epics::STA, from, to)
132
144
  end
@@ -186,9 +198,11 @@ class Epics::Client
186
198
  res = post(url, order.to_xml).body
187
199
  order.transaction_id = res.transaction_id
188
200
 
201
+ order_id = res.order_id
202
+
189
203
  res = post(url, order.to_transfer_xml).body
190
204
 
191
- return res.transaction_id, res.order_id
205
+ return res.transaction_id, [res.order_id, order_id].detect { |id| id.to_s.chars.any? }
192
206
  end
193
207
 
194
208
  def download(order_type, *args)
data/lib/epics/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Epics
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
data/spec/client_spec.rb CHANGED
@@ -117,22 +117,39 @@ RSpec.describe Epics::Client do
117
117
 
118
118
  it { expect(subject.keys["SIZBN001.E002"].public_digest).to eq(e_key.public_digest) }
119
119
  it { expect(subject.keys["SIZBN001.X002"].public_digest).to eq(e_key.public_digest) }
120
-
121
120
  end
122
121
  end
123
122
 
124
123
  describe '#CD1' do
125
124
  let(:cd1_document) { File.read(File.join(File.dirname(__FILE__), 'fixtures', 'xml', 'cd1.xml')) }
126
- before do
127
- stub_request(:post, "https://194.180.18.30/ebicsweb/ebicsweb")
128
- .with(:body => %r[<TransactionPhase>Initialisation</TransactionPhase>])
129
- .to_return(status: 200, body: File.read(File.join(File.dirname(__FILE__), 'fixtures', 'xml', 'cd1_init_response.xml')))
130
- stub_request(:post, "https://194.180.18.30/ebicsweb/ebicsweb")
131
- .with(:body => %r[<TransactionPhase>Transfer</TransactionPhase>])
132
- .to_return(status: 200, body: File.read(File.join(File.dirname(__FILE__), 'fixtures', 'xml', 'cd1_transfer_response.xml')))
125
+ describe 'normal behaviour' do
126
+ before do
127
+ stub_request(:post, "https://194.180.18.30/ebicsweb/ebicsweb")
128
+ .with(:body => %r[<TransactionPhase>Initialisation</TransactionPhase>])
129
+ .to_return(status: 200, body: File.read(File.join(File.dirname(__FILE__), 'fixtures', 'xml', 'cd1_init_response.xml')))
130
+ stub_request(:post, "https://194.180.18.30/ebicsweb/ebicsweb")
131
+ .with(:body => %r[<TransactionPhase>Transfer</TransactionPhase>])
132
+ .to_return(status: 200, body: File.read(File.join(File.dirname(__FILE__), 'fixtures', 'xml', 'cd1_transfer_response.xml')))
133
+ end
134
+
135
+ it { expect(subject.CD1(cd1_document)).to eq(["387B7BE88FE33B0F4B60AC64A63F18E2","N00L"]) }
133
136
  end
134
137
 
135
- it { expect(subject.CD1(cd1_document)).to eq(["387B7BE88FE33B0F4B60AC64A63F18E2","N00L"]) }
138
+ describe 'special case' do
139
+ before do
140
+ stub_request(:post, "https://194.180.18.30/ebicsweb/ebicsweb")
141
+ .with(:body => %r[<TransactionPhase>Initialisation</TransactionPhase>])
142
+ .to_return(status: 200, body: File.read(File.join(File.dirname(__FILE__), 'fixtures', 'xml', 'cd1_init_response.xml')).sub('N00L', 'N11L'))
143
+ stub_request(:post, "https://194.180.18.30/ebicsweb/ebicsweb")
144
+ .with(:body => %r[<TransactionPhase>Transfer</TransactionPhase>])
145
+ .to_return(status: 200, body: File.read(File.join(File.dirname(__FILE__), 'fixtures', 'xml', 'cd1_transfer_response.xml')).sub('<OrderID>N00L</OrderID>', ''))
146
+ end
147
+
148
+ # happend on some handelsbank accounts
149
+ it 'can also try to fetch the order_id from the first transaction being made' do
150
+ expect(subject.CD1(cd1_document)).to eq(["387B7BE88FE33B0F4B60AC64A63F18E2","N11L"])
151
+ end
152
+ end
136
153
  end
137
154
 
138
155
  describe '#HTD' do
@@ -2,12 +2,12 @@ RSpec.describe Epics::ParseEbics do
2
2
 
3
3
  subject do
4
4
  Faraday.new do |builder|
5
+ builder.use Epics::ParseEbics
5
6
  builder.adapter :test, Faraday::Adapter::Test::Stubs.new do |stub|
6
7
  stub.post('/business_nok') {[ 200, {}, File.read( File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'ebics_business_nok.xml') ) ]}
7
8
  stub.post('/technical_nok') {[ 200, {}, File.read( File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'ebics_technical_nok.xml') ) ]}
8
9
  stub.post('/ok') {[ 200, {}, File.read( File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'hpb_response_ebics_ns.xml') ) ]}
9
10
  end
10
- builder.use Epics::ParseEbics
11
11
  end
12
12
  end
13
13
 
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.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Brillert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-07 00:00:00.000000000 Z
11
+ date: 2017-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -178,13 +178,16 @@ files:
178
178
  - Rakefile
179
179
  - epics.gemspec
180
180
  - lib/epics.rb
181
+ - lib/epics/azv.rb
181
182
  - lib/epics/c52.rb
182
183
  - lib/epics/c53.rb
183
184
  - lib/epics/c54.rb
185
+ - lib/epics/ccs.rb
184
186
  - lib/epics/cct.rb
185
187
  - lib/epics/cd1.rb
186
188
  - lib/epics/cdb.rb
187
189
  - lib/epics/cdd.rb
190
+ - lib/epics/cds.rb
188
191
  - lib/epics/client.rb
189
192
  - lib/epics/error.rb
190
193
  - lib/epics/generic_request.rb