epics 2.1.1 → 2.2.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
  SHA256:
3
- metadata.gz: 980932f78c7674473397501f8e2605ea228440f7f6eb0f8e83b64191c390fb59
4
- data.tar.gz: 646f6c19ced2dfc713a632dee70a4bbd88bf18334593ce743b4175fcb73ee063
3
+ metadata.gz: 196537be2328e1c2445eafddb04840616446d599e8f2c887b8d6e5884acd1107
4
+ data.tar.gz: 7d0fc17a578fcae3e3827d56375c20449961b40f581fdd2a192f7addf1ac3c6e
5
5
  SHA512:
6
- metadata.gz: f3ed6cc291a2ff0a6049f3cb25312364a8165a32aaf87127cb75f655f6338dfe6f9e3ab640f81a13fe177d3e6e3229d2712df8eb9f7c1885b6ebe777597f4061
7
- data.tar.gz: ddd2ec2d76ff97053856883471725ae1f0a9f8c97aab9f094ab9598966d3d4494f8cb76184e0a454721b9cb304d403de4e10677ea2a21bea13bad288595d759c
6
+ metadata.gz: d8b5b8538c6c6100f1e6f9cf225999ec1d9bed0fa152bfb0aa5ff8f02cdfd545254eb9a348f03e868fa7544e67424b1fbd4277ba1185bc820fa68792ed23bb9b
7
+ data.tar.gz: e490b632b8f018aff18c8461780875190af6a287807c7baaaa579060eca89961b83bd3404291b31f98a54859a6a8eca9df2b7053c9de080a9043a7b1ae0a84f6
@@ -3,7 +3,7 @@ name: Test
3
3
  agent:
4
4
  machine:
5
5
  type: e1-standard-2
6
- os_image: ubuntu1804
6
+ os_image: ubuntu2004
7
7
  blocks:
8
8
  - name: Setup
9
9
  task:
@@ -16,30 +16,39 @@ blocks:
16
16
  - name: Spec versions
17
17
  task:
18
18
  jobs:
19
- - name: "2.7"
19
+ - name: "3.0"
20
20
  commands:
21
21
  - checkout
22
- - sem-version ruby 2.7
22
+ - sem-version ruby 3.0
23
23
  - cache restore
24
- - gem install bundler:2.4.3
24
+ - gem install bundler:2.4.22
25
25
  - bundle install
26
26
  - cache store
27
27
  - bundle exec rspec
28
- - name: "3.0"
28
+ - name: "3.1"
29
29
  commands:
30
30
  - checkout
31
- - sem-version ruby 3.0
31
+ - sem-version ruby 3.1
32
32
  - cache restore
33
- - gem install bundler:2.4.3
33
+ - gem install bundler:2.4.22
34
34
  - bundle install
35
35
  - cache store
36
36
  - bundle exec rspec
37
- - name: "3.1"
37
+ - name: "3.2"
38
38
  commands:
39
39
  - checkout
40
- - sem-version ruby 3.1
40
+ - sem-version ruby 3.2
41
+ - cache restore
42
+ - gem install bundler:2.4.22
43
+ - bundle install
44
+ - cache store
45
+ - bundle exec rspec
46
+ - name: "3.3"
47
+ commands:
48
+ - checkout
49
+ - sem-version ruby 3.3
41
50
  - cache restore
42
- - gem install bundler:2.4.3
51
+ - gem install bundler:2.4.22
43
52
  - bundle install
44
53
  - cache store
45
54
  - bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ### Unreleased
2
+
3
+ ### 2.2.0
4
+
5
+ - [ENHANCEMENT] Adds C2S order tyoe
6
+ - [HOUSEKEEPING] updates nokogiri dependency
7
+ - [HOUSEKEEPING] updates rexml dependency
8
+ - [HOUSEKEEPING] adds Ruby 3.3 to CI
9
+
10
+ ### 2.1.2
11
+
12
+ - [BUGFIX] Fix order data encryption for OpenSSL 3
13
+
1
14
  ### 2.1.1
