epics 2.6.0 → 2.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c51d24b50fdc5705acf921ecc331fbbc504be08c1615bb1e19e5586a808549cc
4
- data.tar.gz: 7da71fe00c348df5e32774633d6b14d1f22df867d69830811c8ed1db8c26134e
3
+ metadata.gz: f97fb2e1d069feca084d74aff47a5a55a4f0f8d6aa2865567544450f68cf35c8
4
+ data.tar.gz: 4028071efc11da0c35e2c4e1ca9997512538083fbbfeebd6eb00ce985ea76f45
5
5
  SHA512:
6
- metadata.gz: d28b7833d9b95b7c849918cbda0bb5edd8e8836688989e308ab7e90f0982b2f802604ac02acff0960a644db6b3941c32ce2b055c45d00678d5a8acb0778f430b
7
- data.tar.gz: 52bf70e50a99e2844a2c62115b6b59b3455e5fbedfcc1f575033a702a5d2838ac05fbfacb6e0438f4fee13b76e6837b6682e0aca4bb9cf6978d6eb1660317174
6
+ metadata.gz: 90c7e7bf8b9dd58f367a432eb8b1beec2b3faff2bde2f186575555b4098e6db494769ba0f567e2c419bb0387344d2bf6a10f6201544a2e15f09eb583bc89fe70
7
+ data.tar.gz: 4b9e25b55194e4a299717d8d9cd6f1296d6e0298b20e4d405518488e90d90ed9c3e5e92c9361e00e51fcb6759d366a5100d629f4a1c582f4ab242471363f9009
data/.gitignore CHANGED
@@ -16,4 +16,5 @@ mkmf.log
16
16
  .DS_Store
17
17
  sbk.key
18
18
  /mt940
19
- *.key
19
+ *.key
20
+ .idea/
data/CHANGELOG.md CHANGED
@@ -1,8 +1,17 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 2.8.0
4
+
5
+ - [ENHANCEMENT] Added BKA order type
6
+
7
+ ### 2.7.0
8
+
9
+ - [ENHANCEMENT] Added FDL order type (thanks to @frantisekrokusek)
10
+ - [ENHANCEMENT] Added support for configuring locale and client/product name on initialization (thanks to @frantisekrokusek)
11
+
3
12
  ### 2.6.0
4
13
 
5
- - [ENHANCEMENT] Adds CIP order type (instant transfers)
14
+ - [ENHANCEMENT] Added CIP order type (instant transfers)
6
15
  - [ENHANCEMENT] Added gem metadata (thanks to @Nymuxyzo)
7
16
 
8
17
  ### 2.5.0
data/README.md CHANGED
@@ -10,7 +10,7 @@ It supports EBICS 2.5.
10
10
 
11
11
  The client supports the complete initialization process comprising INI, HIA and HPB including the
12
12
  INI letter generation. It offers support for the most common download and upload order types
13
- (STA HAA HTD HPD PTK HAC HKD C52 C53 C54 CD1 CDB CDD CCT VMK).
13
+ (STA HAA HTD HPD PTK HAC HKD BKA C52 C53 C54 CD1 CDB CDD CCT VMK FDL).
14
14
 
15
15
  ## Installation
16
16
 
@@ -115,6 +115,15 @@ keys = File.read('/tmp/my.key')
115
115
  e = Epics::Client.new(keys, 'passphrase', 'url', 'host', 'user', 'partner')
