epics 3.0.0.rc2 → 3.0.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 +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +22 -0
- data/lib/epics/builders/order_details_builder/v3.rb +25 -1
- data/lib/epics/client.rb +1 -1
- data/lib/epics/version.rb +1 -1
- data/spec/builders_spec.rb +54 -0
- data/spec/request_factory_spec.rb +19 -0
- data/spec/support/ebics_shared_examples.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f9d505e87c6753d7e10cf2092fa02e9ec4fff0c93476fb47c32e8aabd834012
|
|
4
|
+
data.tar.gz: 0da7d015ff42a77a23e3ee3f91d6a26a353dba9e107cd6275e73a9b5132fef13
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cfd418610ca95b6ff2d29b407a5699721391e7b1197dffd271f52b7cb71e7c219629110c74ff77732a03a83ebf7f1d8696de9496eda636b6e4b2ddfd86d0c239
|
|
7
|
+
data.tar.gz: 21f19dee4287bca68b4b055148735445fb6893002a51dc73ebcc44ea3de597debae3b1397cbcdc8e8e129a7fa84908f0b70852527d40f5c2c6b70e2507962270
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
### Unreleased
|
|
2
2
|
|
|
3
|
+
### 3.0.0
|
|
4
|
+
|
|
5
|
+
- [FIX] H005 uploads were sent without `SignatureFlag` in `BTUOrderParams`, although they
|
|
6
|
+
carry the user's ES (electronic signature), so banks treated them as orders
|
|
7
|
+
to be authorised outside EBICS and some rejected them with `EBICS_INVALID_ORDER_TYPE`.
|
|
8
|
+
`SignatureFlag` is now set by default, matching `OZHNN` on H004. Pass `request_eds: true`
|
|
9
|
+
to spool the order into the EDS (distributed electronic signature, German VEU)
|
|
10
|
+
when signatures are still missing, or `signature_flag: false` to omit the flag
|
|
11
|
+
|
|
12
|
+
### 3.0.0.rc2
|
|
13
|
+
|
|
3
14
|
- [FIX] A download spanning several segments returned only its first segment, so zipped
|
|
4
15
|
downloads such as `C52` and `C53` raised `Zip::Error` and plain ones such as `STA` came
|
|
5
16
|
back cut off without an error. The remaining segments are now requested in the transfer
|
data/README.md
CHANGED
|
@@ -307,6 +307,28 @@ practice requires it to be supplied (guidelines §5.2).
|
|
|
307
307
|
When it is absent the bank assumes a global definition.
|
|
308
308
|
On EBICS 2.4/2.5 these parameters have no equivalent and are ignored.
|
|
309
309
|
|
|
310
|
+
### Signatures on uploads
|
|
311
|
+
|
|
312
|
+
EBICS 3.0 replaces the order attribute (`OZHNN`, `DZHNN`) with `SignatureFlag`, which tells
|
|
313
|
+
the bank whether an upload carries the user's ES (electronic signature). Uploads always
|
|
314
|
+
include it and send `SignatureFlag` by default, the equivalent of `OZHNN`: the bank expects
|
|
315
|
+
every required signature in the request and rejects the order otherwise.
|
|
316
|
+
|
|
317
|
+
```ruby
|
|
318
|
+
# spool into the EDS (distributed electronic signature, German VEU) when signatures are
|
|
319
|
+
# still missing, e.g. for a user who needs a second signer
|
|
320
|
+
e.CCT(document, request_eds: true)
|
|
321
|
+
|
|
322
|
+
# no SignatureFlag: the order is authorised outside EBICS, e.g. by an accompanying slip
|
|
323
|
+
# or in online banking
|
|
324
|
+
e.CCT(document, signature_flag: false)
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
`signature_flag: false` only drops the flag; the user's signature is still sent.
|
|
328
|
+
|
|
329
|
+
On EBICS 2.4/2.5 both options have no effect and are silently ignored: uploads keep
|
|
330
|
+
their fixed order attribute (`OZHNN` for the payment uploads).
|
|
331
|
+
|
|
310
332
|
## Features
|
|
311
333
|
|
|
312
334
|
### Initialization
|
|
@@ -32,8 +32,22 @@ class Epics::Builders::OrderDetailsBuilder::V3 < Epics::Builders::OrderDetailsBu
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def add_btu_order_params(
|
|
35
|
-
filename:,
|
|
35
|
+
filename:,
|
|
36
|
+
service_name:,
|
|
37
|
+
msg_name:,
|
|
38
|
+
scope: nil,
|
|
39
|
+
service_option: nil,
|
|
40
|
+
container_type: nil,
|
|
41
|
+
msg_name_version: nil,
|
|
42
|
+
msg_name_variant: nil,
|
|
43
|
+
msg_name_format: nil,
|
|
44
|
+
signature_flag: true,
|
|
45
|
+
request_eds: false
|
|
36
46
|
)
|
|
47
|
+
if request_eds && !signature_flag
|
|
48
|
+
raise ArgumentError, 'request_eds requires signature_flag'
|
|
49
|
+
end
|
|
50
|
+
|
|
37
51
|
@xml.BTUOrderParams fileName: filename do |xml|
|
|
38
52
|
xml.Service do
|
|
39
53
|
xml.ServiceName service_name
|
|
@@ -46,6 +60,16 @@ class Epics::Builders::OrderDetailsBuilder::V3 < Epics::Builders::OrderDetailsBu
|
|
|
46
60
|
msg_name_attributes[:format] = msg_name_format if msg_name_format
|
|
47
61
|
xml.MsgName msg_name, msg_name_attributes
|
|
48
62
|
end
|
|
63
|
+
# Without SignatureFlag the bank treats the order as carrying no ES (electronic
|
|
64
|
+
# signature) and expects authorisation outside EBICS. requestEDS asks the bank to
|
|
65
|
+
# spool the order into the EDS (distributed electronic signature, German VEU,
|
|
66
|
+
# "Verteilte Elektronische Unterschrift") instead of rejecting it when signatures
|
|
67
|
+
# are still missing.
|
|
68
|
+
if signature_flag
|
|
69
|
+
signature_flag_attributes = {}
|
|
70
|
+
signature_flag_attributes[:requestEDS] = 'true' if request_eds
|
|
71
|
+
xml.SignatureFlag '', signature_flag_attributes
|
|
72
|
+
end
|
|
49
73
|
end
|
|
50
74
|
end
|
|
51
75
|
end
|
data/lib/epics/client.rb
CHANGED
|
@@ -724,7 +724,7 @@ class Epics::Client
|
|
|
724
724
|
data["#{host_id.upcase}.#{sig.version}"] = dump_signature(sig)
|
|
725
725
|
end
|
|
726
726
|
|
|
727
|
-
JSON.pretty_generate(data
|
|
727
|
+
JSON.pretty_generate(data)
|
|
728
728
|
end
|
|
729
729
|
|
|
730
730
|
# Keys without a certificate keep the bare-string form so key files stay readable by
|
data/lib/epics/version.rb
CHANGED
data/spec/builders_spec.rb
CHANGED
|
@@ -317,6 +317,60 @@ RSpec.describe 'Builders' do
|
|
|
317
317
|
expect(container).not_to be_nil
|
|
318
318
|
expect(container['containerType']).to eq('ZIP')
|
|
319
319
|
end
|
|
320
|
+
|
|
321
|
+
it 'adds SignatureFlag after Service by default' do
|
|
322
|
+
instance = described_class::V3.new do |b|
|
|
323
|
+
b.add_btu_order_params(
|
|
324
|
+
filename: 'test.xml', service_name: 'MCT', msg_name: 'pain.001'
|
|
325
|
+
)
|
|
326
|
+
end
|
|
327
|
+
xml = parse_doc(instance)
|
|
328
|
+
params = xml.at('OrderDetails/BTUOrderParams')
|
|
329
|
+
expect(params.element_children.map(&:name)).to eq(%w[Service SignatureFlag])
|
|
330
|
+
expect(params.at('SignatureFlag')['requestEDS']).to be_nil
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
it 'sets requestEDS on SignatureFlag when request_eds is given' do
|
|
334
|
+
instance = described_class::V3.new do |b|
|
|
335
|
+
b.add_btu_order_params(
|
|
336
|
+
filename: 'test.xml',
|
|
337
|
+
service_name: 'MCT',
|
|
338
|
+
msg_name: 'pain.001',
|
|
339
|
+
request_eds: true
|
|
340
|
+
)
|
|
341
|
+
end
|
|
342
|
+
xml = parse_doc(instance)
|
|
343
|
+
params = xml.at('OrderDetails/BTUOrderParams')
|
|
344
|
+
expect(params.at('SignatureFlag')['requestEDS']).to eq('true')
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
it 'omits SignatureFlag when signature_flag is false' do
|
|
348
|
+
instance = described_class::V3.new do |b|
|
|
349
|
+
b.add_btu_order_params(
|
|
350
|
+
filename: 'test.xml',
|
|
351
|
+
service_name: 'MCT',
|
|
352
|
+
msg_name: 'pain.001',
|
|
353
|
+
signature_flag: false
|
|
354
|
+
)
|
|
355
|
+
end
|
|
356
|
+
xml = parse_doc(instance)
|
|
357
|
+
params = xml.at('OrderDetails/BTUOrderParams')
|
|
358
|
+
expect(params.at('SignatureFlag')).to be_nil
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
it 'rejects request_eds without signature_flag' do
|
|
362
|
+
expect do
|
|
363
|
+
described_class::V3.new do |b|
|
|
364
|
+
b.add_btu_order_params(
|
|
365
|
+
filename: 'test.xml',
|
|
366
|
+
service_name: 'MCT',
|
|
367
|
+
msg_name: 'pain.001',
|
|
368
|
+
signature_flag: false,
|
|
369
|
+
request_eds: true
|
|
370
|
+
)
|
|
371
|
+
end
|
|
372
|
+
end.to raise_error(ArgumentError, /request_eds/)
|
|
373
|
+
end
|
|
320
374
|
end
|
|
321
375
|
end
|
|
322
376
|
end
|
|
@@ -439,6 +439,25 @@ RSpec.describe 'RequestFactory' do
|
|
|
439
439
|
params = xml.at('//BTUOrderParams')
|
|
440
440
|
expect(params['fileName']).to eq('custom.xml')
|
|
441
441
|
end
|
|
442
|
+
|
|
443
|
+
it 'create_xe2 without override has SignatureFlag without requestEDS' do
|
|
444
|
+
xml = parse(factory.create_xe2(digest, transaction_key))
|
|
445
|
+
params = xml.at('//BTUOrderParams')
|
|
446
|
+
expect(params.at('SignatureFlag')).not_to be_nil
|
|
447
|
+
expect(params.at('SignatureFlag')['requestEDS']).to be_nil
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
it 'create_xe2 accepts request_eds override' do
|
|
451
|
+
xml = parse(factory.create_xe2(digest, transaction_key, request_eds: true))
|
|
452
|
+
params = xml.at('//BTUOrderParams')
|
|
453
|
+
expect(params.at('SignatureFlag')['requestEDS']).to eq('true')
|
|
454
|
+
end
|
|
455
|
+
|
|
456
|
+
it 'create_xe2 accepts signature_flag override' do
|
|
457
|
+
xml = parse(factory.create_xe2(digest, transaction_key, signature_flag: false))
|
|
458
|
+
params = xml.at('//BTUOrderParams')
|
|
459
|
+
expect(params.at('SignatureFlag')).to be_nil
|
|
460
|
+
end
|
|
442
461
|
end
|
|
443
462
|
end
|
|
444
463
|
end
|
|
@@ -469,6 +469,10 @@ RSpec.shared_examples 'a valid ebicsRequest H005 upload' do |service_name:, msg_
|
|
|
469
469
|
expect(service.at_xpath('e:MsgName', ns).text).to eq(msg_name)
|
|
470
470
|
end
|
|
471
471
|
|
|
472
|
+
it 'has SignatureFlag' do
|
|
473
|
+
expect(xml.at_xpath('//e:header/e:static/e:OrderDetails/e:BTUOrderParams/e:SignatureFlag', ns)).not_to be_nil
|
|
474
|
+
end
|
|
475
|
+
|
|
472
476
|
if scope
|
|
473
477
|
it "has Scope #{scope}" do
|
|
474
478
|
service = xml.at_xpath('//e:header/e:static/e:OrderDetails/e:BTUOrderParams/e:Service', ns)
|