epics 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -0
- data/epics.gemspec +0 -1
- data/lib/epics.rb +0 -1
- data/lib/epics/azv.rb +26 -37
- data/lib/epics/c52.rb +26 -36
- data/lib/epics/c53.rb +26 -36
- data/lib/epics/c54.rb +26 -36
- data/lib/epics/cct.rb +24 -36
- data/lib/epics/cd1.rb +24 -36
- data/lib/epics/cdb.rb +24 -36
- data/lib/epics/cdd.rb +24 -35
- data/lib/epics/client.rb +8 -3
- data/lib/epics/generic_request.rb +54 -79
- data/lib/epics/generic_upload_request.rb +19 -27
- data/lib/epics/haa.rb +23 -34
- data/lib/epics/hac.rb +32 -41
- data/lib/epics/hia.rb +49 -57
- data/lib/epics/hkd.rb +23 -34
- data/lib/epics/hpb.rb +18 -21
- data/lib/epics/hpd.rb +23 -34
- data/lib/epics/htd.rb +23 -34
- data/lib/epics/ini.rb +43 -50
- data/lib/epics/ptk.rb +32 -38
- data/lib/epics/sta.rb +32 -41
- data/lib/epics/version.rb +1 -1
- data/lib/epics/vmk.rb +32 -41
- data/spec/client_spec.rb +14 -0
- data/spec/fixtures/xml/haa.xml +2 -0
- data/spec/fixtures/xml/haa_receipt.xml +31 -0
- data/spec/fixtures/xml/jruby/hia.xml +2 -0
- data/spec/fixtures/xml/jruby/ini.xml +2 -0
- data/spec/fixtures/xml/ruby/hia.xml +2 -0
- data/spec/fixtures/xml/ruby/ini.xml +2 -0
- data/spec/orders/azv_spec.rb +18 -0
- data/spec/orders/c54_spec.rb +0 -2
- data/spec/orders/haa_spec.rb +23 -1
- data/spec/orders/hia_spec.rb +1 -4
- data/spec/orders/ini_spec.rb +2 -6
- data/spec/orders/ptk_spec.rb +1 -3
- data/spec/orders/vmk_spec.rb +9 -0
- metadata +19 -23
- data/spec/fixtures/xml/hia.xml +0 -2
- data/spec/fixtures/xml/ini.xml +0 -2
data/lib/epics/cdb.rb
CHANGED
@@ -1,42 +1,30 @@
|
|
1
1
|
class Epics::CDB < Epics::GenericUploadRequest
|
2
|
-
|
3
2
|
def header
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
"OrderType" => "CDB",
|
18
|
-
"OrderAttribute" => "OZHNN",
|
19
|
-
"StandardOrderParams/" => ""
|
20
|
-
},
|
21
|
-
"BankPubKeyDigests" => {
|
22
|
-
"Authentication" => {
|
23
|
-
:@Version => "X002",
|
24
|
-
:@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
|
25
|
-
:content! => client.bank_x.public_digest
|
26
|
-
},
|
27
|
-
"Encryption" => {
|
28
|
-
:@Version => "E002",
|
29
|
-
:@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
|
30
|
-
:content! => client.bank_e.public_digest
|
3
|
+
Nokogiri::XML::Builder.new do |xml|
|
4
|
+
xml.header(authenticate: true) {
|
5
|
+
xml.static {
|
6
|
+
xml.HostID host_id
|
7
|
+
xml.Nonce nonce
|
8
|
+
xml.Timestamp timestamp
|
9
|
+
xml.PartnerID partner_id
|
10
|
+
xml.UserID user_id
|
11
|
+
xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
|
12
|
+
xml.OrderDetails {
|
13
|
+
xml.OrderType 'CDB'
|
14
|
+
xml.OrderAttribute 'OZHNN'
|
15
|
+
xml.StandardOrderParams
|
31
16
|
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
17
|
+
xml.BankPubKeyDigests {
|
18
|
+
xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
|
19
|
+
xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
|
20
|
+
}
|
21
|
+
xml.SecurityMedium '0000'
|
22
|
+
xml.NumSegments 1
|
23
|
+
}
|
24
|
+
xml.mutable {
|
25
|
+
xml.TransactionPhase 'Initialisation'
|
26
|
+
}
|
38
27
|
}
|
39
|
-
|
28
|
+
end.doc.root
|
40
29
|
end
|
41
|
-
|
42
30
|
end
|
data/lib/epics/cdd.rb
CHANGED
@@ -8,42 +8,31 @@ class Epics::CDD < Epics::GenericUploadRequest
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def header
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
"OrderType" => order_type,
|
25
|
-
"OrderAttribute" => order_attribute,
|
26
|
-
"StandardOrderParams/" => ""
|
27
|
-
},
|
28
|
-
"BankPubKeyDigests" => {
|
29
|
-
"Authentication" => {
|
30
|
-
:@Version => "X002",
|
31
|
-
:@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
|
32
|
-
:content! => client.bank_x.public_digest
|
33
|
-
},
|
34
|
-
"Encryption" => {
|
35
|
-
:@Version => "E002",
|
36
|
-
:@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
|
37
|
-
:content! => client.bank_e.public_digest
|
11
|
+
Nokogiri::XML::Builder.new do |xml|
|
12
|
+
xml.header(authenticate: true) {
|
13
|
+
xml.static {
|
14
|
+
xml.HostID host_id
|
15
|
+
xml.Nonce nonce
|
16
|
+
xml.Timestamp timestamp
|
17
|
+
xml.PartnerID partner_id
|
18
|
+
xml.UserID user_id
|
19
|
+
xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
|
20
|
+
xml.OrderDetails {
|
21
|
+
xml.OrderType order_type
|
22
|
+
xml.OrderAttribute order_attribute
|
23
|
+
xml.StandardOrderParams ''
|
38
24
|
}
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
25
|
+
xml.BankPubKeyDigests {
|
26
|
+
xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
|
27
|
+
xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
|
28
|
+
}
|
29
|
+
xml.SecurityMedium '0000'
|
30
|
+
xml.NumSegments 1
|
31
|
+
}
|
32
|
+
xml.mutable {
|
33
|
+
xml.TransactionPhase 'Initialisation'
|
34
|
+
}
|
45
35
|
}
|
46
|
-
|
36
|
+
end.doc.root
|
47
37
|
end
|
48
|
-
|
49
38
|
end
|
data/lib/epics/client.rb
CHANGED
@@ -55,6 +55,10 @@ class Epics::Client
|
|
55
55
|
@bic ||= (self.HTD; @bic)
|
56
56
|
end
|
57
57
|
|
58
|
+
def order_types
|
59
|
+
@order_types ||= (self.HTD; @order_types)
|
60
|
+
end
|
61
|
+
|
58
62
|
def self.setup(passphrase, url, host_id, user_id, partner_id, keysize = 2048)
|
59
63
|
client = new(nil, passphrase, url, host_id, user_id, partner_id)
|
60
64
|
client.keys = %w(A006 X002 E002).each_with_object({}) do |type, memo|
|
@@ -165,9 +169,10 @@ class Epics::Client
|
|
165
169
|
|
166
170
|
def HTD
|
167
171
|
Nokogiri::XML(download(Epics::HTD)).tap do |htd|
|
168
|
-
@iban
|
169
|
-
@bic
|
170
|
-
@name
|
172
|
+
@iban ||= htd.at_xpath("//xmlns:AccountNumber[@international='true']", xmlns: "urn:org:ebics:H004").text
|
173
|
+
@bic ||= htd.at_xpath("//xmlns:BankCode[@international='true']", xmlns: "urn:org:ebics:H004").text
|
174
|
+
@name ||= htd.at_xpath("//xmlns:Name", xmlns: "urn:org:ebics:H004").text
|
175
|
+
@order_types ||= htd.search("//xmlns:OrderTypes", xmlns: "urn:org:ebics:H004").map{|o| o.content.split(/\s/) }.delete_if{|o| o == ""}.flatten
|
171
176
|
end.to_xml
|
172
177
|
end
|
173
178
|
|
@@ -22,107 +22,82 @@ class Epics::GenericRequest
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def body
|
25
|
-
|
25
|
+
Nokogiri::XML::Builder.new do |xml|
|
26
|
+
xml.body
|
27
|
+
end.doc.root
|
26
28
|
end
|
27
29
|
|
28
30
|
def auth_signature
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
"ds:Reference/" => {
|
38
|
-
:@URI => "#xpointer(//*[@authenticate='true'])",
|
39
|
-
"ds:Transforms" => {
|
40
|
-
"ds:Transform/" => {
|
41
|
-
:@Algorithm => "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
|
31
|
+
Nokogiri::XML::Builder.new do |xml|
|
32
|
+
xml.AuthSignature{
|
33
|
+
xml.send('ds:SignedInfo') {
|
34
|
+
xml.send('ds:CanonicalizationMethod', '', Algorithm: "http://www.w3.org/TR/2001/REC-xml-c14n-20010315")
|
35
|
+
xml.send('ds:SignatureMethod', '', Algorithm: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256")
|
36
|
+
xml.send('ds:Reference', '', URI: "#xpointer(//*[@authenticate='true'])") {
|
37
|
+
xml.send('ds:Transforms') {
|
38
|
+
xml.send('ds:Transform', '', Algorithm: "http://www.w3.org/TR/2001/REC-xml-c14n-20010315")
|
42
39
|
}
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
},
|
47
|
-
"ds:DigestValue/" => ""
|
40
|
+
xml.send('ds:DigestMethod', '', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
|
41
|
+
xml.send('ds:DigestValue', '')
|
42
|
+
}
|
48
43
|
}
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
xml.send('ds:SignatureValue', '')
|
45
|
+
}
|
46
|
+
end.doc.root
|
52
47
|
end
|
53
48
|
|
54
49
|
def to_transfer_xml
|
55
|
-
Nokogiri::XML.
|
56
|
-
root => {
|
57
|
-
:
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
"header" => {
|
62
|
-
:@authenticate => true,
|
63
|
-
"static" => {
|
64
|
-
"HostID" => host_id,
|
65
|
-
"TransactionID" => transaction_id
|
66
|
-
},
|
67
|
-
"mutable" => {
|
68
|
-
"TransactionPhase" => "Transfer",
|
69
|
-
"SegmentNumber" => {
|
70
|
-
:@lastSegment => true,
|
71
|
-
:content! => 1
|
72
|
-
}
|
50
|
+
Nokogiri::XML::Builder.new do |xml|
|
51
|
+
xml.send(root, 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => 'urn:org:ebics:H004', 'Version' => 'H004', 'Revision' => '1') {
|
52
|
+
xml.header(authenticate: true) {
|
53
|
+
xml.static {
|
54
|
+
xml.HostID host_id
|
55
|
+
xml.TransactionID transaction_id
|
73
56
|
}
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
57
|
+
xml.mutable {
|
58
|
+
xml.TransactionPhase 'Transfer'
|
59
|
+
xml.SegmentNumber(1, lastSegment: true)
|
60
|
+
}
|
61
|
+
}
|
62
|
+
xml.parent.add_child(auth_signature)
|
63
|
+
xml.body {
|
64
|
+
xml.DataTransfer {
|
65
|
+
xml.OrderData encrypted_order_data
|
79
66
|
}
|
80
67
|
}
|
81
68
|
}
|
82
|
-
|
69
|
+
end.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML, encoding: 'utf-8')
|
83
70
|
end
|
84
71
|
|
85
72
|
def to_receipt_xml
|
86
|
-
Nokogiri::XML.
|
87
|
-
root => {
|
88
|
-
:
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
"header" => {
|
93
|
-
:@authenticate => true,
|
94
|
-
"static" => {
|
95
|
-
"HostID" => host_id,
|
96
|
-
"TransactionID" => transaction_id
|
97
|
-
},
|
98
|
-
"mutable" => {
|
99
|
-
"TransactionPhase" => "Receipt"
|
73
|
+
Nokogiri::XML::Builder.new do |xml|
|
74
|
+
xml.send(root, 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => 'urn:org:ebics:H004', 'Version' => 'H004', 'Revision' => '1') {
|
75
|
+
xml.header(authenticate: true) {
|
76
|
+
xml.static {
|
77
|
+
xml.HostID host_id
|
78
|
+
xml.TransactionID(transaction_id)
|
100
79
|
}
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
80
|
+
xml.mutable {
|
81
|
+
xml.TransactionPhase 'Receipt'
|
82
|
+
}
|
83
|
+
}
|
84
|
+
xml.parent.add_child(auth_signature)
|
85
|
+
xml.body {
|
86
|
+
xml.TransferReceipt(authenticate: true) {
|
87
|
+
xml.ReceiptCode 0
|
107
88
|
}
|
108
89
|
}
|
109
90
|
}
|
110
|
-
|
91
|
+
end.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML, encoding: 'utf-8')
|
111
92
|
end
|
112
93
|
|
113
94
|
def to_xml
|
114
|
-
Nokogiri::XML.
|
115
|
-
root => {
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
:@Revision => "1",
|
120
|
-
:header => header,
|
121
|
-
"AuthSignature" => auth_signature,
|
122
|
-
"body" => body
|
95
|
+
Nokogiri::XML::Builder.new do |xml|
|
96
|
+
xml.send(root, 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#', 'xmlns' => 'urn:org:ebics:H004', 'Version' => 'H004', 'Revision'=> '1') {
|
97
|
+
xml.parent.add_child(header)
|
98
|
+
xml.parent.add_child(auth_signature)
|
99
|
+
xml.parent.add_child(body)
|
123
100
|
}
|
124
|
-
|
101
|
+
end.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML, encoding: 'utf-8')
|
125
102
|
end
|
126
|
-
|
127
|
-
|
128
103
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
class Epics::GenericUploadRequest < Epics::GenericRequest
|
2
|
-
|
3
2
|
attr_accessor :key
|
4
3
|
attr_accessor :document
|
5
4
|
|
@@ -18,37 +17,30 @@ class Epics::GenericUploadRequest < Epics::GenericRequest
|
|
18
17
|
end
|
19
18
|
|
20
19
|
def body
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
},
|
30
|
-
"TransactionKey" => Base64.encode64(client.bank_e.key.public_encrypt(self.key)).gsub(/\n/,'')
|
31
|
-
},
|
32
|
-
"SignatureData" => {
|
33
|
-
:@authenticate => true,
|
34
|
-
:content! => encrypted_order_signature
|
20
|
+
Nokogiri::XML::Builder.new do |xml|
|
21
|
+
xml.body {
|
22
|
+
xml.DataTransfer {
|
23
|
+
xml.DataEncryptionInfo(authenticate: true) {
|
24
|
+
xml.EncryptionPubKeyDigest(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
|
25
|
+
xml.TransactionKey Base64.encode64(client.bank_e.key.public_encrypt(self.key)).gsub(/\n/,'')
|
26
|
+
}
|
27
|
+
xml.SignatureData(encrypted_order_signature, authenticate: true)
|
35
28
|
}
|
36
29
|
}
|
37
|
-
|
30
|
+
end.doc.root
|
38
31
|
end
|
39
32
|
|
40
33
|
def order_signature
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
"UserID" => user_id
|
34
|
+
Nokogiri::XML::Builder.new do |xml|
|
35
|
+
xml.UserSignatureData('xmlns' => 'http://www.ebics.org/S001', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://www.ebics.org/S001 http://www.ebics.org/S001/ebics_signature.xsd') {
|
36
|
+
xml.OrderSignatureData {
|
37
|
+
xml.SignatureVersion "A006"
|
38
|
+
xml.SignatureValue signature_value
|
39
|
+
xml.PartnerID partner_id
|
40
|
+
xml.UserID user_id
|
41
|
+
}
|
50
42
|
}
|
51
|
-
|
43
|
+
end.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML, encoding: 'utf-8')
|
52
44
|
end
|
53
45
|
|
54
46
|
def signature_value
|
@@ -83,4 +75,4 @@ class Epics::GenericUploadRequest < Epics::GenericRequest
|
|
83
75
|
end
|
84
76
|
end
|
85
77
|
|
86
|
-
end
|
78
|
+
end
|
data/lib/epics/haa.rb
CHANGED
@@ -1,40 +1,29 @@
|
|
1
1
|
class Epics::HAA < Epics::GenericRequest
|
2
|
-
|
3
2
|
def header
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
"OrderType" => "HAA",
|
18
|
-
"OrderAttribute" => "DZHNN",
|
19
|
-
"StandardOrderParams/" => ""
|
20
|
-
},
|
21
|
-
"BankPubKeyDigests" => {
|
22
|
-
"Authentication" => {
|
23
|
-
:@Version => "X002",
|
24
|
-
:@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
|
25
|
-
:content! => client.bank_x.public_digest
|
26
|
-
},
|
27
|
-
"Encryption" => {
|
28
|
-
:@Version => "E002",
|
29
|
-
:@Algorithm => "http://www.w3.org/2001/04/xmlenc#sha256",
|
30
|
-
:content! => client.bank_e.public_digest
|
3
|
+
Nokogiri::XML::Builder.new do |xml|
|
4
|
+
xml.header(authenticate: true) {
|
5
|
+
xml.static {
|
6
|
+
xml.HostID host_id
|
7
|
+
xml.Nonce nonce
|
8
|
+
xml.Timestamp timestamp
|
9
|
+
xml.PartnerID partner_id
|
10
|
+
xml.UserID user_id
|
11
|
+
xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
|
12
|
+
xml.OrderDetails {
|
13
|
+
xml.OrderType 'HAA'
|
14
|
+
xml.OrderAttribute 'DZHNN'
|
15
|
+
xml.StandardOrderParams
|
31
16
|
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
17
|
+
xml.BankPubKeyDigests {
|
18
|
+
xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256")
|
19
|
+
xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" )
|
20
|
+
}
|
21
|
+
xml.SecurityMedium '0000'
|
22
|
+
}
|
23
|
+
xml.mutable {
|
24
|
+
xml.TransactionPhase 'Initialisation'
|
25
|
+
}
|
37
26
|
}
|
38
|
-
|
27
|
+
end.doc.root
|
39
28
|
end
|
40
29
|
end
|