sepa 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edd5c07cd152f52e2d13b0d3cd2a00f95b40bba4
4
- data.tar.gz: 093bbd122e64de202f074c905bb2edd48b224b92
3
+ metadata.gz: 316f7e846361f530cd610c4a7855b4a4d5caedc7
4
+ data.tar.gz: c21e65546b876eb0f243c0aa35c79cf425142d18
5
5
  SHA512:
6
- metadata.gz: d9740f6b8caea5a9bd4564f59deedbcd1519bda122c1e18623bcf1d358e24e8e37812a0c20835e4eb53ba6bcefed9e990c4f900e382aa5c5cdf54421ea8bc88b
7
- data.tar.gz: 51e20a22ec96071c1ed5bfcf45bd301e0c1373a840d422fb980304d7d2ef57662ac00f46180897a09265556dd3b40b1bca4179154cd284a7dfa28b66e51a60ea
6
+ metadata.gz: 17cb2181595f131b274636a22cef58f1dab35d4efe0534cd98462d10a9852e3e474cd715998a06fee7eec7394ab3dca938a418c22159a47a036178b5aa5c1188
7
+ data.tar.gz: bd89541c1a0b919301ba8fb6d4aecad8d54193f7344789a11b277c715fad849a529f0e7a069cc803406067e6ae59aac27308b6d9a35bdd463a59adb6d258bc97
data/README.md CHANGED
@@ -73,8 +73,18 @@ a message-id.
73
73
  The last line returns a string that you will then need to send to your bank one way or another. For example, you might use an EBICS client. Or your bank might provide
74
74
  software to send the file. Or perhaps you can upload it via their website.
75
75
 
76
+ If your bank expects a particular time format, do this (for example)
77
+
78
+ Sepa::Base.time_format = "%Y-%m-%dT%H:%M:%SZ" # btw, this is the default value
79
+
80
+ This sets a class variable, which is effectively a global, non-thread-safe variable, so this might change in the future, in case we need to support usage where multiple clients need to generate XML with different time format requirements.
81
+
76
82
  ## History
77
83
 
84
+ 0.0.17
85
+ * Use 'NOTPROVIDED' instead of BIC (requirement from ABN-AMRO Netherlands) (thanks @joostkuif)
86
+ * Support various ruby kinds of number (thanks @TheConstructor)
87
+ * Configurable time format string for time elements (so far, only CstmrDrctDbtInitn/GrpHdr/CreDtTm)
78
88
  0.0.16 BigDecimal to avoid floating-point rounding errors (w/thanks to @joostkuif), support RemittanceInformation (w/thanks to @TheConstructor)
79
89
  0.0.15 Ruby 1.8.7 compatibility
80
90
 
@@ -91,4 +101,4 @@ Other message types are totally welcome.
91
101
  ## Contributors
92
102
 
