diff --git a/lib/epics.rb b/lib/epics.rb
index 2376cd5..67fb8ed 100644
--- a/lib/epics.rb
+++ b/lib/epics.rb
@@ -37,6 +37,7 @@
require "epics/hpd"
require "epics/cd1"
require "epics/cct"
+require "epics/cip"
require "epics/ccs"
require "epics/cdb"
require "epics/cdd"
diff --git a/lib/epics/cip.rb b/lib/epics/cip.rb
new file mode 100644
index 0000000..1d177a5
--- /dev/null
+++ b/lib/epics/cip.rb
@@ -0,0 +1,14 @@
+class Epics::CIP < Epics::GenericUploadRequest
+ def header
+ client.header_request.build(
+ nonce: nonce,
+ timestamp: timestamp,
+ order_type: 'CIP',
+ order_attribute: 'OZHNN',
+ order_params: {},
+ num_segments: 1,
+ mutable: { TransactionPhase: 'Initialisation' }
+ )
+ end
+ end
+
\ No newline at end of file
diff --git a/lib/epics/client.rb b/lib/epics/client.rb
index deda7c3..8ee1ac5 100644
--- a/lib/epics/client.rb
+++ b/lib/epics/client.rb
@@ -91,6 +91,10 @@ def credit(document)
self.CCT(document)
end
+ def inst(document)
+ self.CIP(document)
+ end
+
def debit(document, type = :CDD)
self.public_send(type, document)
end
@@ -166,6 +170,10 @@ def CCT(document)
upload(Epics::CCT, document)
end
+ def CIP(document)
+ upload(Epics::CIP, document)
+ end
+
def CCS(document)
upload(Epics::CCS, document)
end
diff --git a/lib/epics/version.rb b/lib/epics/version.rb
index 06eb764..d73bdae 100644
--- a/lib/epics/version.rb
+++ b/lib/epics/version.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Epics
- VERSION = '2.4.0'
+ VERSION = '2.4.0.a'
end
diff --git a/spec/client_spec.rb b/spec/client_spec.rb
index 23515bb..9b6900b 100644
--- a/spec/client_spec.rb
+++ b/spec/client_spec.rb
@@ -88,7 +88,7 @@
end
it 'extracts the accessible order types of a subscriber' do
- expect(subject.order_types).to match_array(%w(PTK HPD HTD STA HVD HPB HAA HVT HVU HVZ INI SPR PUB HIA HCA HSA HVE HVS CCS CCT CD1 CDB CDD))
+ expect(subject.order_types).to match_array(%w(PTK HPD HTD STA HVD HPB HAA HVT HVU HVZ INI SPR PUB HIA HCA HSA HVE HVS CCS CCT CIP CD1 CDB CDD))
end
end
diff --git a/spec/fixtures/xml/cip.xml b/spec/fixtures/xml/cip.xml
new file mode 100644
index 0000000..5a59f1e
--- /dev/null
+++ b/spec/fixtures/xml/cip.xml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+ Message-ID-4711
+ 2021-07-29T09:30:47.000Z
+ 2
+ 6655.86
+
+ Initiator Name
+
+
+
+ Payment-Information-ID-4711
+ TRF
+ true
+ 2
+ 6655.86
+
+
+ SEPA
+
+ INST
+
+ 2021-07-30T11:00:00
+
+ Herr Schnellzahler
+
+
+
+ DE87200500001234567890
+
+
+
+
+ NOTPROVIDED
+
+
+ SLEV
+
+
+ OriginatorID1234
+
+
+ 6543.14
+
+
+ Frau HatschnelldasGeld
+
+
+
+ DE21500500009876543210
+
+
+
+ Unstructured Remittance Information
+
+
+
+
+ OriginatorID1235
+
+
+ 112.72
+
+
+ Herr Instant
+
+
+
+ DE21500500001234567897
+
+
+
+ Unstructured Remittance Information
+
+
+
+
+
diff --git a/spec/fixtures/xml/htd_order_data.xml b/spec/fixtures/xml/htd_order_data.xml
index 53697af..1fc8bad 100644
--- a/spec/fixtures/xml/htd_order_data.xml
+++ b/spec/fixtures/xml/htd_order_data.xml
@@ -127,6 +127,12 @@
Credit Transfer Initiation
1
+
+ CIP
+ Upload
+ Instant Credit Transfer Initiation
+ 1
+
CD1
Upload
diff --git a/spec/orders/cip_spec.rb b/spec/orders/cip_spec.rb
new file mode 100644
index 0000000..afb7e34
--- /dev/null
+++ b/spec/orders/cip_spec.rb
@@ -0,0 +1,22 @@
+RSpec.describe Epics::CIP 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', 'cip.xml') ) }
+ subject { described_class.new(client, document) }
+
+ describe 'order attributes' do
+ it { expect(subject.header.to_s).to include('OZHNN') }
+ it { expect(subject.header.to_s).to include('CIP') }
+ 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
+
\ No newline at end of file