2
15
 
3
16
  - [HOUSEKEEPING] update Bank public key initialization for OpenSSL 3
data/epics.gemspec CHANGED
@@ -41,10 +41,11 @@ Gem::Specification.new do |spec|
41
41
  spec.post_install_message += "\e[32m" + ('*' * 60) + "\n\e[0m"
42
42
 
43
43
  spec.add_dependency 'faraday', '>= 1.10.0'
44
- spec.add_dependency 'nokogiri', '>= 1.14.0'
44
+ spec.add_dependency 'nokogiri', '>= 1.16.5'
45
45
  spec.add_dependency 'rubyzip', '>= 2.3.2'
46
+ spec.add_dependency 'rexml', '>= 3.2.8'
46
47
 
47
- spec.add_development_dependency 'bundler', '>= 2.4.3'
48
+ spec.add_development_dependency 'bundler', '>= 2.4.12'
48
49
  spec.add_development_dependency 'equivalent-xml'
49
50
  spec.add_development_dependency 'pry'
50
51
  spec.add_development_dependency 'rake', '~> 13.0'
data/lib/epics/c2s.rb ADDED
@@ -0,0 +1,9 @@
1
+ class Epics::C2S < Epics::CDB
2
+ def order_attribute
3
+ "DZHNN"
4
+ end
5
+
6
+ def order_type
7
+ 'C2S'
8
+ end
9
+ end
data/lib/epics/cdb.rb CHANGED
@@ -1,4 +1,12 @@
1
1
  class Epics::CDB < Epics::GenericUploadRequest
2
+ def order_attribute
3
+ 'OZHNN'
4
+ end
5
+
6
+ def order_type
7
+ 'CDB'
8
+ end
9
+
2
10
  def header
3
11
  Nokogiri::XML::Builder.new do |xml|