116
116
  ```
117
117
 
118
+ ### Client Configuration
119
+
120
+ You can choose to configure some default values like this
121
+
122
+ ```ruby
123
+ # For default values see `lib/epics.rb`
124
+ e = Epics::Client.new(keys, 'passphrase', 'url', 'host', 'user', 'partner', locale: :fr, product_name: 'Mon Epic Client EBICS')
125
+ ```
126
+
118
127
  ## Features
119
128
 
120
129
  ### Initialization
@@ -222,12 +231,13 @@ Used for example by the following tested institutions:
222
231
  - Hypo Vereinsbank
223
232
  - BAWAG P.S.K. (AT)
224
233
  - Bank Frick (LI)
234
+ - BNP Paribas (FR)
225
235
 
226
236
  Is Epics working with your institution? Please help us to grow this list of supported banks:
227
237
 
228
238
  ## Development
229
239
 
230
- For development purposes, you may want to use a proxy server in order to have a convienent look into request and response data.
240
+ For development purposes, you may want to use a proxy server in order to have a convenient look into request and response data.
231
241
  To do so, it's sufficient to define `http_proxy` in your environment.
232
242
  Also you may want to disable SSL verification - simply set `EPICS_VERIFY_SSL` to `"false"`.
233
243
 
@@ -246,14 +256,19 @@ EPICS_VERIFY_SSL=false
246
256
  - [Die Deutsche Kreditwirtschaft](http://www.die-deutsche-kreditwirtschaft.de/)
247
257
 
248
258
  ## Contributing
249
- Railslove has a [Contributor License Agreement (CLA)](https://github.com/railslove/epics/blob/master/CONTRIBUTING.md) which clarifies the intellectual property rights for contributions from individuals or entities. To ensure every developer has signed the CLA, we use [CLA Assistant](https://cla-assistant.io/).
259
+ Railslove has a [Contributor License Agreement (CLA)](https://github.com/railslove/epics/blob/master/CONTRIBUTING.md) which clarifies the intellectual property rights for contributions from individuals or entities. To ensure every developer has signed the CLA, we use [CLA Assistant](https://cla-assistant.io/).
260
+
261
+ After checking out the repo, run `bin/setup` to install dependencies.
262
+ Then, run `rspec` to run the tests.
263
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
250
264
 
251
265
  0. Contact team@railslove.com for information about the CLA
252
266
  1. Fork it ( https://github.com/[my-github-username]/epics/fork )
253
- 1. Create your feature branch (`git checkout -b my-new-feature`)
254
- 1. Commit your changes (`git commit -am 'Add some feature'`)
255
- 1. Push to the branch (`git push origin my-new-feature`)
256
- 1. Create a new Pull Request
267
+ 2. Run `bin/setup`
268
+ 3. Create your feature branch (`git checkout -b my-new-feature`)
269
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
270
+ 5. Push to the branch (`git push origin my-new-feature`)
271
+ 6. Create a new Pull Request
257
272
 
258
273
  ## Contribution Credits
259
274
 
data/bin/console ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "epics"
6
+
7
+ require "irb"
8
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
data/epics.gemspec CHANGED
@@ -44,6 +44,8 @@ Gem::Specification.new do |spec|
44
44
  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"
45
45
  spec.post_install_message += "\e[32m" + ('*' * 60) + "\n\e[0m"
46
46
 
47
+ spec.add_dependency 'base64'
48
+ spec.add_dependency 'bigdecimal'
47
49
  spec.add_dependency 'faraday', '>= 1.10.0'
48
50
  spec.add_dependency 'i18n', '>= 1.1.0'
49
51
  spec.add_dependency 'nokogiri', '>= 1.16.7'
data/lib/epics/bka.rb ADDED
@@ -0,0 +1,17 @@
1
+ class Epics::BKA < Epics::GenericRequest
2
+ def header
3
+ client.header_request.build(
4
+ nonce: nonce,
5
+ timestamp: timestamp,
6
+ order_type: 'BKA',
7
+ order_attribute: 'DZHNN',
8
+ order_params: {
9
+ DateRange: {
10
+ Start: options[:from],
11
+ End: options[:to]
12
+ }
13
+ },
14
+ mutable: { TransactionPhase: 'Initialisation' }
15
+ )
16
+ end
17
+ end
data/lib/epics/client.rb CHANGED
@@ -1,13 +1,12 @@
1
1
  class Epics::Client
2
2
  extend Forwardable
3
3
 
4
- attr_accessor :passphrase, :url, :host_id, :user_id, :partner_id, :keys, :keys_content
4
+ attr_accessor :passphrase, :url, :host_id, :user_id, :partner_id, :keys, :keys_content, :locale, :product_name
5
5
  attr_writer :iban, :bic, :name
6
- attr_accessor :locale
7
6
 
8
7
  def_delegators :connection, :post
9
8
 
10
- def initialize(keys_content, passphrase, url, host_id, user_id, partner_id)
9
+ def initialize(keys_content, passphrase, url, host_id, user_id, partner_id, locale: Epics::DEFAULT_LOCALE, product_name: Epics::DEFAULT_PRODUCT_NAME)
11
10
  self.keys_content = keys_content.respond_to?(:read) ? keys_content.read : keys_content if keys_content
12
11
  self.passphrase = passphrase
13
12
  self.keys = extract_keys if keys_content
@@ -15,7 +14,8 @@ class Epics::Client
15
14
  self.host_id = host_id
16
15
  self.user_id = user_id
17
16
  self.partner_id = partner_id
18
- self.locale = :de
17
+ self.locale = locale
18
+ self.product_name = product_name
19
19
  end
20
20
 
21
21
  def inspect
@@ -182,6 +182,10 @@ class Epics::Client
182
182
  download(Epics::STA, from: from, to: to)
183
183
  end
184
184
 
185
+ def FDL(format, from = nil, to = nil)
186
+ download(Epics::FDL, file_format: format, from: from, to: to )
187
+ end
188
+
185
189
  def VMK(from = nil, to = nil)
186
190
  download(Epics::VMK, from: from, to: to)
187
191
  end
@@ -194,6 +198,10 @@ class Epics::Client
194
198
  download_and_unzip(Epics::CRZ, from: from, to: to)
195
199
  end
196
200
 
201
+ def BKA(from, to)
202
+ download_and_unzip(Epics::BKA, from: from, to: to)
203
+ end
204
+
197
205
  def C52(from, to)
198
206
  download_and_unzip(Epics::C52, from: from, to: to)
199
207
  end
data/lib/epics/fdl.rb ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Epics::FDL < Epics::GenericRequest
4
+ def header
5
+ fdl_order_params = Hash.new.tap do |params|
6
+ params[:DateRange] = {
7
+ Start: options[:from],
8
+ End: options[:to],
9
+ } if options[:from] && options[:to]
10
+ params[:FileFormat] = options[:file_format]
11
+ end
12
+
13
+ client.header_request.build(
14
+ nonce: nonce,
15
+ timestamp: timestamp,
16
+ order_type: 'FDL',
17
+ order_attribute: 'DZHNN',
18
+ order_id: 'A00A',
19
+ custom_order_params: { FDLOrderParams: fdl_order_params },
20
+ mutable: { TransactionPhase: 'Initialisation' }
21
+ )
22
+ end
23
+ end
@@ -2,9 +2,6 @@ class Epics::HeaderRequest
2
2
  extend Forwardable
3
3
  attr_accessor :client
4
4
 
5
- PRODUCT_NAME = 'EPICS - a ruby ebics kernel'
6
- PRODUCT_LANG = 'de'
7
-
8
5
  def initialize(client)
9
6
  self.client = client
10
7
  end
@@ -22,13 +19,14 @@ class Epics::HeaderRequest
22
19
  xml.Timestamp options[:timestamp] if options[:timestamp]
23
20
  xml.PartnerID partner_id
24
21
  xml.UserID user_id
25
- xml.Product(PRODUCT_NAME, 'Language' => PRODUCT_LANG)
22
+ xml.Product(client.product_name, 'Language' => client.locale)
26
23
  xml.OrderDetails {
27
24
  xml.OrderType options[:order_type]
28
25
  xml.OrderAttribute options[:order_attribute]
29
26
  xml.StandardOrderParams {
30
27
  build_attributes(xml, options[:order_params])
31
28
  } if options[:order_params]
29
+ build_attributes(xml, options[:custom_order_params]) if options[:custom_order_params]
32
30
  }
33
31
  xml.BankPubKeyDigests {
34
32
  xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: 'http://www.w3.org/2001/04/xmlenc#sha256')
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.6.0'
4
+ VERSION = '2.8.0'
5
5
  end
data/lib/epics.rb CHANGED
@@ -25,7 +25,9 @@ require "epics/hkd"
25
25
  require "epics/htd"
26
26
  require "epics/haa"
27
27
  require "epics/sta"
28
+ require "epics/fdl"
28
29
  require "epics/vmk"
30
+ require "epics/bka"
29
31
  require "epics/c52"
30
32
  require "epics/c53"
31
33
  require "epics/c54"
@@ -60,6 +62,8 @@ require "epics/client"
60
62
  I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'letter/locales', '*.yml')]
61
63
 
62
64
  module Epics
63
-
65
+ DEFAULT_PRODUCT_NAME = 'EPICS - a ruby ebics kernel'
66
+ DEFAULT_LOCALE = :de
64
67
  end
68
+
65
69
  Ebics = Epics
@@ -0,0 +1,11 @@
1
+ RSpec.describe Epics::BKA 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, from: "2014-09-01", to: "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,58 @@
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') }
3
+ let(:file_format) { 'camt.xxx.cfonb120.stm.Oby' }
4
+
5
+ context 'with file_format' do
6
+ subject(:order) { described_class.new(client, file_format: file_format) }
7
+
8
+ describe '#to_xml' do
9
+ specify { expect(order.to_xml).to be_a_valid_ebics_doc }
10
+
11
+ it 'does includes a date range as standard order parameter' do
12
+ expect(order.to_xml).to include('<FDLOrderParams><FileFormat>camt.xxx.cfonb120.stm.Oby</FileFormat></FDLOrderParams>')
13
+ end
14
+ end
15
+
16
+ describe '#to_receipt_xml' do
17
+ before { order.transaction_id = SecureRandom.hex(16) }
18
+
19
+ specify { expect(order.to_receipt_xml).to be_a_valid_ebics_doc }
20
+ end
21
+
22
+ context 'with DateRange' do
23
+ subject(:order) { described_class.new(client, file_format: file_format, from: Date.new(2024, 1, 1), to: Date.new(2024, 1, 2)) }
24
+
25
+ describe '#to_xml' do
26
+ specify { expect(order.to_xml).to be_a_valid_ebics_doc }
27
+
28
+ it 'does includes a date range as optional order parameter' do
29
+ 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
+ end
31
+ end
32
+
33
+ describe '#to_receipt_xml' do
34
+ before { order.transaction_id = SecureRandom.hex(16) }
35
+
36
+ specify { expect(order.to_receipt_xml).to be_a_valid_ebics_doc }
37
+ end
38
+ end
39
+ end
40
+
41
+ context 'without file_format' do
42
+ subject(:order) { described_class.new(client) }
43
+
44
+ describe '#to_xml' do
45
+ specify { expect(order.to_xml).to be_a_valid_ebics_doc }
46
+
47
+ it 'does not include a standard order parameter' do
48
+ expect(order.to_xml).to include('<FDLOrderParams><FileFormat/></FDLOrderParams>')
49
+ end
50
+ end
51
+
52
+ describe '#to_receipt_xml' do
53
+ before { order.transaction_id = SecureRandom.hex(16) }
54
+
55
+ specify { expect(order.to_receipt_xml).to be_a_valid_ebics_doc }
56
+ end
57
+ end
58
+ end
@@ -16,7 +16,7 @@ RSpec::Matchers.define :be_a_valid_ebics_doc do
16
16
  end
17
17
 
18
18
  description do
19
- "be a valid EBCIS document"
19
+ "be a valid EBICS document"
20
20
  end
21
21
 
22
22
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.8.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: 2024-11-27 00:00:00.000000000 Z
11
+ date: 2025-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bigdecimal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: faraday
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -177,7 +205,9 @@ description: |2
177
205
  CD1 CDD CCT CDB CDS CCS CDZ CRZ
178
206
  email:
179
207
  - lars@railslove.com
180
- executables: []
208
+ executables:
209
+ - console
210
+ - setup
181
211
  extensions: []
182
212
  extra_rdoc_files: []
183
213
  files:
@@ -190,10 +220,13 @@ files:
190
220
  - LICENSE.txt
191
221
  - README.md
192
222
  - Rakefile
223
+ - bin/console
224
+ - bin/setup
193
225
  - epics.gemspec
194
226
  - lib/epics.rb
195
227
  - lib/epics/azv.rb
196
228
  - lib/epics/b2b.rb
229
+ - lib/epics/bka.rb
197
230
  - lib/epics/c2s.rb
198
231
  - lib/epics/c52.rb
199
232
  - lib/epics/c53.rb
@@ -210,6 +243,7 @@ files:
210
243
  - lib/epics/client.rb
211
244
  - lib/epics/crz.rb
212
245
  - lib/epics/error.rb
246
+ - lib/epics/fdl.rb
213
247
  - lib/epics/generic_request.rb
214
248
  - lib/epics/generic_upload_request.rb
215
249
  - lib/epics/haa.rb
@@ -289,6 +323,7 @@ files:
289
323
  - spec/middleware/parse_ebics_spec.rb
290
324
  - spec/orders/azv_spec.rb
291
325
  - spec/orders/b2b_spec.rb
326
+ - spec/orders/bka_spec.rb
292
327
  - spec/orders/c2s_spec.rb
293
328
  - spec/orders/c52_spec.rb
294
329
  - spec/orders/c53_spec.rb
@@ -302,6 +337,7 @@ files:
302
337
  - spec/orders/cdz_spec.rb
303
338
  - spec/orders/cip_spec.rb
304
339
  - spec/orders/crz_spec.rb
340
+ - spec/orders/fdl_spec.rb
305
341
  - spec/orders/haa_spec.rb
306
342
  - spec/orders/hac_spec.rb
307
343
  - spec/orders/hia_spec.rb
@@ -362,7 +398,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
398
  - !ruby/object:Gem::Version
363
399
  version: '0'
364
400
  requirements: []
365
- rubygems_version: 3.5.19
401
+ rubygems_version: 3.5.22
366
402
  signing_key:
367
403
  specification_version: 4
368
404
  summary: a ruby implementation of the EBICS protocol
@@ -413,6 +449,7 @@ test_files:
413
449
  - spec/middleware/parse_ebics_spec.rb
414
450
  - spec/orders/azv_spec.rb
415
451
  - spec/orders/b2b_spec.rb
452
+ - spec/orders/bka_spec.rb
416
453
  - spec/orders/c2s_spec.rb
417
454
  - spec/orders/c52_spec.rb
418
455
  - spec/orders/c53_spec.rb
@@ -426,6 +463,7 @@ test_files:
426
463
  - spec/orders/cdz_spec.rb
427
464
  - spec/orders/cip_spec.rb
428
465
  - spec/orders/crz_spec.rb
466
+ - spec/orders/fdl_spec.rb
429
467
  - spec/orders/haa_spec.rb
430
468
  - spec/orders/hac_spec.rb
431
469
  - spec/orders/hia_spec.rb