sepa 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,16 @@ require 'sepa/payments_initiation/pain00800104/customer_direct_debit_initiation'
4
4
 
5
5
  class Sepa::DirectDebitOrder
6
6
 
7
+ module Helper
8
+ def blank? item
9
+ item == nil || blank_string?(item)
10
+ end
11
+
12
+ def blank_string? item
13
+ item.is_a?(String) && item.strip.length == 0
14
+ end
15
+ end
16
+
7
17
  class Order
8
18
  attr_accessor :message_id, :initiating_party, :creditor_payments
9
19
 
@@ -11,28 +21,39 @@ class Sepa::DirectDebitOrder
11
21
  @message_id, @initiating_party, @creditor_payments = message_id, initiating_party, creditor_payments
12
22
  end
13
23
 
14
- def to_properties
24
+ def to_properties opts
15
25
  hsh = {
16
- "group_header.message_identification" => message_id,
17
- "group_header.creation_date_time" => Time.now,
18
- "group_header.number_of_transactions" => creditor_payments.inject(0) { |sum, cp| sum + cp.number_of_transactions },
26
+ "group_header.message_identification" => message_id,
27
+ "group_header.creation_date_time" => Time.now,
28
+ "group_header.number_of_transactions" => creditor_payments.inject(0) { |sum, cp| sum + cp.number_of_transactions },
29
+ "group_header.control_sum" => creditor_payments.inject(0) { |sum, cp| sum + cp.control_sum },
19
30
  }
20
31
 
21
- hsh = hsh.merge initiating_party.to_properties("group_header.initiating_party")
32
+ hsh = hsh.merge initiating_party.to_properties("group_header.initiating_party", opts)
33
+
34
+ cps = []
35
+ if opts[:pain_008_001_version] == "02"
36
+ creditor_payments.each do |creditor_payment|
37
+ creditor_payment.collect_by_sequence_type { |cp| cps << cp }
38
+ end
39
+ else
40
+ cps = creditor_payments
41
+ end
22
42
 