4
12
  xml.header(authenticate: true) {
@@ -10,8 +18,8 @@ class Epics::CDB < Epics::GenericUploadRequest
10
18
  xml.UserID user_id
11
19
  xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
12
20
  xml.OrderDetails {
13
- xml.OrderType 'CDB'
14
- xml.OrderAttribute 'OZHNN'
21
+ xml.OrderType order_type
22
+ xml.OrderAttribute order_attribute
15
23
  xml.StandardOrderParams
16
24
  }
17
25
  xml.BankPubKeyDigests {
data/lib/epics/client.rb CHANGED
@@ -129,6 +129,10 @@ class Epics::Client
129
129
  upload(Epics::CDB, document)
130
130
  end
131
131
 
132
+ def C2S(document)
133
+ upload(Epics::C2S, document)
134
+ end
135
+
132
136
  def CDD(document)
133
137
  upload(Epics::CDD, document)
134
138
  end
@@ -1,15 +1,17 @@
1
1
  class Epics::GenericUploadRequest < Epics::GenericRequest
2
2
  attr_accessor :key
3
+ attr_accessor :iv
3
4
  attr_accessor :document
4
5
 
5
6
  def initialize(client, document)
6
7
  super(client)
7
8
  self.document = document
8
- self.key ||= cipher.random_key
9
+ self.key = cipher.random_key
10
+ self.iv = 0.chr * cipher.iv_len
9
11
  end
10
12
 
11
13
  def cipher
12
- @cipher ||= OpenSSL::Cipher.new("aes-128-cbc")
14
+ @cipher ||= OpenSSL::Cipher.new("aes-128-cbc").tap { |cipher| cipher.encrypt }
13
15
  end
14
16
 
15
17
  def digester
@@ -49,9 +51,9 @@ class Epics::GenericUploadRequest < Epics::GenericRequest
49
51
 
50
52
  def encrypt(d)
51
53
  cipher.reset
52
- cipher.encrypt
53
54
  cipher.padding = 0
54
55
  cipher.key = self.key
56
+ cipher.iv = self.iv
55
57
  (cipher.update(pad(d)) + cipher.final)
56
58
  end
57
59
 
data/lib/epics/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Epics
4
- VERSION = '2.1.1'
4
+ VERSION = '2.2.0'
5
5
  end
data/lib/epics.rb CHANGED
@@ -37,6 +37,7 @@ require "epics/cdd"
37
37
  require "epics/b2b"
38
38
  require "epics/xds"
39
39
  require "epics/cds"
40
+ require "epics/c2s"
40
41
  require "epics/cdz"
41
42
  require "epics/crz"
42
43
  require "epics/xct"
@@ -46,4 +46,13 @@ RSpec.describe Epics::GenericUploadRequest do
46
46
  end
47
47
 
48
48
  end
49
+
50
+ describe '#encrypted_order_data' do
51
+ it 'returns the same data every time' do
52
+ data_1 = subject.encrypted_order_data
53
+ data_2 = subject.encrypted_order_data
54
+
55
+ expect(data_1).to eq(data_2)
56
+ end
57
+ end
49
58
  end
@@ -0,0 +1,21 @@
1
+ RSpec.describe Epics::C2S 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
+ let(:document) { File.read( File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'cdb.xml') ) }
5
+ subject { described_class.new(client, document) }
6
+
7
+ describe 'order attributes' do
8
+ it { expect(subject.header.to_s).to include('<OrderAttribute>DZHNN</OrderAttribute>') }
9
+ it { expect(subject.header.to_s).to include('<OrderType>C2S</OrderType>') }
10
+ end
11
+
12
+ describe '#to_xml' do
13
+ specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
14
+ end
15
+
16
+ describe '#to_transfer_xml' do
17
+ before { subject.transaction_id = SecureRandom.hex(16) }
18
+
19
+ specify { expect(subject.to_transfer_xml).to be_a_valid_ebics_doc }
20
+ end
21
+ 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: 2.1.1
4
+ version: 2.2.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: 2023-07-25 00:00:00.000000000 Z
11
+ date: 2024-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.14.0
33
+ version: 1.16.5
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.14.0
40
+ version: 1.16.5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubyzip
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +52,34 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.3.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: rexml
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 3.2.8
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 3.2.8
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: 2.4.3
75
+ version: 2.4.12
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: 2.4.3
82
+ version: 2.4.12
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: equivalent-xml
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -166,6 +180,7 @@ files:
166
180
  - lib/epics.rb
167
181
  - lib/epics/azv.rb
168
182
  - lib/epics/b2b.rb
183
+ - lib/epics/c2s.rb
169
184
  - lib/epics/c52.rb
170
185
  - lib/epics/c53.rb
171
186
  - lib/epics/c54.rb
@@ -244,6 +259,7 @@ files:
244
259
  - spec/middleware/parse_ebics_spec.rb
245
260
  - spec/orders/azv_spec.rb
246
261
  - spec/orders/b2b_spec.rb
262
+ - spec/orders/c2s_spec.rb
247
263
  - spec/orders/c52_spec.rb
248
264
  - spec/orders/c53_spec.rb
249
265
  - spec/orders/c54_spec.rb
@@ -305,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
321
  - !ruby/object:Gem::Version
306
322
  version: '0'
307
323
  requirements: []
308
- rubygems_version: 3.4.13
324
+ rubygems_version: 3.5.11
309
325
  signing_key:
310
326
  specification_version: 4
311
327
  summary: a ruby implementation of the EBICS protocol
@@ -353,6 +369,7 @@ test_files:
353
369
  - spec/middleware/parse_ebics_spec.rb
354
370
  - spec/orders/azv_spec.rb
355
371
  - spec/orders/b2b_spec.rb
372
+ - spec/orders/c2s_spec.rb
356
373
  - spec/orders/c52_spec.rb
357
374
  - spec/orders/c53_spec.rb
358
375
  - spec/orders/c54_spec.rb