diff --git a/CHANGELOG.md b/CHANGELOG.md
index 66fe368..5984231 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
### Unreleased
+- [ENHANCEMENT] Adds C2S order tyoe
- [HOUSEKEEPING] updates nokogiri dependency
- [HOUSEKEEPING] updates rexml dependency
- [HOUSEKEEPING] adds Ruby 3.3 to CI
diff --git a/lib/epics.rb b/lib/epics.rb
index 39919b8..a27a13c 100644
--- a/lib/epics.rb
+++ b/lib/epics.rb
@@ -37,6 +37,7 @@
require "epics/b2b"
require "epics/xds"
require "epics/cds"
+require "epics/c2s"
require "epics/cdz"
require "epics/crz"
require "epics/xct"
diff --git a/lib/epics/c2s.rb b/lib/epics/c2s.rb
new file mode 100644
index 0000000..88a38d6
--- /dev/null
+++ b/lib/epics/c2s.rb
@@ -0,0 +1,9 @@
+class Epics::C2S < Epics::CDB
+ def order_attribute
+ "DZHNN"
+ end
+
+ def order_type
+ 'C2S'
+ end
+end
diff --git a/lib/epics/cdb.rb b/lib/epics/cdb.rb
index 45f2552..c004f24 100644
--- a/lib/epics/cdb.rb
+++ b/lib/epics/cdb.rb
@@ -1,4 +1,12 @@
class Epics::CDB < Epics::GenericUploadRequest
+ def order_attribute
+ 'OZHNN'
+ end
+
+ def order_type
+ 'CDB'
+ end
+
def header
Nokogiri::XML::Builder.new do |xml|
xml.header(authenticate: true) {
@@ -10,8 +18,8 @@ def header
xml.UserID user_id
xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de')
xml.OrderDetails {
- xml.OrderType 'CDB'
- xml.OrderAttribute 'OZHNN'
+ xml.OrderType order_type
+ xml.OrderAttribute order_attribute
xml.StandardOrderParams
}
xml.BankPubKeyDigests {
diff --git a/lib/epics/client.rb b/lib/epics/client.rb
index 62104c6..9fa6f59 100644
--- a/lib/epics/client.rb
+++ b/lib/epics/client.rb
@@ -129,6 +129,10 @@ def CDB(document)
upload(Epics::CDB, document)
end
+ def C2S(document)
+ upload(Epics::C2S, document)
+ end
+
def CDD(document)
upload(Epics::CDD, document)
end
diff --git a/spec/orders/c2s_spec.rb b/spec/orders/c2s_spec.rb
new file mode 100644
index 0000000..fba7b21
--- /dev/null
+++ b/spec/orders/c2s_spec.rb
@@ -0,0 +1,21 @@
+RSpec.describe Epics::C2S do
+
+ 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') }
+ let(:document) { File.read( File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'cdb.xml') ) }
+ subject { described_class.new(client, document) }
+
+ describe 'order attributes' do
+ it { expect(subject.header.to_s).to include('DZHNN') }
+ it { expect(subject.header.to_s).to include('C2S') }
+ end
+
+ describe '#to_xml' do
+ specify { expect(subject.to_xml).to be_a_valid_ebics_doc }
+ end
+
+ describe '#to_transfer_xml' do
+ before { subject.transaction_id = SecureRandom.hex(16) }
+
+ specify { expect(subject.to_transfer_xml).to be_a_valid_ebics_doc }
+ end
+end