23
- creditor_payments.each_with_index { |cp, i|
24
- hsh = hsh.merge(cp.to_properties("payment_information[#{i}]"))
43
+ cps.each_with_index { |cp, i|
44
+ hsh = hsh.merge(cp.to_properties("payment_information[#{i}]", opts))
25
45
  }
26
46
 
27
47
  hsh
28
48
  end
29
49
 
30
- def to_xml
31
- Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation.new(to_properties).generate_xml
50
+ def to_xml opts={ }
51
+ Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation.new(to_properties opts).generate_xml(opts)
32
52
  end
33
53
  end
34
54
 
35
55
  class Party
56
+ include Helper
36
57
  attr_accessor :name, :address_line_1, :address_line_2, :postcode, :town, :country, :contact_name, :contact_phone, :contact_email
37
58
 
38
59
  def initialize name, address_line_1, address_line_2, postcode, town, country, contact_name, contact_phone, contact_email
@@ -40,27 +61,23 @@ class Sepa::DirectDebitOrder
40
61
  @contact_name, @contact_phone, @contact_email = contact_name, contact_phone, contact_email
41
62
  end
42
63
 
43
- def to_properties prefix
44
- hsh = {
45
- "#{prefix}.name" => name,
46
- "#{prefix}.postal_address.address_line[0]" => address_line_1,
47
- "#{prefix}.postal_address.post_code" => postcode,
48
- "#{prefix}.postal_address.town_name" => town,
49
- "#{prefix}.postal_address.country" => country,
50
- "#{prefix}.contact_details.name" => contact_name,
51
- "#{prefix}.contact_details.phone_number" => contact_phone,
52
- "#{prefix}.contact_details.email_address" => contact_email,
53
- }
54
-
55
- hsh["#{prefix}.postal_address.address_line[1]"] = address_line_2 if address_line_2
56
-
64
+ def to_properties prefix, opts
65
+ hsh = { "#{prefix}.name" => name }
66
+ hsh["#{prefix}.postal_address.address_line[0]"] = address_line_1 unless blank? address_line_1
67
+ hsh["#{prefix}.postal_address.address_line[1]"] = address_line_2 unless blank? address_line_2
68
+ hsh["#{prefix}.postal_address.post_code"] = postcode unless blank? postcode
69
+ hsh["#{prefix}.postal_address.town_name"] = town unless blank? town
70
+ hsh["#{prefix}.postal_address.country"] = country unless blank? country
71
+ hsh["#{prefix}.contact_details.name"] = contact_name unless blank? contact_name
72
+ hsh["#{prefix}.contact_details.phone_number"] = contact_phone unless blank? contact_phone
73
+ hsh["#{prefix}.contact_details.email_address"] = contact_email unless blank? contact_email
57
74
  hsh
58
75
  end
59
76
  end
60
77
 
61
78
  class CreditorPayment
62
79
  attr_accessor :creditor, :creditor_account, :id, :collection_date
63
- attr_accessor :direct_debits
80
+ attr_accessor :direct_debits, :sequence_type
64
81
 
65
82
  def initialize creditor, creditor_account, id, collection_date, direct_debits
66
83
  @creditor, @creditor_account = creditor, creditor_account
@@ -68,22 +85,58 @@ class Sepa::DirectDebitOrder
68
85
  @direct_debits = direct_debits
69
86
  end
70
87
 
88
+ # this is only called for V02, in which case SequenceType is mandatory
89
+ # necessary because each PaymentInformation container contains a single SequenceType element (inside PaymentTypeInformation)
90
+ # whereas in V04, there is one SequenceType element per DirectDebitTransactionInformation
91
+ def collect_by_sequence_type
92
+ seq_types = {
93
+ "FRST" => [],
94
+ "RCUR" => [],
95
+ "FNAL" => [],
96
+ "OOFF" => []
97
+ }
98
+
99
+ direct_debits.each do |dd|
100
+ seq_types[dd.sequence_type] << dd
101
+ end
102
+
103
+ seq_types.each do |seq_type, dds|
104
+ next if dds.empty?
105
+ ncp = CreditorPayment.new(creditor, creditor_account, "#{id}_#{seq_type}", collection_date, dds)
106
+ ncp.sequence_type = seq_type
107
+ yield ncp
108
+ end
109
+ end
110
+
71
111
  def number_of_transactions
72
112
  direct_debits.length
73
113
  end
74
114
 
75
- def to_properties prefix
115
+ def control_sum
116
+ direct_debits.inject(0) { |sum, dd| sum + dd.amount }
117
+ end
118
+
119
+ def to_properties prefix, opts
76
120
  hsh = {
77
- "#{prefix}.payment_information_identification" => id,
78
- "#{prefix}.payment_method" => "DD",
79
- "#{prefix}.requested_collection_date" => collection_date
121
+ "#{prefix}.payment_information_identification" => id,
122
+ "#{prefix}.payment_type_information.service_level.code" => "SEPA",
123
+ "#{prefix}.payment_type_information.local_instrument.code" => "CORE",
124
+ "#{prefix}.payment_method" => "DD",
125
+ "#{prefix}.requested_collection_date" => collection_date,
126
+ "#{prefix}.number_of_transactions" => number_of_transactions,
127
+ "#{prefix}.control_sum" => control_sum,
128
+ "#{prefix}.charge_bearer" => "SLEV"
80
129
  }
81
130
 
82
- hsh = hsh.merge creditor.to_properties("#{prefix}.creditor")
83
- hsh = hsh.merge creditor_account.to_properties("#{prefix}.creditor")
131
+ if opts[:pain_008_001_version] == "02"
132
+ hsh["#{prefix}.payment_type_information.sequence_type"] = sequence_type
133
+ end
134
+
135
+ hsh = hsh.merge creditor.to_properties("#{prefix}.creditor", opts)
136
+ hsh = hsh.merge creditor_account.to_properties("#{prefix}.creditor", opts)
84
137
 
85
138
  direct_debits.each_with_index { |dd, j|
86
- hsh = hsh.merge(dd.to_properties("#{prefix}.direct_debit_transaction_information[#{j}]"))
139
+ hsh = hsh.merge(dd.to_properties("#{prefix}.direct_debit_transaction_information[#{j}]", opts))
87
140
  }
88
141
 
89
142
  hsh
@@ -97,7 +150,7 @@ class Sepa::DirectDebitOrder
97
150
  @iban, @swift = iban, swift
98
151
  end
99
152
 
100
- def to_properties prefix
153
+ def to_properties prefix, opts
101
154
  { "#{prefix}_account.identification.iban" => iban,
102
155
  "#{prefix}_agent.financial_institution_identification.bic_fi" => swift }
103
156
  end
@@ -110,23 +163,22 @@ class Sepa::DirectDebitOrder
110
163
  @debtor, @debtor_account, @end_to_end_id, @amount, @currency, @sequence_type, @mandate_identification = debtor, debtor_account, end_to_end_id, amount, currency, sequence_type, mandate_identification
111
164
  end
112
165
 
113
- def to_properties prefix
166
+ def to_properties prefix, opts
114
167
  hsh = {
115
168
  "#{prefix}.payment_identification.end_to_end_identification" => end_to_end_id,
116
169
  "#{prefix}.instructed_amount" => ("%.2f" % amount),
117
170
  "#{prefix}.instructed_amount_currency" => "EUR",
171
+ "#{prefix}.direct_debit_transaction.mandate_related_information.mandate_identification" => mandate_identification
118
172
  }
119
- hsh = hsh.merge debtor.to_properties("#{prefix}.debtor")
120
- hsh = hsh.merge debtor_account.to_properties("#{prefix}.debtor")
121
- unless sequence_type == nil || sequence_type == ""
122
- hsh = hsh.merge({ "#{prefix}.payment_type_information.sequence_type" => sequence_type })
123
- end
124
- unless mandate_identification == nil || mandate_identification == ""
125
- hsh = hsh.merge({ "#{prefix}.direct_debit_transaction.mandate_related_information.mandate_identification" => mandate_identification })
173
+ hsh = hsh.merge debtor.to_properties("#{prefix}.debtor", opts)
174
+ hsh = hsh.merge debtor_account.to_properties("#{prefix}.debtor", opts)
175
+
176
+ if opts[:pain_008_001_version] == "04"
177
+ hsh["#{prefix}.payment_type_information.sequence_type"] = sequence_type
126
178
  end
179
+
127
180
  hsh
128
181
  end
129
182
  end
130
183
 
131
184
  end
132
-
@@ -5,10 +5,16 @@ class Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation < Se
5
5
  attribute :group_header , "GrpHdr", Sepa::PaymentsInitiation::Pain00800104::GroupHeader
6
6
  attribute :payment_information , "PmtInf", :[], Sepa::PaymentsInitiation::Pain00800104::PaymentInformation
7
7
 
8
- def generate_xml
8
+ def generate_xml opts
9
+ pain_008_001_version = opts[:pain_008_001_version]
10
+
11
+ unless %w{ 02 04 }.include?(pain_008_001_version)
12
+ raise "unknown SEPA pain-008-001 version: #{pain_008_001_version.inspect} - use '04' or '02'"
13
+ end
14
+
9
15
  builder = Builder::XmlMarkup.new(:indent => 2)
10
16
  builder.instruct!
11
- builder.Document(:xmlns=>"urn:iso:std:iso:20022:tech:xsd:pain.008.001.04", :"xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", :"xsi:schemaLocation"=>"urn:iso:std:iso:20022:tech:xsd:pain.008.001.04 pain.008.001.04.xsd") {
17
+ builder.Document(:xmlns=>"urn:iso:std:iso:20022:tech:xsd:pain.008.001.#{pain_008_001_version}", :"xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", :"xsi:schemaLocation"=>"urn:iso:std:iso:20022:tech:xsd:pain.008.001.04 pain.008.001.04.xsd") {
12
18
  builder.CstmrDrctDbtInitn {
13
19
  self.to_xml builder
14
20
  }
@@ -6,7 +6,7 @@ class Sepa::PaymentsInitiation::Pain00800104::PaymentInformation < Sepa::Base
6
6
  attribute :batch_booking , "BtchBookg"
7
7
  attribute :number_of_transactions , "NbOfTxs"
8
8
  attribute :control_sum , "CtrlSum"
9
- attribute :payment_type_information , "PmtTpInf"
9
+ attribute :payment_type_information , "PmtTpInf" , Sepa::PaymentsInitiation::Pain00800104::PaymentTypeInformation
10
10
  attribute :requested_collection_date , "ReqdColltnDt", Date
11
11
  attribute :creditor , "Cdtr" , Sepa::PaymentsInitiation::PartyIdentification
12
12
  attribute :creditor_account , "CdtrAcct" , Sepa::PaymentsInitiation::CashAccount
@@ -19,4 +19,3 @@ class Sepa::PaymentsInitiation::Pain00800104::PaymentInformation < Sepa::Base
19
19
  attribute :creditor_scheme_identification , "CdtrSchmeId" , Sepa::PaymentsInitiation::PartyIdentification
20
20
  attribute :direct_debit_transaction_information, "DrctDbtTxInf", :[], Sepa::PaymentsInitiation::Pain00800104::DirectDebitTransactionInformation
21
21
  end
22
-
data/lib/sepa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sepa
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/sepa.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.add_dependency 'builder'
19
19
  gem.add_dependency 'aduki'
20
20
  gem.add_development_dependency 'rspec', '~> 2.9'
21
+ gem.add_development_dependency 'rspec_numbering_formatter'
21
22
 
22
23
  gem.files = `git ls-files`.split($/)
23
24
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -5,29 +5,52 @@ require "time"
5
5
 
6
6
  describe Sepa::DirectDebitOrder do
7
7
 
8
- it "should produce xml corresponding to the given inputs" do
8
+ let(:order) {
9
9
  bank_account0 = Sepa::DirectDebitOrder::BankAccount.new "FRZIZIPAPARAZZI345789", "FRZZPPKOOKOO"
10
10
  debtor0 = Sepa::DirectDebitOrder::Party.new "DALTON/CONANMR", "64, Livva de Getamire", nil, "30005", "RENNES", "FR", "Conan DALTON", "01234567890", "conan@dalton.sepa.i.hope.this.works"
11
- dd0 = Sepa::DirectDebitOrder::DirectDebit.new debtor0, bank_account0, "MONECOLE REG F13789 PVT 3", 1231.31, "EUR", nil, "mandate-id-0"
11
+ dd00 = Sepa::DirectDebitOrder::DirectDebit.new debtor0, bank_account0, "MONECOLE REG F13789 PVT 3", 1231.31, "EUR", "RCUR", "mandate-id-0"
12
+ dd01 = Sepa::DirectDebitOrder::DirectDebit.new debtor0, bank_account0, "MONECOLE REG F13791 PVT 3", 1133.33, "EUR", "RCUR", "mandate-id-0"
12
13
 
13
14
  bank_account1 = Sepa::DirectDebitOrder::BankAccount.new "FRQUIQUIWIGWAM947551", "FRQQWIGGA"
14
15
  debtor1 = Sepa::DirectDebitOrder::Party.new "ADAMS/SAMUELMR", "256, Livva de Getamire", nil, "75048", "PARIS", "FR", "Samuel ADAMS", "09876543210", "samuel@adams.sepa.i.hope.this.works"
15
- dd1 = Sepa::DirectDebitOrder::DirectDebit.new debtor1, bank_account1, "MONECOLE REG F13790 PVT 3", 1732.32, "EUR", "FRST", "mandate-id-1"
16
+ dd10 = Sepa::DirectDebitOrder::DirectDebit.new debtor1, bank_account1, "MONECOLE REG F13790 PVT 3", 1732.32, "EUR", "FRST", "mandate-id-1"
17
+ dd11 = Sepa::DirectDebitOrder::DirectDebit.new debtor1, bank_account1, "MONECOLE REG F13792 PVT 3", 1034.34, "EUR", "FRST", "mandate-id-1"
18
+
19
+ bank_account2 = Sepa::DirectDebitOrder::BankAccount.new "FRQUIQUIWIGWAM947551", "FRQQWIGGA"
20
+ debtor2 = Sepa::DirectDebitOrder::Party.new "ADAMS/SAMUELMR", "512, Livva de Meet Agir", nil, "75099", "PARIS", "FR", "Johann S. BACH", "09876543210", "js@bach.sepa.i.hope.this.works"
21
+ dd20 = Sepa::DirectDebitOrder::DirectDebit.new debtor2, bank_account2, "MONECOLE REG F13793 PVT 3", 1935.35, "EUR", "RCUR", "mandate-id-1"
22
+ dd21 = Sepa::DirectDebitOrder::DirectDebit.new debtor2, bank_account2, "MONECOLE REG F13794 PVT 3", 1236.36, "EUR", "RCUR", "mandate-id-1"
16
23
 
17
24
  sepa_now = Time.strptime "1992-02-28T18:30:00", "%Y-%m-%dT%H:%M:%S"
18
25
  Time.stub(:now).and_return sepa_now
19
26
 
20
27
  creditor = Sepa::DirectDebitOrder::Party.new "Mon École", "3, Livva de Getamire", nil, "75022", "Paris", "FR", "M. le Directeur", "+33 999 999 999", "directeur@monecole.softify.com"
21
28
  creditor_account = Sepa::DirectDebitOrder::BankAccount.new "FRGOOGOOYADDA9999999", "FRGGYELLOW99"
22
- payment = Sepa::DirectDebitOrder::CreditorPayment.new creditor, creditor_account, "MONECOLE_PAYMENTS_20130703", Date.parse("2013-07-10"), [dd0, dd1]
29
+ payment = Sepa::DirectDebitOrder::CreditorPayment.new creditor, creditor_account, "MONECOLE_PAYMENTS_20130703", Date.parse("2013-07-10"), [dd00, dd01, dd10, dd11, dd20, dd21]
23
30
 
24
31
  initiator = Sepa::DirectDebitOrder::Party.new "SOFTIFY SARL", "289, Livva de Getamire", nil, "75021", "Paris", "FR", "M. Le Gérant", "+33 111 111 111", "gerant@softify.bigbang"
25
32
 
26
- order = Sepa::DirectDebitOrder::Order.new "MSG0001", initiator, [payment]
33
+ Sepa::DirectDebitOrder::Order.new "MSG0001", initiator, [payment]
34
+ }
27
35
 
28
- xml = order.to_xml
29
- expected = File.read(File.expand_path("../expected_customer_direct_debit_initiation.xml", __FILE__))
36
+ it "should produce v02 xml corresponding to the given inputs" do
37
+ xml = order.to_xml pain_008_001_version: "02"
38
+ expected = File.read(File.expand_path("../expected_customer_direct_debit_initiation_v02.xml", __FILE__))
39
+ expected.force_encoding(Encoding::UTF_8)
30
40
  xml.should == expected
31
41
  end
32
- end
33
42
 
43
+ it "should produce v04 xml corresponding to the given inputs" do
44
+ xml = order.to_xml pain_008_001_version: "04"
45
+ expected = File.read(File.expand_path("../expected_customer_direct_debit_initiation_v04.xml", __FILE__))
46
+ expected.force_encoding(Encoding::UTF_8)
47
+ xml.should == expected
48
+ end
49
+
50
+ it "should not produce empty address elements" do
51
+ debtor = Sepa::DirectDebitOrder::Party.new "M Conan Dalton", "", nil, "", "", nil, nil, "", ""
52
+ props = debtor.to_properties "x", { }
53
+ props["x.name"].should == "M Conan Dalton"
54
+ props.keys.length.should == 1
55
+ end
56
+ end
@@ -19,10 +19,21 @@
19
19
  <EmailAdr>gerant@softify.bigbang</EmailAdr>
20
20
  </CtctDtls>
21
21
  </InitgPty>
22
+ <CtrlSum>2963.63</CtrlSum>
22
23
  </GrpHdr>
23
24
  <PmtInf>
24
25
  <PmtInfId>MONECOLE_PAYMENTS_20130703</PmtInfId>
25
26
  <PmtMtd>DD</PmtMtd>
27
+ <NbOfTxs>2</NbOfTxs>
28
+ <CtrlSum>2963.63</CtrlSum>
29
+ <PmtTpInf>
30
+ <SvcLvl>
31
+ <Cd>SEPA</Cd>
32
+ </SvcLvl>
33
+ <LclInstrm>
34
+ <Cd>CORE</Cd>
35
+ </LclInstrm>
36
+ </PmtTpInf>
26
37
  <ReqdColltnDt>2013-07-10</ReqdColltnDt>
27
38
  <Cdtr>
28
39
  <Nm>Mon École</Nm>
@@ -0,0 +1,317 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.008.001.04 pain.008.001.04.xsd">
3
+ <CstmrDrctDbtInitn>
4
+ <GrpHdr>
5
+ <MsgId>MSG0001</MsgId>
6
+ <CreDtTm>1992-02-28T18:30:00</CreDtTm>
7
+ <NbOfTxs>6</NbOfTxs>
8
+ <InitgPty>
9
+ <Nm>SOFTIFY SARL</Nm>
10
+ <PstlAdr>
11
+ <PstCd>75021</PstCd>
12
+ <TwnNm>Paris</TwnNm>
13
+ <Ctry>FR</Ctry>
14
+ <AdrLine>289, Livva de Getamire</AdrLine>
15
+ </PstlAdr>
16
+ <CtctDtls>
17
+ <Nm>M. Le Gérant</Nm>
18
+ <PhneNb>+33 111 111 111</PhneNb>
19
+ <EmailAdr>gerant@softify.bigbang</EmailAdr>
20
+ </CtctDtls>
21
+ </InitgPty>
22
+ <CtrlSum>8303.01</CtrlSum>
23
+ </GrpHdr>
24
+ <PmtInf>
25
+ <PmtInfId>MONECOLE_PAYMENTS_20130703_FRST</PmtInfId>
26
+ <PmtMtd>DD</PmtMtd>
27
+ <NbOfTxs>2</NbOfTxs>
28
+ <CtrlSum>2766.66</CtrlSum>
29
+ <PmtTpInf>
30
+ <SvcLvl>
31
+ <Cd>SEPA</Cd>
32
+ </SvcLvl>
33
+ <LclInstrm>
34
+ <Cd>CORE</Cd>
35
+ </LclInstrm>
36
+ <SeqTp>FRST</SeqTp>
37
+ </PmtTpInf>
38
+ <ReqdColltnDt>2013-07-10</ReqdColltnDt>
39
+ <Cdtr>
40
+ <Nm>Mon École</Nm>
41
+ <PstlAdr>
42
+ <PstCd>75022</PstCd>
43
+ <TwnNm>Paris</TwnNm>
44
+ <Ctry>FR</Ctry>
45
+ <AdrLine>3, Livva de Getamire</AdrLine>
46
+ </PstlAdr>
47
+ <CtctDtls>
48
+ <Nm>M. le Directeur</Nm>
49
+ <PhneNb>+33 999 999 999</PhneNb>
50
+ <EmailAdr>directeur@monecole.softify.com</EmailAdr>
51
+ </CtctDtls>
52
+ </Cdtr>
53
+ <CdtrAcct>
54
+ <Id>
55
+ <IBAN>FRGOOGOOYADDA9999999</IBAN>
56
+ </Id>
57
+ </CdtrAcct>
58
+ <CdtrAgt>
59
+ <FinInstnId>
60
+ <BICFI>FRGGYELLOW99</BICFI>
61
+ </FinInstnId>
62
+ </CdtrAgt>
63
+ <ChrgBr>SLEV</ChrgBr>
64
+ <DrctDbtTxInf>
65
+ <PmtId>
66
+ <EndToEndId>MONECOLE REG F13790 PVT 3</EndToEndId>
67
+ </PmtId>
68
+ <InstdAmt Ccy="EUR">1732.32</InstdAmt>
69
+ <DrctDbtTx>
70
+ <MndtRltdInf>
71
+ <MndtId>mandate-id-1</MndtId>
72
+ </MndtRltdInf>
73
+ </DrctDbtTx>
74
+ <DbtrAgt>
75
+ <FinInstnId>
76
+ <BICFI>FRQQWIGGA</BICFI>
77
+ </FinInstnId>
78
+ </DbtrAgt>
79
+ <Dbtr>
80
+ <Nm>ADAMS/SAMUELMR</Nm>
81
+ <PstlAdr>
82
+ <PstCd>75048</PstCd>
83
+ <TwnNm>PARIS</TwnNm>
84
+ <Ctry>FR</Ctry>
85
+ <AdrLine>256, Livva de Getamire</AdrLine>
86
+ </PstlAdr>
87
+ <CtctDtls>
88
+ <Nm>Samuel ADAMS</Nm>
89
+ <PhneNb>09876543210</PhneNb>
90
+ <EmailAdr>samuel@adams.sepa.i.hope.this.works</EmailAdr>
91
+ </CtctDtls>
92
+ </Dbtr>
93
+ <DbtrAcct>
94
+ <Id>
95
+ <IBAN>FRQUIQUIWIGWAM947551</IBAN>
96
+ </Id>
97
+ </DbtrAcct>
98
+ </DrctDbtTxInf>
99
+ <DrctDbtTxInf>
100
+ <PmtId>
101
+ <EndToEndId>MONECOLE REG F13792 PVT 3</EndToEndId>
102
+ </PmtId>
103
+ <InstdAmt Ccy="EUR">1034.34</InstdAmt>
104
+ <DrctDbtTx>
105
+ <MndtRltdInf>
106
+ <MndtId>mandate-id-1</MndtId>
107
+ </MndtRltdInf>
108
+ </DrctDbtTx>
109
+ <DbtrAgt>
110
+ <FinInstnId>
111
+ <BICFI>FRQQWIGGA</BICFI>
112
+ </FinInstnId>
113
+ </DbtrAgt>
114
+ <Dbtr>
115
+ <Nm>ADAMS/SAMUELMR</Nm>
116
+ <PstlAdr>
117
+ <PstCd>75048</PstCd>
118
+ <TwnNm>PARIS</TwnNm>
119
+ <Ctry>FR</Ctry>
120
+ <AdrLine>256, Livva de Getamire</AdrLine>
121
+ </PstlAdr>
122
+ <CtctDtls>
123
+ <Nm>Samuel ADAMS</Nm>
124
+ <PhneNb>09876543210</PhneNb>
125
+ <EmailAdr>samuel@adams.sepa.i.hope.this.works</EmailAdr>
126
+ </CtctDtls>
127
+ </Dbtr>
128
+ <DbtrAcct>
129
+ <Id>
130
+ <IBAN>FRQUIQUIWIGWAM947551</IBAN>
131
+ </Id>
132
+ </DbtrAcct>
133
+ </DrctDbtTxInf>
134
+ </PmtInf>
135
+ <PmtInf>
136
+ <PmtInfId>MONECOLE_PAYMENTS_20130703_RCUR</PmtInfId>
137
+ <PmtMtd>DD</PmtMtd>
138
+ <NbOfTxs>4</NbOfTxs>
139
+ <CtrlSum>5536.349999999999</CtrlSum>
140
+ <PmtTpInf>
141
+ <SvcLvl>
142
+ <Cd>SEPA</Cd>
143
+ </SvcLvl>
144
+ <LclInstrm>
145
+ <Cd>CORE</Cd>
146
+ </LclInstrm>
147
+ <SeqTp>RCUR</SeqTp>
148
+ </PmtTpInf>
149
+ <ReqdColltnDt>2013-07-10</ReqdColltnDt>
150
+ <Cdtr>
151
+ <Nm>Mon École</Nm>
152
+ <PstlAdr>
153
+ <PstCd>75022</PstCd>
154
+ <TwnNm>Paris</TwnNm>
155
+ <Ctry>FR</Ctry>
156
+ <AdrLine>3, Livva de Getamire</AdrLine>
157
+ </PstlAdr>
158
+ <CtctDtls>
159
+ <Nm>M. le Directeur</Nm>
160
+ <PhneNb>+33 999 999 999</PhneNb>
161
+ <EmailAdr>directeur@monecole.softify.com</EmailAdr>
162
+ </CtctDtls>
163
+ </Cdtr>
164
+ <CdtrAcct>
165
+ <Id>
166
+ <IBAN>FRGOOGOOYADDA9999999</IBAN>
167
+ </Id>
168
+ </CdtrAcct>
169
+ <CdtrAgt>
170
+ <FinInstnId>
171
+ <BICFI>FRGGYELLOW99</BICFI>
172
+ </FinInstnId>
173
+ </CdtrAgt>
174
+ <ChrgBr>SLEV</ChrgBr>
175
+ <DrctDbtTxInf>
176
+ <PmtId>
177
+ <EndToEndId>MONECOLE REG F13789 PVT 3</EndToEndId>
178
+ </PmtId>
179
+ <InstdAmt Ccy="EUR">1231.31</InstdAmt>
180
+ <DrctDbtTx>
181
+ <MndtRltdInf>
182
+ <MndtId>mandate-id-0</MndtId>
183
+ </MndtRltdInf>
184
+ </DrctDbtTx>
185
+ <DbtrAgt>
186
+ <FinInstnId>
187
+ <BICFI>FRZZPPKOOKOO</BICFI>
188
+ </FinInstnId>
189
+ </DbtrAgt>
190
+ <Dbtr>
191
+ <Nm>DALTON/CONANMR</Nm>
192
+ <PstlAdr>
193
+ <PstCd>30005</PstCd>
194
+ <TwnNm>RENNES</TwnNm>
195
+ <Ctry>FR</Ctry>
196
+ <AdrLine>64, Livva de Getamire</AdrLine>
197
+ </PstlAdr>
198
+ <CtctDtls>
199
+ <Nm>Conan DALTON</Nm>
200
+ <PhneNb>01234567890</PhneNb>
201
+ <EmailAdr>conan@dalton.sepa.i.hope.this.works</EmailAdr>
202
+ </CtctDtls>
203
+ </Dbtr>
204
+ <DbtrAcct>
205
+ <Id>
206
+ <IBAN>FRZIZIPAPARAZZI345789</IBAN>
207
+ </Id>
208
+ </DbtrAcct>
209
+ </DrctDbtTxInf>
210
+ <DrctDbtTxInf>
211
+ <PmtId>
212
+ <EndToEndId>MONECOLE REG F13791 PVT 3</EndToEndId>
213
+ </PmtId>
214
+ <InstdAmt Ccy="EUR">1133.33</InstdAmt>
215
+ <DrctDbtTx>
216
+ <MndtRltdInf>
217
+ <MndtId>mandate-id-0</MndtId>
218
+ </MndtRltdInf>
219
+ </DrctDbtTx>
220
+ <DbtrAgt>
221
+ <FinInstnId>
222
+ <BICFI>FRZZPPKOOKOO</BICFI>
223
+ </FinInstnId>
224
+ </DbtrAgt>
225
+ <Dbtr>
226
+ <Nm>DALTON/CONANMR</Nm>
227
+ <PstlAdr>
228
+ <PstCd>30005</PstCd>
229
+ <TwnNm>RENNES</TwnNm>
230
+ <Ctry>FR</Ctry>
231
+ <AdrLine>64, Livva de Getamire</AdrLine>
232
+ </PstlAdr>
233
+ <CtctDtls>
234
+ <Nm>Conan DALTON</Nm>
235
+ <PhneNb>01234567890</PhneNb>
236
+ <EmailAdr>conan@dalton.sepa.i.hope.this.works</EmailAdr>
237
+ </CtctDtls>
238
+ </Dbtr>
239
+ <DbtrAcct>
240
+ <Id>
241
+ <IBAN>FRZIZIPAPARAZZI345789</IBAN>
242
+ </Id>
243
+ </DbtrAcct>
244
+ </DrctDbtTxInf>
245
+ <DrctDbtTxInf>
246
+ <PmtId>
247
+ <EndToEndId>MONECOLE REG F13793 PVT 3</EndToEndId>
248
+ </PmtId>
249
+ <InstdAmt Ccy="EUR">1935.35</InstdAmt>
250
+ <DrctDbtTx>
251
+ <MndtRltdInf>
252
+ <MndtId>mandate-id-1</MndtId>
253
+ </MndtRltdInf>
254
+ </DrctDbtTx>
255
+ <DbtrAgt>
256
+ <FinInstnId>
257
+ <BICFI>FRQQWIGGA</BICFI>
258
+ </FinInstnId>
259
+ </DbtrAgt>
260
+ <Dbtr>
261
+ <Nm>ADAMS/SAMUELMR</Nm>
262
+ <PstlAdr>
263
+ <PstCd>75099</PstCd>
264
+ <TwnNm>PARIS</TwnNm>
265
+ <Ctry>FR</Ctry>
266
+ <AdrLine>512, Livva de Meet Agir</AdrLine>
267
+ </PstlAdr>
268
+ <CtctDtls>
269
+ <Nm>Johann S. BACH</Nm>
270
+ <PhneNb>09876543210</PhneNb>
271
+ <EmailAdr>js@bach.sepa.i.hope.this.works</EmailAdr>
272
+ </CtctDtls>
273
+ </Dbtr>
274
+ <DbtrAcct>
275
+ <Id>
276
+ <IBAN>FRQUIQUIWIGWAM947551</IBAN>
277
+ </Id>
278
+ </DbtrAcct>
279
+ </DrctDbtTxInf>
280
+ <DrctDbtTxInf>
281
+ <PmtId>
282
+ <EndToEndId>MONECOLE REG F13794 PVT 3</EndToEndId>
283
+ </PmtId>
284
+ <InstdAmt Ccy="EUR">1236.36</InstdAmt>
285
+ <DrctDbtTx>
286
+ <MndtRltdInf>
287
+ <MndtId>mandate-id-1</MndtId>
288
+ </MndtRltdInf>
289
+ </DrctDbtTx>
290
+ <DbtrAgt>
291
+ <FinInstnId>
292
+ <BICFI>FRQQWIGGA</BICFI>
293
+ </FinInstnId>
294
+ </DbtrAgt>
295
+ <Dbtr>
296
+ <Nm>ADAMS/SAMUELMR</Nm>
297
+ <PstlAdr>
298
+ <PstCd>75099</PstCd>
299
+ <TwnNm>PARIS</TwnNm>
300
+ <Ctry>FR</Ctry>
301
+ <AdrLine>512, Livva de Meet Agir</AdrLine>
302
+ </PstlAdr>
303
+ <CtctDtls>
304
+ <Nm>Johann S. BACH</Nm>
305
+ <PhneNb>09876543210</PhneNb>
306
+ <EmailAdr>js@bach.sepa.i.hope.this.works</EmailAdr>
307
+ </CtctDtls>
308
+ </Dbtr>
309
+ <DbtrAcct>
310
+ <Id>
311
+ <IBAN>FRQUIQUIWIGWAM947551</IBAN>
312
+ </Id>
313
+ </DbtrAcct>
314
+ </DrctDbtTxInf>
315
+ </PmtInf>
316
+ </CstmrDrctDbtInitn>
317
+ </Document>
@@ -0,0 +1,293 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.04" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.008.001.04 pain.008.001.04.xsd">
3
+ <CstmrDrctDbtInitn>
4
+ <GrpHdr>
5
+ <MsgId>MSG0001</MsgId>
6
+ <CreDtTm>1992-02-28T18:30:00</CreDtTm>
7
+ <NbOfTxs>6</NbOfTxs>
8
+ <InitgPty>
9
+ <Nm>SOFTIFY SARL</Nm>
10
+ <PstlAdr>
11
+ <PstCd>75021</PstCd>
12
+ <TwnNm>Paris</TwnNm>
13
+ <Ctry>FR</Ctry>
14
+ <AdrLine>289, Livva de Getamire</AdrLine>
15
+ </PstlAdr>
16
+ <CtctDtls>
17
+ <Nm>M. Le Gérant</Nm>
18
+ <PhneNb>+33 111 111 111</PhneNb>
19
+ <EmailAdr>gerant@softify.bigbang</EmailAdr>
20
+ </CtctDtls>
21
+ </InitgPty>
22
+ <CtrlSum>8303.01</CtrlSum>
23
+ </GrpHdr>
24
+ <PmtInf>
25
+ <PmtInfId>MONECOLE_PAYMENTS_20130703</PmtInfId>
26
+ <PmtMtd>DD</PmtMtd>
27
+ <NbOfTxs>6</NbOfTxs>
28
+ <CtrlSum>8303.01</CtrlSum>
29
+ <PmtTpInf>
30
+ <SvcLvl>
31
+ <Cd>SEPA</Cd>
32
+ </SvcLvl>
33
+ <LclInstrm>
34
+ <Cd>CORE</Cd>
35
+ </LclInstrm>
36
+ </PmtTpInf>
37
+ <ReqdColltnDt>2013-07-10</ReqdColltnDt>
38
+ <Cdtr>
39
+ <Nm>Mon École</Nm>
40
+ <PstlAdr>
41
+ <PstCd>75022</PstCd>
42
+ <TwnNm>Paris</TwnNm>
43
+ <Ctry>FR</Ctry>
44
+ <AdrLine>3, Livva de Getamire</AdrLine>
45
+ </PstlAdr>
46
+ <CtctDtls>
47
+ <Nm>M. le Directeur</Nm>
48
+ <PhneNb>+33 999 999 999</PhneNb>
49
+ <EmailAdr>directeur@monecole.softify.com</EmailAdr>
50
+ </CtctDtls>
51
+ </Cdtr>
52
+ <CdtrAcct>
53
+ <Id>
54
+ <IBAN>FRGOOGOOYADDA9999999</IBAN>
55
+ </Id>
56
+ </CdtrAcct>
57
+ <CdtrAgt>
58
+ <FinInstnId>
59
+ <BICFI>FRGGYELLOW99</BICFI>
60
+ </FinInstnId>
61
+ </CdtrAgt>
62
+ <ChrgBr>SLEV</ChrgBr>
63
+ <DrctDbtTxInf>
64
+ <PmtId>
65
+ <EndToEndId>MONECOLE REG F13789 PVT 3</EndToEndId>
66
+ </PmtId>
67
+ <PmtTpInf>
68
+ <SeqTp>RCUR</SeqTp>
69
+ </PmtTpInf>
70
+ <InstdAmt Ccy="EUR">1231.31</InstdAmt>
71
+ <DrctDbtTx>
72
+ <MndtRltdInf>
73
+ <MndtId>mandate-id-0</MndtId>
74
+ </MndtRltdInf>
75
+ </DrctDbtTx>
76
+ <DbtrAgt>
77
+ <FinInstnId>
78
+ <BICFI>FRZZPPKOOKOO</BICFI>
79
+ </FinInstnId>
80
+ </DbtrAgt>
81
+ <Dbtr>
82
+ <Nm>DALTON/CONANMR</Nm>
83
+ <PstlAdr>
84
+ <PstCd>30005</PstCd>
85
+ <TwnNm>RENNES</TwnNm>
86
+ <Ctry>FR</Ctry>
87
+ <AdrLine>64, Livva de Getamire</AdrLine>
88
+ </PstlAdr>
89
+ <CtctDtls>
90
+ <Nm>Conan DALTON</Nm>
91
+ <PhneNb>01234567890</PhneNb>
92
+ <EmailAdr>conan@dalton.sepa.i.hope.this.works</EmailAdr>
93
+ </CtctDtls>
94
+ </Dbtr>
95
+ <DbtrAcct>
96
+ <Id>
97
+ <IBAN>FRZIZIPAPARAZZI345789</IBAN>
98
+ </Id>
99
+ </DbtrAcct>
100
+ </DrctDbtTxInf>
101
+ <DrctDbtTxInf>
102
+ <PmtId>
103
+ <EndToEndId>MONECOLE REG F13791 PVT 3</EndToEndId>
104
+ </PmtId>
105
+ <PmtTpInf>
106
+ <SeqTp>RCUR</SeqTp>
107
+ </PmtTpInf>
108
+ <InstdAmt Ccy="EUR">1133.33</InstdAmt>
109
+ <DrctDbtTx>
110
+ <MndtRltdInf>
111
+ <MndtId>mandate-id-0</MndtId>
112
+ </MndtRltdInf>
113
+ </DrctDbtTx>
114
+ <DbtrAgt>
115
+ <FinInstnId>
116
+ <BICFI>FRZZPPKOOKOO</BICFI>
117
+ </FinInstnId>
118
+ </DbtrAgt>
119
+ <Dbtr>
120
+ <Nm>DALTON/CONANMR</Nm>
121
+ <PstlAdr>
122
+ <PstCd>30005</PstCd>
123
+ <TwnNm>RENNES</TwnNm>
124
+ <Ctry>FR</Ctry>
125
+ <AdrLine>64, Livva de Getamire</AdrLine>
126
+ </PstlAdr>
127
+ <CtctDtls>
128
+ <Nm>Conan DALTON</Nm>
129
+ <PhneNb>01234567890</PhneNb>
130
+ <EmailAdr>conan@dalton.sepa.i.hope.this.works</EmailAdr>
131
+ </CtctDtls>
132
+ </Dbtr>
133
+ <DbtrAcct>
134
+ <Id>
135
+ <IBAN>FRZIZIPAPARAZZI345789</IBAN>
136
+ </Id>
137
+ </DbtrAcct>
138
+ </DrctDbtTxInf>
139
+ <DrctDbtTxInf>
140
+ <PmtId>
141
+ <EndToEndId>MONECOLE REG F13790 PVT 3</EndToEndId>
142
+ </PmtId>
143
+ <PmtTpInf>
144
+ <SeqTp>FRST</SeqTp>
145
+ </PmtTpInf>
146
+ <InstdAmt Ccy="EUR">1732.32</InstdAmt>
147
+ <DrctDbtTx>
148
+ <MndtRltdInf>
149
+ <MndtId>mandate-id-1</MndtId>
150
+ </MndtRltdInf>
151
+ </DrctDbtTx>
152
+ <DbtrAgt>
153
+ <FinInstnId>
154
+ <BICFI>FRQQWIGGA</BICFI>
155
+ </FinInstnId>
156
+ </DbtrAgt>
157
+ <Dbtr>
158
+ <Nm>ADAMS/SAMUELMR</Nm>
159
+ <PstlAdr>
160
+ <PstCd>75048</PstCd>
161
+ <TwnNm>PARIS</TwnNm>
162
+ <Ctry>FR</Ctry>
163
+ <AdrLine>256, Livva de Getamire</AdrLine>
164
+ </PstlAdr>
165
+ <CtctDtls>
166
+ <Nm>Samuel ADAMS</Nm>
167
+ <PhneNb>09876543210</PhneNb>
168
+ <EmailAdr>samuel@adams.sepa.i.hope.this.works</EmailAdr>
169
+ </CtctDtls>
170
+ </Dbtr>
171
+ <DbtrAcct>
172
+ <Id>
173
+ <IBAN>FRQUIQUIWIGWAM947551</IBAN>
174
+ </Id>
175
+ </DbtrAcct>
176
+ </DrctDbtTxInf>
177
+ <DrctDbtTxInf>
178
+ <PmtId>
179
+ <EndToEndId>MONECOLE REG F13792 PVT 3</EndToEndId>
180
+ </PmtId>
181
+ <PmtTpInf>
182
+ <SeqTp>FRST</SeqTp>
183
+ </PmtTpInf>
184
+ <InstdAmt Ccy="EUR">1034.34</InstdAmt>
185
+ <DrctDbtTx>
186
+ <MndtRltdInf>
187
+ <MndtId>mandate-id-1</MndtId>
188
+ </MndtRltdInf>
189
+ </DrctDbtTx>
190
+ <DbtrAgt>
191
+ <FinInstnId>
192
+ <BICFI>FRQQWIGGA</BICFI>
193
+ </FinInstnId>
194
+ </DbtrAgt>
195
+ <Dbtr>
196
+ <Nm>ADAMS/SAMUELMR</Nm>
197
+ <PstlAdr>
198
+ <PstCd>75048</PstCd>
199
+ <TwnNm>PARIS</TwnNm>
200
+ <Ctry>FR</Ctry>
201
+ <AdrLine>256, Livva de Getamire</AdrLine>
202
+ </PstlAdr>
203
+ <CtctDtls>
204
+ <Nm>Samuel ADAMS</Nm>
205
+ <PhneNb>09876543210</PhneNb>
206
+ <EmailAdr>samuel@adams.sepa.i.hope.this.works</EmailAdr>
207
+ </CtctDtls>
208
+ </Dbtr>
209
+ <DbtrAcct>
210
+ <Id>
211
+ <IBAN>FRQUIQUIWIGWAM947551</IBAN>
212
+ </Id>
213
+ </DbtrAcct>
214
+ </DrctDbtTxInf>
215
+ <DrctDbtTxInf>
216
+ <PmtId>
217
+ <EndToEndId>MONECOLE REG F13793 PVT 3</EndToEndId>
218
+ </PmtId>
219
+ <PmtTpInf>
220
+ <SeqTp>RCUR</SeqTp>
221
+ </PmtTpInf>
222
+ <InstdAmt Ccy="EUR">1935.35</InstdAmt>
223
+ <DrctDbtTx>
224
+ <MndtRltdInf>
225
+ <MndtId>mandate-id-1</MndtId>
226
+ </MndtRltdInf>
227
+ </DrctDbtTx>
228
+ <DbtrAgt>
229
+ <FinInstnId>
230
+ <BICFI>FRQQWIGGA</BICFI>
231
+ </FinInstnId>
232
+ </DbtrAgt>
233
+ <Dbtr>
234
+ <Nm>ADAMS/SAMUELMR</Nm>
235
+ <PstlAdr>
236
+ <PstCd>75099</PstCd>
237
+ <TwnNm>PARIS</TwnNm>
238
+ <Ctry>FR</Ctry>
239
+ <AdrLine>512, Livva de Meet Agir</AdrLine>
240
+ </PstlAdr>
241
+ <CtctDtls>
242
+ <Nm>Johann S. BACH</Nm>
243
+ <PhneNb>09876543210</PhneNb>
244
+ <EmailAdr>js@bach.sepa.i.hope.this.works</EmailAdr>
245
+ </CtctDtls>
246
+ </Dbtr>
247
+ <DbtrAcct>
248
+ <Id>
249
+ <IBAN>FRQUIQUIWIGWAM947551</IBAN>
250
+ </Id>
251
+ </DbtrAcct>
252
+ </DrctDbtTxInf>
253
+ <DrctDbtTxInf>
254
+ <PmtId>
255
+ <EndToEndId>MONECOLE REG F13794 PVT 3</EndToEndId>
256
+ </PmtId>
257
+ <PmtTpInf>
258
+ <SeqTp>RCUR</SeqTp>
259
+ </PmtTpInf>
260
+ <InstdAmt Ccy="EUR">1236.36</InstdAmt>
261
+ <DrctDbtTx>
262
+ <MndtRltdInf>
263
+ <MndtId>mandate-id-1</MndtId>
264
+ </MndtRltdInf>
265
+ </DrctDbtTx>
266
+ <DbtrAgt>
267
+ <FinInstnId>
268
+ <BICFI>FRQQWIGGA</BICFI>
269
+ </FinInstnId>
270
+ </DbtrAgt>
271
+ <Dbtr>
272
+ <Nm>ADAMS/SAMUELMR</Nm>
273
+ <PstlAdr>
274
+ <PstCd>75099</PstCd>
275
+ <TwnNm>PARIS</TwnNm>
276
+ <Ctry>FR</Ctry>
277
+ <AdrLine>512, Livva de Meet Agir</AdrLine>
278
+ </PstlAdr>
279
+ <CtctDtls>
280
+ <Nm>Johann S. BACH</Nm>
281
+ <PhneNb>09876543210</PhneNb>
282
+ <EmailAdr>js@bach.sepa.i.hope.this.works</EmailAdr>
283
+ </CtctDtls>
284
+ </Dbtr>
285
+ <DbtrAcct>
286
+ <Id>
287
+ <IBAN>FRQUIQUIWIGWAM947551</IBAN>
288
+ </Id>
289
+ </DbtrAcct>
290
+ </DrctDbtTxInf>
291
+ </PmtInf>
292
+ </CstmrDrctDbtInitn>
293
+ </Document>
@@ -4,31 +4,35 @@ require "spec_helper"
4
4
 
5
5
  describe Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation do
6
6
 
7
- it "should produce xml corresponding to the given inputs" do
8
- props = {
9
- "group_header.message_identification" => "MSG0001",
10
- "group_header.creation_date_time" => "1992-02-28T18:30:00",
11
- "group_header.number_of_transactions" => "2",
12
- "group_header.initiating_party.name" => "SOFTIFY SARL",
13
- "group_header.initiating_party.postal_address.address_line[0]" => "289, Livva de Getamire",
14
- "group_header.initiating_party.postal_address.post_code" => "75021",
15
- "group_header.initiating_party.postal_address.town_name" => "Paris",
16
- "group_header.initiating_party.postal_address.country" => "FR",
17
- "group_header.initiating_party.contact_details.name" => "M. Le Gérant",
18
- "group_header.initiating_party.contact_details.phone_number" => "+33 111 111 111",
19
- "group_header.initiating_party.contact_details.email_address" => "gerant@softify.bigbang",
20
- "payment_information[0].payment_information_identification" => "MONECOLE_PAYMENTS_20130703",
21
- "payment_information[0].payment_method" => "DD",
22
- "payment_information[0].requested_collection_date" => "2013-07-10",
23
- "payment_information[0].creditor.name" => "Mon École",
24
- "payment_information[0].creditor.postal_address.address_line[0]" => "3, Livva de Getamire",
25
- "payment_information[0].creditor.postal_address.post_code" => "75022",
26
- "payment_information[0].creditor.postal_address.town_name" => "Paris",
27
- "payment_information[0].creditor.postal_address.country" => "FR",
28
- "payment_information[0].creditor.contact_details.name" => "M. le Directeur",
29
- "payment_information[0].creditor.contact_details.phone_number" => "+33 999 999 999",
30
- "payment_information[0].creditor.contact_details.email_address" => "directeur@monecole.softify.com",
31
- "payment_information[0].creditor_account.identification.iban" => "FRGOOGOOYADDA9999999",
7
+ let(:props) {
8
+ { "group_header.message_identification" => "MSG0001",
9
+ "group_header.creation_date_time" => "1992-02-28T18:30:00",
10
+ "group_header.number_of_transactions" => "2",
11
+ "group_header.control_sum" => "2963.63",
12
+ "group_header.initiating_party.name" => "SOFTIFY SARL",
13
+ "group_header.initiating_party.postal_address.address_line[0]" => "289, Livva de Getamire",
14
+ "group_header.initiating_party.postal_address.post_code" => "75021",
15
+ "group_header.initiating_party.postal_address.town_name" => "Paris",
16
+ "group_header.initiating_party.postal_address.country" => "FR",
17
+ "group_header.initiating_party.contact_details.name" => "M. Le Gérant",
18
+ "group_header.initiating_party.contact_details.phone_number" => "+33 111 111 111",
19
+ "group_header.initiating_party.contact_details.email_address" => "gerant@softify.bigbang",
20
+ "payment_information[0].payment_information_identification" => "MONECOLE_PAYMENTS_20130703",
21
+ "payment_information[0].payment_method" => "DD",
22
+ "payment_information[0].payment_type_information.service_level.code" => "SEPA",
23
+ "payment_information[0].payment_type_information.local_instrument.code" => "CORE",
24
+ "payment_information[0].requested_collection_date" => "2013-07-10",
25
+ "payment_information[0].number_of_transactions" => "2",
26
+ "payment_information[0].control_sum" => "2963.63",
27
+ "payment_information[0].creditor.name" => "Mon École",
28
+ "payment_information[0].creditor.postal_address.address_line[0]" => "3, Livva de Getamire",
29
+ "payment_information[0].creditor.postal_address.post_code" => "75022",
30
+ "payment_information[0].creditor.postal_address.town_name" => "Paris",
31
+ "payment_information[0].creditor.postal_address.country" => "FR",
32
+ "payment_information[0].creditor.contact_details.name" => "M. le Directeur",
33
+ "payment_information[0].creditor.contact_details.phone_number" => "+33 999 999 999",
34
+ "payment_information[0].creditor.contact_details.email_address" => "directeur@monecole.softify.com",
35
+ "payment_information[0].creditor_account.identification.iban" => "FRGOOGOOYADDA9999999",
32
36
  "payment_information[0].creditor_agent.financial_institution_identification.bic_fi" => "FRGGYELLOW99",
33
37
  "payment_information[0].direct_debit_transaction_information[0].payment_identification.end_to_end_identification" => "MONECOLE REG F13789 PVT 3",
34
38
  "payment_information[0].direct_debit_transaction_information[0].instructed_amount" => "1231.31",
@@ -60,10 +64,20 @@ describe Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation d
60
64
  "payment_information[0].direct_debit_transaction_information[1].debtor.contact_details.phone_number" => "09876543210",
61
65
  "payment_information[0].direct_debit_transaction_information[1].debtor.contact_details.email_address" => "samuel@adams.sepa.i.hope.this.works"
62
66
  }
67
+ }
68
+
69
+ it "should raise an error unless the version is '02' or '04'" do
70
+ pain = Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation.new(props)
71
+ expect { pain.generate_xml(pain_008_001_version: '2') }.to raise_error
72
+ expect { pain.generate_xml(pain_008_001_version: 2) }.to raise_error
73
+ expect { pain.generate_xml(pain_008_001_version: "") }.to raise_error
74
+ expect { pain.generate_xml({ }) }.to raise_error
75
+ end
63
76
 
64
- xml = Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation.new(props).generate_xml
65
- expected = File.read(File.expand_path("../../../expected_customer_direct_debit_initiation.xml", __FILE__))
77
+ it "should produce xml corresponding to the given inputs" do
78
+ xml = Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation.new(props).generate_xml(pain_008_001_version: '04')
79
+ expected = File.read(File.expand_path("../../../expected-simple.xml", __FILE__))
80
+ expected.force_encoding(Encoding::UTF_8)
66
81
  xml.should == expected
67
82
  end
68
83
  end
69
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sepa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-03 00:00:00.000000000 Z
12
+ date: 2013-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.9'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec_numbering_formatter
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  description: ! ' Generate ISO20022 XML messages. Implements pain.008.001.04 CustomerDirectDebitInitiation
63
79
  for now. WARNING: NO WARRANTY, USE AT YOUR OWN RISK AND PERIL. '
64
80
  email:
@@ -111,7 +127,9 @@ files:
111
127
  - sepa.gemspec
112
128
  - spec/sepa/direct_debit_order_spec.rb
113
129
  - spec/sepa/direct_debit_properties.yml
114
- - spec/sepa/expected_customer_direct_debit_initiation.xml
130
+ - spec/sepa/expected-simple.xml
131
+ - spec/sepa/expected_customer_direct_debit_initiation_v02.xml
132
+ - spec/sepa/expected_customer_direct_debit_initiation_v04.xml
115
133
  - spec/sepa/payments_initiation/pain00800104/customer_direct_debit_initiation_spec.rb
116
134
  - spec/spec_helper.rb
117
135
  homepage: https://github.com/conanite/sepa
@@ -143,6 +161,8 @@ summary: ! 'pain.008.001.04 CustomerDirectDebitInitiation ISO20022 XML. WARNING:
143
161
  test_files:
144
162
  - spec/sepa/direct_debit_order_spec.rb
145
163
  - spec/sepa/direct_debit_properties.yml
146
- - spec/sepa/expected_customer_direct_debit_initiation.xml
164
+ - spec/sepa/expected-simple.xml
165
+ - spec/sepa/expected_customer_direct_debit_initiation_v02.xml
166
+ - spec/sepa/expected_customer_direct_debit_initiation_v04.xml
147
167
  - spec/sepa/payments_initiation/pain00800104/customer_direct_debit_initiation_spec.rb
148
168
  - spec/spec_helper.rb