epics 2.6.0 → 2.7.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: c51d24b50fdc5705acf921ecc331fbbc504be08c1615bb1e19e5586a808549cc
4
- data.tar.gz: 7da71fe00c348df5e32774633d6b14d1f22df867d69830811c8ed1db8c26134e
3
+ metadata.gz: 53a2a79b885cb022c062f828a88755b065c3e28610cf02b04520f8e3ec64379f
4
+ data.tar.gz: 741c01e277edb80130af0da516fb0353c9966800695c601693d1fb970566e1a0
5
5
  SHA512:
6
- metadata.gz: d28b7833d9b95b7c849918cbda0bb5edd8e8836688989e308ab7e90f0982b2f802604ac02acff0960a644db6b3941c32ce2b055c45d00678d5a8acb0778f430b
7
- data.tar.gz: 52bf70e50a99e2844a2c62115b6b59b3455e5fbedfcc1f575033a702a5d2838ac05fbfacb6e0438f4fee13b76e6837b6682e0aca4bb9cf6978d6eb1660317174
6
+ metadata.gz: 010ce5ba5b9582007e4408fb7fb26857a7ce90632dcd8c48bda1a96d9093a8387cae8a5b59695f7ca535df0a63b2a90922362c8b96c5fc72b8ca3e03e93f03f9
7
+ data.tar.gz: 19c3bb2aab6ed308d3122609eb7bd94c4808e156cb2e9294ec77e5a94173af26977e6c8c28ca6dea8f64228cdf8a55a73db167f66dd6d48956bbc98644901d14
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,13 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 2.7.0
4
+
5
+ - [ENHANCEMENT] Added FDL order type (thanks to @frantisekrokusek)
6
+ - [ENHANCEMENT] Added support for configuring locale and client/product name on initialization (thanks to @frantisekrokusek)
7
+
3
8
  ### 2.6.0
4
9
 
5
- - [ENHANCEMENT] Adds CIP order type (instant transfers)
10
+ - [ENHANCEMENT] Added CIP order type (instant transfers)
6
11
  - [ENHANCEMENT] Added gem metadata (thanks to @Nymuxyzo)
7
12
 
8
13
  ### 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 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/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
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.7.0'
5
5
  end
data/lib/epics.rb CHANGED
@@ -25,6 +25,7 @@ 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"
29
30
  require "epics/c52"
30
31
  require "epics/c53"
@@ -60,6 +61,8 @@ require "epics/client"
60
61
  I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'letter/locales', '*.yml')]
61
62
 
62
63
  module Epics
63
-
64
+ DEFAULT_PRODUCT_NAME = 'EPICS - a ruby ebics kernel'
65
+ DEFAULT_LOCALE = :de
64
66
  end
67
+
65
68
  Ebics = Epics
@@ -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,14 +1,14 @@
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.7.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: 2024-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -177,7 +177,9 @@ description: |2
177
177
  CD1 CDD CCT CDB CDS CCS CDZ CRZ
178
178
  email:
179
179
  - lars@railslove.com
180
- executables: []
180
+ executables:
181
+ - console
182
+ - setup
181
183
  extensions: []
182
184
  extra_rdoc_files: []
183
185
  files:
@@ -190,6 +192,8 @@ files:
190
192
  - LICENSE.txt
191
193
  - README.md
192
194
  - Rakefile
195
+ - bin/console
196
+ - bin/setup
193
197
  - epics.gemspec
194
198
  - lib/epics.rb
195
199
  - lib/epics/azv.rb
@@ -210,6 +214,7 @@ files:
210
214
  - lib/epics/client.rb
211
215
  - lib/epics/crz.rb
212
216
  - lib/epics/error.rb
217
+ - lib/epics/fdl.rb
213
218
  - lib/epics/generic_request.rb
214
219
  - lib/epics/generic_upload_request.rb
215
220
  - lib/epics/haa.rb
@@ -302,6 +307,7 @@ files:
302
307
  - spec/orders/cdz_spec.rb
303
308
  - spec/orders/cip_spec.rb
304
309
  - spec/orders/crz_spec.rb
310
+ - spec/orders/fdl_spec.rb
305
311
  - spec/orders/haa_spec.rb
306
312
  - spec/orders/hac_spec.rb
307
313
  - spec/orders/hia_spec.rb
@@ -362,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
368
  - !ruby/object:Gem::Version
363
369
  version: '0'
364
370
  requirements: []
365
- rubygems_version: 3.5.19
371
+ rubygems_version: 3.5.22
366
372
  signing_key:
367
373
  specification_version: 4
368
374
  summary: a ruby implementation of the EBICS protocol
@@ -426,6 +432,7 @@ test_files:
426
432
  - spec/orders/cdz_spec.rb
427
433
  - spec/orders/cip_spec.rb
428
434
  - spec/orders/crz_spec.rb
435
+ - spec/orders/fdl_spec.rb
429
436
  - spec/orders/haa_spec.rb
430
437
  - spec/orders/hac_spec.rb
431
438
  - spec/orders/hia_spec.rb