93
103
  Author: [Conan Dalton](http://www.conandalton.net), aka [conanite](https://github.com/conanite)
94
- With thanks to [corny](https://github.com/corny), [TheConstructor](https://github.com/TheConstructor), [joostkuif](https://github.com/joostkuif)
104
+ With thanks to [corny](https://github.com/corny), [TheConstructor](https://github.com/TheConstructor), [joostkuif](https://github.com/joostkuif), [digineo](https://github.com/digineo)
data/lib/sepa/base.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- coding: utf-8 -*-
2
- require 'bigdecimal'
3
2
  module Sepa
4
3
  class Base
5
4
  include Aduki::Initializer
6
5
 
6
+ @@time_format = "%Y-%m-%dT%H:%M:%SZ"
7
7
  @@attribute_defs = Hash.new { |h,k| h[k] = [] }
8
8
 
9
9
  def build_xml_attributes names
@@ -19,9 +19,12 @@ module Sepa
19
19
  end
20
20
 
21
21
  def normalize str
22
- return str if str.is_a? Fixnum
23
- return ("%.2f" % str) if str.is_a? Float
24
- return ("%.2f" % str) if str.is_a? BigDecimal
22
+ # Integer like Fixnum and Bignum can directly be returned
23
+ return str if str.is_a? Integer
24
+ # Check for Numeric to exclude String, but handle Float, BigDecimal, Rational, ... we don't mind.
25
+ # Kernel#sprintf could handle all to_f implementers, if to_f does not throw an exception
26
+ return ('%.2f' % str) if str.is_a?(Numeric) && str.respond_to?(:to_f)
27
+ # For String we need to replace illegal characters by an appropriate alternative
25
28
  replacements = {
26
29
  'à' => 'a', 'é' => 'e', 'è' => 'e',
27
30
  'û' => 'u', 'î' => 'i', 'ô' => 'o', 'ü' => 'u', 'ï' => 'i', 'ö' => 'o',
@@ -29,7 +32,7 @@ module Sepa
29
32
  'À' => 'A', 'Á' => 'A', 'Ü' => 'U', 'Ï' => 'I', 'Ö' => 'O', 'ß' => 'ss'
30
33
  }
31
34
  str = replacements.to_a.
32
- inject(str) { |s, kv| s.gsub(kv[0], kv[1]) }.
35
+ inject(str.to_s) { |s, kv| s.gsub(kv[0], kv[1]) }.
33
36
  gsub(/[^a-zA-Z0-9_@ \.,()'+\/\?-]/, '')
34
37
  end
35
38
 
@@ -50,7 +53,7 @@ module Sepa
50
53
  end
51
54
  end
52
55
  elsif meta[:type] == Time
53
- v = item.is_a?(String) ? item : item.strftime("%Y-%m-%dT%H:%M:%SZ")
56
+ v = item.is_a?(String) ? item : item.strftime(@@time_format)
54
57
  builder.__send__(meta[:tag], v, attributes)
55
58
  elsif meta[:type] == Date
56
59
  v = item.is_a?(String) ? item : item.strftime("%Y-%m-%d")
@@ -99,5 +102,9 @@ module Sepa
99
102
  attr_accessor name
100
103
  aduki(name => member_type) if member_type
101
104
  end
105
+
106
+ def self.time_format= new_format
107
+ @@time_format = new_format
108
+ end
102
109
  end
103
110
  end
@@ -236,8 +236,13 @@ class Sepa::DirectDebitOrder
236
236
  def to_properties prefix, opts
237
237
  bic_tag = ( opts[:pain_008_001_version] == "04" ? "bic_fi" : "bic" )
238
238
 
239
- { "#{prefix}_account.identification.iban" => iban.gsub(/\s/, ''),
240
- "#{prefix}_agent.financial_institution_identification.#{bic_tag}" => swift }
239
+ if swift.nil?
240
+ { "#{prefix}_account.identification.iban" => iban.gsub(/\s/, ''),
241
+ "#{prefix}_agent.financial_institution_identification.other.identification" => "NOTPROVIDED" }
242
+ else
243
+ { "#{prefix}_account.identification.iban" => iban.gsub(/\s/, ''),
244
+ "#{prefix}_agent.financial_institution_identification.#{bic_tag}" => swift }
245
+ end
241
246
  end
242
247
  end
243
248
 
@@ -0,0 +1,7 @@
1
+ class Sepa::PaymentsInitiation::FinancialIdentificationSchemeName1Choice < Sepa::Base
2
+ code_or_proprietary
3
+
4
+ def empty?
5
+ [code, proprietary].join.strip == ""
6
+ end
7
+ end
@@ -1,4 +1,5 @@
1
1
  require "sepa/payments_initiation/postal_address"
2
+ require "sepa/payments_initiation/generic_financial_identification_1"
2
3
 
3
4
  class Sepa::PaymentsInitiation::FinancialInstitutionIdentification < Sepa::Base
4
5
  definition "Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme."
@@ -6,5 +7,5 @@ class Sepa::PaymentsInitiation::FinancialInstitutionIdentification < Sepa::Base
6
7
  attribute :bic, "BIC"
7
8
  attribute :name, "Nm"
8
9
  attribute :postal_address, "PstlAdr", Sepa::PaymentsInitiation::PostalAddress
9
-
10
+ attribute :other, "Othr", Sepa::PaymentsInitiation::GenericFinancialIdentification1
10
11
  end
@@ -0,0 +1,12 @@
1
+ require 'sepa/payments_initiation/financial_identification_scheme_name_1_choice'
2
+
3
+ class Sepa::PaymentsInitiation::GenericFinancialIdentification1 < Sepa::Base
4
+ definition "Unique identification of an agent, as assigned by an institution, using an identification scheme."
5
+ attribute :identification, "Id"
6
+ attribute :scheme_name , "SchmeNm", Sepa::PaymentsInitiation::FinancialIdentificationSchemeName1Choice
7
+ attribute :issuer , "Issr"
8
+
9
+ def empty?
10
+ [identification, issuer].join.strip == '' && (scheme_name == nil || scheme_name.empty?)
11
+ end
12
+ end
data/lib/sepa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sepa
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.17"
3
3
  end
@@ -2,27 +2,44 @@
2
2
 
3
3
  require "spec_helper"
4
4
  require "time"
5
+ require 'bigdecimal'
6
+ require 'rational'
5
7
 
6
8
  describe Sepa::DirectDebitOrder do
7
9
 
8
- def order sepa_identifier_class, remittance_information = false
10
+ AMOUNTS = {
11
+ :Float => [1231.31, 1133.33, 1732.32, 1034.34, 1935.35, 1236.36, 1235.42, 1236.78],
12
+ :BigDecimal => [BigDecimal.new('1231.31'), BigDecimal.new('1133.33'), BigDecimal.new('1732.32'), BigDecimal.new('1034.34'), BigDecimal.new('1935.35'), BigDecimal.new('1236.36'), BigDecimal.new('1235.42'), BigDecimal.new('1236.78')],
13
+ :Rational => [Rational(123131, 100), Rational(113333, 100), Rational(173232, 100), Rational(103434, 100), Rational(193535, 100), Rational(123636, 100), Rational(123542, 100), Rational(123678, 100)],
14
+ }
15
+
16
+
17
+ def order sepa_identifier_class, numeric_class = :Float, remittance_information = false
18
+ amounts = AMOUNTS[numeric_class]
19
+
9
20
  bank_account0 = Sepa::DirectDebitOrder::BankAccount.new "FRZIZIPAPARAZZI345789", "FRZZPPKOOKOO"
10
21
  debtor0 = Sepa::DirectDebitOrder::Party.new "DALTON/CONANMR", "64, Livva de Getamire", nil, "30005", "RENNES", "France", "Conan DALTON", "01234567890", "conan@dalton.sepa.i.hope.this.works"
11
22
  mandate0 = Sepa::DirectDebitOrder::MandateInformation.new("mandate-id-0", Date.parse("2010-11-18"), "RCUR")
12
- dd00 = Sepa::DirectDebitOrder::DirectDebit.new debtor0, bank_account0, "MONECOLE REG F13789 PVT 3", 1231.31, "EUR", mandate0, remittance_information ? "Transaction 3" : nil
13
- dd01 = Sepa::DirectDebitOrder::DirectDebit.new debtor0, bank_account0, "MONECOLE REG F13791 PVT 3", 1133.33, "EUR", mandate0, remittance_information ? "We take your money" : nil
23
+ dd00 = Sepa::DirectDebitOrder::DirectDebit.new debtor0, bank_account0, "MONECOLE REG F13789 PVT 3", amounts[0], "EUR", mandate0, remittance_information ? "Transaction 3" : nil
24
+ dd01 = Sepa::DirectDebitOrder::DirectDebit.new debtor0, bank_account0, "MONECOLE REG F13791 PVT 3", amounts[1], "EUR", mandate0, remittance_information ? "We take your money" : nil
14
25
 
15
26
  bank_account1 = Sepa::DirectDebitOrder::BankAccount.new "FRQUIQUIWIGWAM947551", "FRQQWIGGA"
16
27
  debtor1 = Sepa::DirectDebitOrder::Party.new "ADAMS/SAMUELMR", "256, Livva de Getamire", nil, "75048", "BERLIN", "Germany", "Samuel ADAMS", "09876543210", "samuel@adams.sepa.i.hope.this.works"
17
28
  mandate1 = Sepa::DirectDebitOrder::MandateInformation.new("mandate-id-1", Date.parse("2012-01-19"), "FRST")
18
- dd10 = Sepa::DirectDebitOrder::DirectDebit.new debtor1, bank_account1, "MONECOLE REG F13790 PVT 3", 1732.32, "EUR", mandate1, remittance_information ? "An important transaction" : nil
19
- dd11 = Sepa::DirectDebitOrder::DirectDebit.new debtor1, bank_account1, "MONECOLE REG F13792 PVT 3", 1034.34, "EUR", mandate1, remittance_information ? "Thank you, for the money" : nil
29
+ dd10 = Sepa::DirectDebitOrder::DirectDebit.new debtor1, bank_account1, "MONECOLE REG F13790 PVT 3", amounts[2], "EUR", mandate1, remittance_information ? "An important transaction" : nil
30
+ dd11 = Sepa::DirectDebitOrder::DirectDebit.new debtor1, bank_account1, "MONECOLE REG F13792 PVT 3", amounts[3], "EUR", mandate1, remittance_information ? "Thank you, for the money" : nil
20
31
 
21
32
  bank_account2 = Sepa::DirectDebitOrder::BankAccount.new " FR QU IQ UI WI GW\tAM 947 551 ", "FRQQWIGGA"
22
33
  debtor2 = Sepa::DirectDebitOrder::Party.new "Mr. James Joyce", "512, Livva de Meet Agir", nil, "75099", "LONDON", "Angleterre", "Johann S. BACH", "09876543210", "js@bach.sepa.i.hope.this.works"
23
34
  mandate2 = Sepa::DirectDebitOrder::MandateInformation.new("mandate-id-2", Date.parse("2013-06-08"), "RCUR")
24
- dd20 = Sepa::DirectDebitOrder::DirectDebit.new debtor2, bank_account2, "MONECOLE REG F13793 PVT 3", 1935.35, "EUR", mandate2, remittance_information ? "Another one" : nil
25
- dd21 = Sepa::DirectDebitOrder::DirectDebit.new debtor2, bank_account2, "MONECOLE REG F13794 PVT 3", 1236.36, "EUR", mandate2, remittance_information ? "Final transaction" : nil
35
+ dd20 = Sepa::DirectDebitOrder::DirectDebit.new debtor2, bank_account2, "MONECOLE REG F13793 PVT 3", amounts[4], "EUR", mandate2, remittance_information ? "Another one" : nil
36
+ dd21 = Sepa::DirectDebitOrder::DirectDebit.new debtor2, bank_account2, "MONECOLE REG F13794 PVT 3", amounts[5], "EUR", mandate2, remittance_information ? "Final transaction" : nil
37
+
38
+ bank_account3 = Sepa::DirectDebitOrder::BankAccount.new "NLQUIQUIWIGWAM947551", nil
39
+ debtor3 = Sepa::DirectDebitOrder::Party.new "R Epelsteeltje", "Spuistraat 42", nil, "75099", "Amsterdam", "Netherlands", "Ron Epelsteeltje", "01234567890", "ron@epelsteeltje.sepa.i.hope.this.works"
40
+ mandate3 = Sepa::DirectDebitOrder::MandateInformation.new("mandate-id-3", Date.parse("2014-01-23"), "RCUR")
41
+ dd30 = Sepa::DirectDebitOrder::DirectDebit.new debtor3, bank_account3, "MONECOLE REG F13795 PVT 3", amounts[6], "EUR", mandate3
42
+ dd31 = Sepa::DirectDebitOrder::DirectDebit.new debtor3, bank_account3, "MONECOLE REG F13796 PVT 3", amounts[7], "EUR", mandate3
26
43
 
27
44
  sepa_now = Time.local(1992, 2, 28, 18, 30, 0, 0, 0)
28
45
  Time.stub(:now).and_return sepa_now
@@ -30,7 +47,7 @@ describe Sepa::DirectDebitOrder do
30
47
  creditor = Sepa::DirectDebitOrder::Party.new "Mon École", "3, Livva de Getamire", nil, "75022", "Paris", "Frankreich", "M. le Directeur", "+33 999 999 999", "directeur@monecole.softify.com"
31
48
  creditor_account = Sepa::DirectDebitOrder::BankAccount.new "FRGOO GOOY ADDA 9999 999", "FRGGYELLOW99"
32
49
  sepa_identifier = sepa_identifier_class.new "FR123ZZZ010203"
33
- payment = Sepa::DirectDebitOrder::CreditorPayment.new creditor, creditor_account, "MONECOLE_PAYMENTS_20130703", Date.parse("2013-07-10"), sepa_identifier, [dd00, dd01, dd10, dd11, dd20, dd21]
50
+ payment = Sepa::DirectDebitOrder::CreditorPayment.new creditor, creditor_account, "MONECOLE_PAYMENTS_20130703", Date.parse("2013-07-10"), sepa_identifier, [dd00, dd01, dd10, dd11, dd20, dd21, dd30, dd31]
34
51
 
35
52
  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"
36
53
 
@@ -46,8 +63,26 @@ describe Sepa::DirectDebitOrder do
46
63
  xml.should == expected
47
64
  end
48
65
 
66
+ it "should produce v02 xml corresponding to the given inputs and BigDecimal amounts" do
67
+ o = order Sepa::DirectDebitOrder::PrivateSepaIdentifier, :BigDecimal
68
+ xml = o.to_xml :pain_008_001_version => "02"
69
+ xml = check_doc_header_02 xml
70
+ expected = File.read(File.expand_path("../expected_customer_direct_debit_initiation_v02.xml", __FILE__))
71
+ expected.force_encoding(Encoding::UTF_8) if expected.respond_to? :force_encoding
72
+ xml.should == expected
73
+ end
74
+
75
+ it "should produce v02 xml corresponding to the given inputs and Rational amounts" do
76
+ o = order Sepa::DirectDebitOrder::PrivateSepaIdentifier, :Rational
77
+ xml = o.to_xml :pain_008_001_version => "02"
78
+ xml = check_doc_header_02 xml
79
+ expected = File.read(File.expand_path("../expected_customer_direct_debit_initiation_v02.xml", __FILE__))
80
+ expected.force_encoding(Encoding::UTF_8) if expected.respond_to? :force_encoding
81
+ xml.should == expected
82
+ end
83
+
49
84
  it "should produce v02 xml corresponding to the given inputs with unstructured remittance information" do
50
- o = order Sepa::DirectDebitOrder::PrivateSepaIdentifier, true
85
+ o = order Sepa::DirectDebitOrder::PrivateSepaIdentifier, :Float, true
51
86
  xml = o.to_xml :pain_008_001_version => "02"
52
87
  xml = check_doc_header_02 xml
53
88
  expected = File.read(File.expand_path("../expected_customer_direct_debit_initiation_v02_with_remittance_information.xml", __FILE__))
@@ -64,6 +99,24 @@ describe Sepa::DirectDebitOrder do
64
99
  xml.should == expected
65
100
  end
66
101
 
102
+ it "should produce v04 xml corresponding to the given inputs and BigDecimal amounts" do
103
+ o = order Sepa::DirectDebitOrder::PrivateSepaIdentifier, :BigDecimal
104
+ xml = o.to_xml :pain_008_001_version => "04"
105
+ xml = check_doc_header_04 xml
106
+ expected = File.read(File.expand_path("../expected_customer_direct_debit_initiation_v04.xml", __FILE__))
107
+ expected.force_encoding(Encoding::UTF_8) if expected.respond_to? :force_encoding
108
+ xml.should == expected
109
+ end
110
+
111
+ it "should produce v04 xml corresponding to the given inputs and Rational amounts" do
112
+ o = order Sepa::DirectDebitOrder::PrivateSepaIdentifier, :Rational
113
+ xml = o.to_xml :pain_008_001_version => "04"
114
+ xml = check_doc_header_04 xml
115
+ expected = File.read(File.expand_path("../expected_customer_direct_debit_initiation_v04.xml", __FILE__))
116
+ expected.force_encoding(Encoding::UTF_8) if expected.respond_to? :force_encoding
117
+ xml.should == expected
118
+ end
119
+
67
120
  it "should produce v04 xml corresponding to the given inputs with an organisation identifier for the creditor" do
68
121
  o = order Sepa::DirectDebitOrder::OrganisationSepaIdentifier
69
122
  xml = o.to_xml :pain_008_001_version => "04"
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Document>
3
+ <CstmrDrctDbtInitn>
4
+ <GrpHdr>
5
+ <CreDtTm>1992-02-28T18:30</CreDtTm>
6
+ </GrpHdr>
7
+ </CstmrDrctDbtInitn>
8
+ </Document>
@@ -4,8 +4,8 @@
4
4
  <GrpHdr>
5
5
  <MsgId>MSG0001</MsgId>
6
6
  <CreDtTm>1992-02-28T18:30:00Z</CreDtTm>
7
- <NbOfTxs>6</NbOfTxs>
8
- <CtrlSum>8303.01</CtrlSum>
7
+ <NbOfTxs>8</NbOfTxs>
8
+ <CtrlSum>10775.21</CtrlSum>
9
9
  <InitgPty>
10
10
  <Nm>SOFTIFY SARL</Nm>
11
11
  </InitgPty>
@@ -120,8 +120,8 @@
120
120
  <PmtInf>
121
121
  <PmtInfId>MONECOLE_PAYMENTS_20130703-RCUR</PmtInfId>
122
122
  <PmtMtd>DD</PmtMtd>
123
- <NbOfTxs>4</NbOfTxs>
124
- <CtrlSum>5536.35</CtrlSum>
123
+ <NbOfTxs>6</NbOfTxs>
124
+ <CtrlSum>8008.55</CtrlSum>
125
125
  <PmtTpInf>
126
126
  <SvcLvl>
127
127
  <Cd>SEPA</Cd>
@@ -281,6 +281,70 @@
281
281
  </Id>
282
282
  </DbtrAcct>
283
283
  </DrctDbtTxInf>
284
+ <DrctDbtTxInf>
285
+ <PmtId>
286
+ <EndToEndId>MONECOLE REG F13795 PVT 3</EndToEndId>
287
+ </PmtId>
288
+ <InstdAmt Ccy="EUR">1235.42</InstdAmt>
289
+ <DrctDbtTx>
290
+ <MndtRltdInf>
291
+ <MndtId>mandate-id-3</MndtId>
292
+ <DtOfSgntr>2014-01-23</DtOfSgntr>
293
+ </MndtRltdInf>
294
+ </DrctDbtTx>
295
+ <DbtrAgt>
296
+ <FinInstnId>
297
+ <Othr>
298
+ <Id>NOTPROVIDED</Id>
299
+ </Othr>
300
+ </FinInstnId>
301
+ </DbtrAgt>
302
+ <Dbtr>
303
+ <Nm>R Epelsteeltje</Nm>
304
+ <PstlAdr>
305
+ <Ctry>NL</Ctry>
306
+ <AdrLine>Spuistraat 42</AdrLine>
307
+ <AdrLine>75099 Amsterdam</AdrLine>
308
+ </PstlAdr>
309
+ </Dbtr>
310
+ <DbtrAcct>
311
+ <Id>
312
+ <IBAN>NLQUIQUIWIGWAM947551</IBAN>
313
+ </Id>
314
+ </DbtrAcct>
315
+ </DrctDbtTxInf>
316
+ <DrctDbtTxInf>
317
+ <PmtId>
318
+ <EndToEndId>MONECOLE REG F13796 PVT 3</EndToEndId>
319
+ </PmtId>
320
+ <InstdAmt Ccy="EUR">1236.78</InstdAmt>
321
+ <DrctDbtTx>
322
+ <MndtRltdInf>
323
+ <MndtId>mandate-id-3</MndtId>
324
+ <DtOfSgntr>2014-01-23</DtOfSgntr>
325
+ </MndtRltdInf>
326
+ </DrctDbtTx>
327
+ <DbtrAgt>
328
+ <FinInstnId>
329
+ <Othr>
330
+ <Id>NOTPROVIDED</Id>
331
+ </Othr>
332
+ </FinInstnId>
333
+ </DbtrAgt>
334
+ <Dbtr>
335
+ <Nm>R Epelsteeltje</Nm>
336
+ <PstlAdr>
337
+ <Ctry>NL</Ctry>
338
+ <AdrLine>Spuistraat 42</AdrLine>
339
+ <AdrLine>75099 Amsterdam</AdrLine>
340
+ </PstlAdr>
341
+ </Dbtr>
342
+ <DbtrAcct>
343
+ <Id>
344
+ <IBAN>NLQUIQUIWIGWAM947551</IBAN>
345
+ </Id>
346
+ </DbtrAcct>
347
+ </DrctDbtTxInf>
284
348
  </PmtInf>
285
349
  </CstmrDrctDbtInitn>
286
350
  </Document>
@@ -4,8 +4,8 @@
4
4
  <GrpHdr>
5
5
  <MsgId>MSG0001</MsgId>
6
6
  <CreDtTm>1992-02-28T18:30:00Z</CreDtTm>
7
- <NbOfTxs>6</NbOfTxs>
8
- <CtrlSum>8303.01</CtrlSum>
7
+ <NbOfTxs>8</NbOfTxs>
8
+ <CtrlSum>10775.21</CtrlSum>
9
9
  <InitgPty>
10
10
  <Nm>SOFTIFY SARL</Nm>
11
11
  </InitgPty>
@@ -126,8 +126,8 @@
126
126
  <PmtInf>
127
127
  <PmtInfId>MONECOLE_PAYMENTS_20130703-RCUR</PmtInfId>
128
128
  <PmtMtd>DD</PmtMtd>
129
- <NbOfTxs>4</NbOfTxs>
130
- <CtrlSum>5536.35</CtrlSum>
129
+ <NbOfTxs>6</NbOfTxs>
130
+ <CtrlSum>8008.55</CtrlSum>
131
131
  <PmtTpInf>
132
132
  <SvcLvl>
133
133
  <Cd>SEPA</Cd>
@@ -299,6 +299,70 @@
299
299
  <Ustrd>Final transaction</Ustrd>
300
300
  </RmtInf>
301
301
  </DrctDbtTxInf>
302
+ <DrctDbtTxInf>
303
+ <PmtId>
304
+ <EndToEndId>MONECOLE REG F13795 PVT 3</EndToEndId>
305
+ </PmtId>
306
+ <InstdAmt Ccy="EUR">1235.42</InstdAmt>
307
+ <DrctDbtTx>
308
+ <MndtRltdInf>
309
+ <MndtId>mandate-id-3</MndtId>
310
+ <DtOfSgntr>2014-01-23</DtOfSgntr>
311
+ </MndtRltdInf>
312
+ </DrctDbtTx>
313
+ <DbtrAgt>
314
+ <FinInstnId>
315
+ <Othr>
316
+ <Id>NOTPROVIDED</Id>
317
+ </Othr>
318
+ </FinInstnId>
319
+ </DbtrAgt>
320
+ <Dbtr>
321
+ <Nm>R Epelsteeltje</Nm>
322
+ <PstlAdr>
323
+ <Ctry>NL</Ctry>
324
+ <AdrLine>Spuistraat 42</AdrLine>
325
+ <AdrLine>75099 Amsterdam</AdrLine>
326
+ </PstlAdr>
327
+ </Dbtr>
328
+ <DbtrAcct>
329
+ <Id>
330
+ <IBAN>NLQUIQUIWIGWAM947551</IBAN>
331
+ </Id>
332
+ </DbtrAcct>
333
+ </DrctDbtTxInf>
334
+ <DrctDbtTxInf>
335
+ <PmtId>
336
+ <EndToEndId>MONECOLE REG F13796 PVT 3</EndToEndId>
337
+ </PmtId>
338
+ <InstdAmt Ccy="EUR">1236.78</InstdAmt>
339
+ <DrctDbtTx>
340
+ <MndtRltdInf>
341
+ <MndtId>mandate-id-3</MndtId>
342
+ <DtOfSgntr>2014-01-23</DtOfSgntr>
343
+ </MndtRltdInf>
344
+ </DrctDbtTx>
345
+ <DbtrAgt>
346
+ <FinInstnId>
347
+ <Othr>
348
+ <Id>NOTPROVIDED</Id>
349
+ </Othr>
350
+ </FinInstnId>
351
+ </DbtrAgt>
352
+ <Dbtr>
353
+ <Nm>R Epelsteeltje</Nm>
354
+ <PstlAdr>
355
+ <Ctry>NL</Ctry>
356
+ <AdrLine>Spuistraat 42</AdrLine>
357
+ <AdrLine>75099 Amsterdam</AdrLine>
358
+ </PstlAdr>
359
+ </Dbtr>
360
+ <DbtrAcct>
361
+ <Id>
362
+ <IBAN>NLQUIQUIWIGWAM947551</IBAN>
363
+ </Id>
364
+ </DbtrAcct>
365
+ </DrctDbtTxInf>
302
366
  </PmtInf>
303
367
  </CstmrDrctDbtInitn>
304
368
  </Document>
@@ -4,8 +4,8 @@
4
4
  <GrpHdr>
5
5
  <MsgId>MSG0001</MsgId>
6
6
  <CreDtTm>1992-02-28T18:30:00Z</CreDtTm>
7
- <NbOfTxs>6</NbOfTxs>
8
- <CtrlSum>8303.01</CtrlSum>
7
+ <NbOfTxs>8</NbOfTxs>
8
+ <CtrlSum>10775.21</CtrlSum>
9
9
  <InitgPty>
10
10
  <Nm>SOFTIFY SARL</Nm>
11
11
  <PstlAdr>
@@ -24,8 +24,8 @@
24
24
  <PmtInf>
25
25
  <PmtInfId>MONECOLE_PAYMENTS_20130703</PmtInfId>
26
26
  <PmtMtd>DD</PmtMtd>
27
- <NbOfTxs>6</NbOfTxs>
28
- <CtrlSum>8303.01</CtrlSum>
27
+ <NbOfTxs>8</NbOfTxs>
28
+ <CtrlSum>10775.21</CtrlSum>
29
29
  <PmtTpInf>
30
30
  <SvcLvl>
31
31
  <Cd>SEPA</Cd>
@@ -304,6 +304,88 @@
304
304
  </Id>
305
305
  </DbtrAcct>
306
306
  </DrctDbtTxInf>
307
+ <DrctDbtTxInf>
308
+ <PmtId>
309
+ <EndToEndId>MONECOLE REG F13795 PVT 3</EndToEndId>
310
+ </PmtId>
311
+ <PmtTpInf>
312
+ <SeqTp>RCUR</SeqTp>
313
+ </PmtTpInf>
314
+ <InstdAmt Ccy="EUR">1235.42</InstdAmt>
315
+ <DrctDbtTx>
316
+ <MndtRltdInf>
317
+ <MndtId>mandate-id-3</MndtId>
318
+ <DtOfSgntr>2014-01-23</DtOfSgntr>
319
+ </MndtRltdInf>
320
+ </DrctDbtTx>
321
+ <DbtrAgt>
322
+ <FinInstnId>
323
+ <Othr>
324
+ <Id>NOTPROVIDED</Id>
325
+ </Othr>
326
+ </FinInstnId>
327
+ </DbtrAgt>
328
+ <Dbtr>
329
+ <Nm>R Epelsteeltje</Nm>
330
+ <PstlAdr>
331
+ <PstCd>75099</PstCd>
332
+ <TwnNm>Amsterdam</TwnNm>
333
+ <Ctry>NL</Ctry>
334
+ <AdrLine>Spuistraat 42</AdrLine>
335
+ </PstlAdr>
336
+ <CtctDtls>
337
+ <Nm>Ron Epelsteeltje</Nm>
338
+ <PhneNb>01234567890</PhneNb>
339
+ <EmailAdr>ron@epelsteeltje.sepa.i.hope.this.works</EmailAdr>
340
+ </CtctDtls>
341
+ </Dbtr>
342
+ <DbtrAcct>
343
+ <Id>
344
+ <IBAN>NLQUIQUIWIGWAM947551</IBAN>
345
+ </Id>
346
+ </DbtrAcct>
347
+ </DrctDbtTxInf>
348
+ <DrctDbtTxInf>
349
+ <PmtId>
350
+ <EndToEndId>MONECOLE REG F13796 PVT 3</EndToEndId>
351
+ </PmtId>
352
+ <PmtTpInf>
353
+ <SeqTp>RCUR</SeqTp>
354
+ </PmtTpInf>
355
+ <InstdAmt Ccy="EUR">1236.78</InstdAmt>
356
+ <DrctDbtTx>
357
+ <MndtRltdInf>
358
+ <MndtId>mandate-id-3</MndtId>
359
+ <DtOfSgntr>2014-01-23</DtOfSgntr>
360
+ </MndtRltdInf>
361
+ </DrctDbtTx>
362
+ <DbtrAgt>
363
+ <FinInstnId>
364
+ <Othr>
365
+ <Id>NOTPROVIDED</Id>
366
+ </Othr>
367
+ </FinInstnId>
368
+ </DbtrAgt>
369
+ <Dbtr>
370
+ <Nm>R Epelsteeltje</Nm>
371
+ <PstlAdr>
372
+ <PstCd>75099</PstCd>
373
+ <TwnNm>Amsterdam</TwnNm>
374
+ <Ctry>NL</Ctry>
375
+ <AdrLine>Spuistraat 42</AdrLine>
376
+ </PstlAdr>
377
+ <CtctDtls>
378
+ <Nm>Ron Epelsteeltje</Nm>
379
+ <PhneNb>01234567890</PhneNb>
380
+ <EmailAdr>ron@epelsteeltje.sepa.i.hope.this.works</EmailAdr>
381
+ </CtctDtls>
382
+ </Dbtr>
383
+ <DbtrAcct>
384
+ <Id>
385
+ <IBAN>NLQUIQUIWIGWAM947551</IBAN>
386
+ </Id>
387
+ </DbtrAcct>
388
+ </DrctDbtTxInf>
307
389
  </PmtInf>
308
390
  </CstmrDrctDbtInitn>
309
391
  </Document>
@@ -4,8 +4,8 @@
4
4
  <GrpHdr>
5
5
  <MsgId>MSG0001</MsgId>
6
6
  <CreDtTm>1992-02-28T18:30:00Z</CreDtTm>
7
- <NbOfTxs>6</NbOfTxs>
8
- <CtrlSum>8303.01</CtrlSum>
7
+ <NbOfTxs>8</NbOfTxs>
8
+ <CtrlSum>10775.21</CtrlSum>
9
9
  <InitgPty>
10
10
  <Nm>SOFTIFY SARL</Nm>
11
11
  <PstlAdr>
@@ -24,8 +24,8 @@
24
24
  <PmtInf>
25
25
  <PmtInfId>MONECOLE_PAYMENTS_20130703</PmtInfId>
26
26
  <PmtMtd>DD</PmtMtd>
27
- <NbOfTxs>6</NbOfTxs>
28
- <CtrlSum>8303.01</CtrlSum>
27
+ <NbOfTxs>8</NbOfTxs>
28
+ <CtrlSum>10775.21</CtrlSum>
29
29
  <PmtTpInf>
30
30
  <SvcLvl>
31
31
  <Cd>SEPA</Cd>
@@ -304,6 +304,88 @@
304
304
  </Id>
305
305
  </DbtrAcct>
306
306
  </DrctDbtTxInf>
307
+ <DrctDbtTxInf>
308
+ <PmtId>
309
+ <EndToEndId>MONECOLE REG F13795 PVT 3</EndToEndId>
310
+ </PmtId>
311
+ <PmtTpInf>
312
+ <SeqTp>RCUR</SeqTp>
313
+ </PmtTpInf>
314
+ <InstdAmt Ccy="EUR">1235.42</InstdAmt>
315
+ <DrctDbtTx>
316
+ <MndtRltdInf>
317
+ <MndtId>mandate-id-3</MndtId>
318
+ <DtOfSgntr>2014-01-23</DtOfSgntr>
319
+ </MndtRltdInf>
320
+ </DrctDbtTx>
321
+ <DbtrAgt>
322
+ <FinInstnId>
323
+ <Othr>
324
+ <Id>NOTPROVIDED</Id>
325
+ </Othr>
326
+ </FinInstnId>
327
+ </DbtrAgt>
328
+ <Dbtr>
329
+ <Nm>R Epelsteeltje</Nm>
330
+ <PstlAdr>
331
+ <PstCd>75099</PstCd>
332
+ <TwnNm>Amsterdam</TwnNm>
333
+ <Ctry>NL</Ctry>
334
+ <AdrLine>Spuistraat 42</AdrLine>
335
+ </PstlAdr>
336
+ <CtctDtls>
337
+ <Nm>Ron Epelsteeltje</Nm>
338
+ <PhneNb>01234567890</PhneNb>
339
+ <EmailAdr>ron@epelsteeltje.sepa.i.hope.this.works</EmailAdr>
340
+ </CtctDtls>
341
+ </Dbtr>
342
+ <DbtrAcct>
343
+ <Id>
344
+ <IBAN>NLQUIQUIWIGWAM947551</IBAN>
345
+ </Id>
346
+ </DbtrAcct>
347
+ </DrctDbtTxInf>
348
+ <DrctDbtTxInf>
349
+ <PmtId>
350
+ <EndToEndId>MONECOLE REG F13796 PVT 3</EndToEndId>
351
+ </PmtId>
352
+ <PmtTpInf>
353
+ <SeqTp>RCUR</SeqTp>
354
+ </PmtTpInf>
355
+ <InstdAmt Ccy="EUR">1236.78</InstdAmt>
356
+ <DrctDbtTx>
357
+ <MndtRltdInf>
358
+ <MndtId>mandate-id-3</MndtId>
359
+ <DtOfSgntr>2014-01-23</DtOfSgntr>
360
+ </MndtRltdInf>
361
+ </DrctDbtTx>
362
+ <DbtrAgt>
363
+ <FinInstnId>
364
+ <Othr>
365
+ <Id>NOTPROVIDED</Id>
366
+ </Othr>
367
+ </FinInstnId>
368
+ </DbtrAgt>
369
+ <Dbtr>
370
+ <Nm>R Epelsteeltje</Nm>
371
+ <PstlAdr>
372
+ <PstCd>75099</PstCd>
373
+ <TwnNm>Amsterdam</TwnNm>
374
+ <Ctry>NL</Ctry>
375
+ <AdrLine>Spuistraat 42</AdrLine>
376
+ </PstlAdr>
377
+ <CtctDtls>
378
+ <Nm>Ron Epelsteeltje</Nm>
379
+ <PhneNb>01234567890</PhneNb>
380
+ <EmailAdr>ron@epelsteeltje.sepa.i.hope.this.works</EmailAdr>
381
+ </CtctDtls>
382
+ </Dbtr>
383
+ <DbtrAcct>
384
+ <Id>
385
+ <IBAN>NLQUIQUIWIGWAM947551</IBAN>
386
+ </Id>
387
+ </DbtrAcct>
388
+ </DrctDbtTxInf>
307
389
  </PmtInf>
308
390
  </CstmrDrctDbtInitn>
309
391
  </Document>
@@ -0,0 +1,9 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Sepa::PaymentsInitiation::FinancialIdentificationSchemeName1Choice do
6
+ it "should be empty by default" do
7
+ Sepa::PaymentsInitiation::FinancialIdentificationSchemeName1Choice.new({ }).should be_empty
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Sepa::PaymentsInitiation::GenericFinancialIdentification1 do
6
+ it "should be empty by default" do
7
+ Sepa::PaymentsInitiation::GenericFinancialIdentification1.new({ }).should be_empty
8
+ end
9
+ end
@@ -81,4 +81,21 @@ describe Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation d
81
81
  expected.force_encoding(Encoding::UTF_8) if expected.respond_to? :force_encoding
82
82
  xml.should == expected
83
83
  end
84
+
85
+ it "should format time using configured time_format" do
86
+ short_props = {
87
+ "group_header.creation_date_time" => Time.new(1992, 02, 28, 18, 30, 22)
88
+ }
89
+
90
+ begin
91
+ Sepa::Base.time_format = "%Y-%m-%dT%H:%M"
92
+ xml = Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation.new(short_props).generate_xml(:pain_008_001_version => '04')
93
+ xml = check_doc_header_04 xml
94
+ expected = File.read(File.expand_path("../../../expected-grphdr-time-format.xml", __FILE__))
95
+ expected.force_encoding(Encoding::UTF_8) if expected.respond_to? :force_encoding
96
+ xml.should == expected
97
+ ensure
98
+ Sepa::Base.time_format = "%Y-%m-%dT%H:%M:%SZ"
99
+ end
100
+ end
84
101
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sepa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conan Dalton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-17 00:00:00.000000000 Z
11
+ date: 2014-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -107,8 +107,10 @@ files:
107
107
  - lib/sepa/payments_initiation/cash_account_type_choice.rb
108
108
  - lib/sepa/payments_initiation/category_purpose_choice.rb
109
109
  - lib/sepa/payments_initiation/contact_details.rb
110
+ - lib/sepa/payments_initiation/financial_identification_scheme_name_1_choice.rb
110
111
  - lib/sepa/payments_initiation/financial_institution_identification.rb
111
112
  - lib/sepa/payments_initiation/generic_account_identification.rb
113
+ - lib/sepa/payments_initiation/generic_financial_identification_1.rb
112
114
  - lib/sepa/payments_initiation/generic_organisation_identification_1.rb
113
115
  - lib/sepa/payments_initiation/generic_person_identification_1.rb
114
116
  - lib/sepa/payments_initiation/local_instrument_choice.rb
@@ -140,11 +142,14 @@ files:
140
142
  - sepa.gemspec
141
143
  - spec/sepa/direct_debit_order_spec.rb
142
144
  - spec/sepa/direct_debit_properties.yml
145
+ - spec/sepa/expected-grphdr-time-format.xml
143
146
  - spec/sepa/expected-simple.xml
144
147
  - spec/sepa/expected_customer_direct_debit_initiation_v02.xml
145
148
  - spec/sepa/expected_customer_direct_debit_initiation_v02_with_remittance_information.xml
146
149
  - spec/sepa/expected_customer_direct_debit_initiation_v04.xml
147
150
  - spec/sepa/expected_customer_direct_debit_initiation_v04_with_org_id.xml
151
+ - spec/sepa/payments_initiation/financial_identification_scheme_name_1_choice_spec.rb
152
+ - spec/sepa/payments_initiation/generic_financial_identification_1_spec.rb
148
153
  - spec/sepa/payments_initiation/pain00800104/customer_direct_debit_initiation_spec.rb
149
154
  - spec/spec_helper.rb
150
155
  homepage: https://github.com/conanite/sepa
@@ -175,10 +180,13 @@ summary: 'pain.008.001.04 and pain.008.001.02 CustomerDirectDebitInitiation ISO2
175
180
  test_files:
176
181
  - spec/sepa/direct_debit_order_spec.rb
177
182
  - spec/sepa/direct_debit_properties.yml
183
+ - spec/sepa/expected-grphdr-time-format.xml
178
184
  - spec/sepa/expected-simple.xml
179
185
  - spec/sepa/expected_customer_direct_debit_initiation_v02.xml
180
186
  - spec/sepa/expected_customer_direct_debit_initiation_v02_with_remittance_information.xml
181
187
  - spec/sepa/expected_customer_direct_debit_initiation_v04.xml
182
188
  - spec/sepa/expected_customer_direct_debit_initiation_v04_with_org_id.xml
189
+ - spec/sepa/payments_initiation/financial_identification_scheme_name_1_choice_spec.rb
190
+ - spec/sepa/payments_initiation/generic_financial_identification_1_spec.rb
183
191
  - spec/sepa/payments_initiation/pain00800104/customer_direct_debit_initiation_spec.rb
184
192
  - spec/spec_helper.rb