-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #133 from gadimbaylisahil/add-crz-and-make-date-ra…
…nge-optional-for-cdz Adds CRZ order type and makes date range optional for CDZ
- Loading branch information
Showing
6 changed files
with
112 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
class Epics::CRZ < Epics::GenericRequest | ||
attr_accessor :from, :to | ||
|
||
def initialize(client, from = nil, to = nil) | ||
super(client) | ||
self.from = from | ||
self.to = to | ||
end | ||
|
||
def header | ||
Nokogiri::XML::Builder.new do |xml| | ||
xml.header(authenticate: true) { | ||
xml.static { | ||
xml.HostID host_id | ||
xml.Nonce nonce | ||
xml.Timestamp timestamp | ||
xml.PartnerID partner_id | ||
xml.UserID user_id | ||
xml.Product("EPICS - a ruby ebics kernel", 'Language' => 'de') | ||
xml.OrderDetails { | ||
xml.OrderType 'CRZ' | ||
xml.OrderAttribute 'DZHNN' | ||
if !!from && !!to | ||
xml.StandardOrderParams { | ||
xml.DateRange { | ||
xml.Start from | ||
xml.End to | ||
} | ||
} | ||
else | ||
xml.StandardOrderParams | ||
end | ||
} | ||
xml.BankPubKeyDigests { | ||
xml.Authentication(client.bank_x.public_digest, Version: 'X002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256") | ||
xml.Encryption(client.bank_e.public_digest, Version: 'E002', Algorithm: "http://www.w3.org/2001/04/xmlenc#sha256" ) | ||
} | ||
xml.SecurityMedium '0000' | ||
} | ||
xml.mutable { | ||
xml.TransactionPhase 'Initialisation' | ||
} | ||
} | ||
end.doc.root | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
RSpec.describe Epics::CDZ 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') } | ||
subject { described_class.new(client, "2014-09-01", "2014-09-30") } | ||
|
||
describe '#to_xml' do | ||
specify { expect(subject.to_xml).to be_a_valid_ebics_doc } | ||
context 'with date range' do | ||
subject { described_class.new(client, "2014-09-01", "2014-09-30") } | ||
|
||
describe '#to_xml' do | ||
specify { expect(subject.to_xml).to be_a_valid_ebics_doc } | ||
|
||
it 'does includes a date range as standard order parameter' do | ||
expect(subject.to_xml).to include('<StandardOrderParams><DateRange><Start>2014-09-01</Start><End>2014-09-30</End></DateRange></StandardOrderParams>') | ||
end | ||
end | ||
end | ||
|
||
context 'without date range' do | ||
subject { described_class.new(client) } | ||
|
||
describe '#to_xml' do | ||
specify { expect(subject.to_xml).to be_a_valid_ebics_doc } | ||
|
||
it 'does not include a standard order parameter' do | ||
expect(subject.to_xml).to include('<StandardOrderParams/>') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
RSpec.describe Epics::CRZ 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') } | ||
|
||
context 'with date range' do | ||
subject { described_class.new(client, "2014-09-01", "2014-09-30") } | ||
|
||
describe '#to_xml' do | ||
specify { expect(subject.to_xml).to be_a_valid_ebics_doc } | ||
|
||
it 'does includes a date range as standard order parameter' do | ||
expect(subject.to_xml).to include('<StandardOrderParams><DateRange><Start>2014-09-01</Start><End>2014-09-30</End></DateRange></StandardOrderParams>') | ||
end | ||
end | ||
end | ||
|
||
context 'without date range' do | ||
subject { described_class.new(client) } | ||
|
||
describe '#to_xml' do | ||
specify { expect(subject.to_xml).to be_a_valid_ebics_doc } | ||
|
||
it 'does not include a standard order parameter' do | ||
expect(subject.to_xml).to include('<StandardOrderParams/>') | ||
end | ||
end | ||
end | ||
end |