sepa 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/.gitignore +18 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +61 -0
  6. data/Rakefile +1 -0
  7. data/lib/sepa.rb +10 -0
  8. data/lib/sepa/base.rb +82 -0
  9. data/lib/sepa/direct_debit_order.rb +124 -0
  10. data/lib/sepa/payments_initiation.rb +14 -0
  11. data/lib/sepa/payments_initiation/account_identification_choice.rb +7 -0
  12. data/lib/sepa/payments_initiation/account_scheme_name_choice.rb +4 -0
  13. data/lib/sepa/payments_initiation/authorisation.rb +3 -0
  14. data/lib/sepa/payments_initiation/branch_and_financial_institution_identification.rb +6 -0
  15. data/lib/sepa/payments_initiation/cash_account.rb +8 -0
  16. data/lib/sepa/payments_initiation/cash_account_type_choice.rb +2 -0
  17. data/lib/sepa/payments_initiation/category_purpose_choice.rb +3 -0
  18. data/lib/sepa/payments_initiation/contact_details.rb +9 -0
  19. data/lib/sepa/payments_initiation/financial_institution_identification.rb +9 -0
  20. data/lib/sepa/payments_initiation/generic_account_identification.rb +8 -0
  21. data/lib/sepa/payments_initiation/local_instrument_choice.rb +3 -0
  22. data/lib/sepa/payments_initiation/pain00800104/customer_direct_debit_initiation.rb +17 -0
  23. data/lib/sepa/payments_initiation/pain00800104/direct_debit_transaction.rb +4 -0
  24. data/lib/sepa/payments_initiation/pain00800104/direct_debit_transaction_information.rb +25 -0
  25. data/lib/sepa/payments_initiation/pain00800104/group_header.rb +10 -0
  26. data/lib/sepa/payments_initiation/pain00800104/payment_identification.rb +5 -0
  27. data/lib/sepa/payments_initiation/pain00800104/payment_information.rb +22 -0
  28. data/lib/sepa/payments_initiation/pain00800104/payment_type_information.rb +11 -0
  29. data/lib/sepa/payments_initiation/pain00800104/purpose_choice.rb +4 -0
  30. data/lib/sepa/payments_initiation/pain00800104/regulatory_authority.rb +5 -0
  31. data/lib/sepa/payments_initiation/pain00800104/regulatory_reporting.rb +9 -0
  32. data/lib/sepa/payments_initiation/pain00800104/service_level_choice.rb +3 -0
  33. data/lib/sepa/payments_initiation/pain00800104/structured_regulatory_reporting.rb +9 -0
  34. data/lib/sepa/payments_initiation/pain00800104/tax_authorisation.rb +5 -0
  35. data/lib/sepa/payments_initiation/pain00800104/tax_information.rb +7 -0
  36. data/lib/sepa/payments_initiation/pain00800104/tax_party.rb +7 -0
  37. data/lib/sepa/payments_initiation/party_choice_identification.rb +2 -0
  38. data/lib/sepa/payments_initiation/party_identification.rb +12 -0
  39. data/lib/sepa/payments_initiation/postal_address.rb +13 -0
  40. data/lib/sepa/version.rb +3 -0
  41. data/sepa.gemspec +25 -0
  42. data/spec/sepa/direct_debit_order_spec.rb +33 -0
  43. data/spec/sepa/direct_debit_properties.yml +42 -0
  44. data/spec/sepa/expected_customer_direct_debit_initiation.xml +113 -0
  45. data/spec/sepa/payments_initiation/pain00800104/customer_direct_debit_initiation_spec.rb +66 -0
  46. data/spec/spec_helper.rb +7 -0
  47. metadata +145 -0
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .#*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sepa.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 conanite
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # Sepa
2
+
3
+ An implementation of pain.008.001.04 CustomerDirectDebitInitiation.
4
+
5
+ I wanted to make it as easy as possible to define message types and components so this library will be easy to grow to implement the entire standard.
6
+
7
+ Implementations of other messages are welcome.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'sepa'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install sepa
22
+
23
+ ## Usage
24
+
25
+ The simplest way to generate a pain.008.001.04 xml message is to use the DirectDebitOrder module which exposes only the bare essentials. Which is still a lot, but hey, this is a banking standard, what do you expect.
26
+
27
+ Here's an example, ripped off from the spec, of a direct debit order for payments to a single creditor -
28
+
29
+ direct_debits = []
30
+
31
+ # for each direct debit you want to order ...
32
+
33
+ for(each direct debit) do | ... |
34
+ bank_account = Sepa::DirectDebitOrder::BankAccount.new iban, bic
35
+ debtor = Sepa::DirectDebitOrder::Party.new name, addr, nil, postcode, town, country, contact, phone, email
36
+ direct_debits << Sepa::DirectDebitOrder::DirectDebit.new debtor, bank_account, end_to_end_id, amount, "EUR"
37
+ end
38
+
39
+ creditor = Sepa::DirectDebitOrder::Party.new creditor_name, creditor_addr, nil, creditor_postcode, creditor_town, creditor_country, creditor_contact, creditor_phone, creditor_email
40
+
41
+ creditor_account = Sepa::DirectDebitOrder::BankAccount.new creditor_iban, creditor_bic
42
+ payment = Sepa::DirectDebitOrder::CreditorPayment.new creditor, creditor_account, payment_identifier, collection_date, direct_debits
43
+
44
+ initiator = Sepa::DirectDebitOrder::Party.new initiator, initiator_addr, nil, initiator_postcode, initiator_town, initiator_country, initiator_contact, initiator_phone, initiator_email
45
+
46
+ order = Sepa::DirectDebitOrder::Order.new message_identifier, initiator, [payment]
47
+
48
+ order.to_xml
49
+
50
+ 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.
51
+
52
+
53
+ ## Contributing
54
+
55
+ Other message types are totally welcome.
56
+
57
+ 1. Fork it
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/lib/sepa.rb ADDED
@@ -0,0 +1,10 @@
1
+
2
+ require "builder"
3
+ require "aduki"
4
+ require "sepa/version"
5
+ require "sepa/base"
6
+ require "sepa/payments_initiation"
7
+ require "sepa/direct_debit_order"
8
+
9
+ module Sepa
10
+ end
data/lib/sepa/base.rb ADDED
@@ -0,0 +1,82 @@
1
+ module Sepa
2
+ class Base
3
+ include Aduki::Initializer
4
+
5
+ @@attribute_defs = Hash.new { |h,k| h[k] = { } }
6
+
7
+ def build_xml_attributes names
8
+ result = { }
9
+ (names || { }).each { |k,v|
10
+ result[k] = self.send v
11
+ }
12
+ result
13
+ end
14
+
15
+ def to_xml builder
16
+ self.class.attribute_defs.each do |name, meta|
17
+ item = self.send(name)
18
+ options = meta[:options] || { }
19
+ attributes = build_xml_attributes options[:attributes]
20
+ next if item == nil
21
+ if meta[:type] == :string
22
+ builder.__send__(meta[:tag], item, attributes)
23
+ elsif meta[:type] == :[]
24
+ if meta[:member_type] == nil
25
+ item.each { |obj| builder.__send__(meta[:tag], obj, attributes) }
26
+ else
27
+ item.each do |obj|
28
+ builder.__send__(meta[:tag], attributes) { obj.to_xml builder }
29
+ end
30
+ end
31
+ elsif meta[:type] == Time
32
+ v = item.is_a?(String) ? item : item.strftime("%Y-%m-%dT%H:%M:%S")
33
+ builder.__send__(meta[:tag], v, attributes)
34
+ elsif meta[:type] == Date
35
+ v = item.is_a?(String) ? item : item.strftime("%Y-%m-%d")
36
+ builder.__send__(meta[:tag], v, attributes)
37
+ elsif meta[:type].is_a? Class
38
+ builder.__send__(meta[:tag], attributes) { item.to_xml builder }
39
+ end
40
+ end
41
+ end
42
+
43
+ def self.attribute_defs
44
+ @@attribute_defs[self]
45
+ end
46
+
47
+ def self.attribute_defs= arg
48
+ @@attribute_defs[self]= arg
49
+ end
50
+
51
+ def self.definition txt
52
+ end
53
+
54
+ def self.code_or_proprietary
55
+ attribute :code , "Cd"
56
+ attribute :proprietary, "Prtry"
57
+ end
58
+
59
+ def self.attribute name, tag, type=:string, member_type=nil, options={ }
60
+ if type == :[]
61
+ array_attribute name, tag, member_type, options
62
+ elsif type.is_a?(Class) && type != Time && type != Date
63
+ typed_attribute name, tag, type, options
64
+ else
65
+ attr_accessor name
66
+ attribute_defs[name] = { :tag => tag, :type => type, :options => options }
67
+ end
68
+ end
69
+
70
+ def self.typed_attribute name, tag, type, options
71
+ attribute_defs[name] = { :tag => tag, :type => type, :options => options }
72
+ attr_accessor name
73
+ aduki name => type
74
+ end
75
+
76
+ def self.array_attribute name, tag, member_type=nil, options={ }
77
+ attribute_defs[name] = { :tag => tag, :type => :[], :member_type => member_type, :options => options }
78
+ attr_accessor name
79
+ aduki(name => member_type) if member_type
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,124 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ class Sepa::DirectDebitOrder
4
+
5
+ class Order
6
+ attr_accessor :message_id, :initiating_party, :creditor_payments
7
+
8
+ def initialize message_id, initiating_party, creditor_payments
9
+ @message_id, @initiating_party, @creditor_payments = message_id, initiating_party, creditor_payments
10
+ end
11
+
12
+ def to_properties
13
+ hsh = {
14
+ "group_header.message_identification" => message_id,
15
+ "group_header.creation_date_time" => Time.now,
16
+ "group_header.number_of_transactions" => creditor_payments.inject(0) { |sum, cp| sum + cp.number_of_transactions },
17
+ }
18
+
19
+ hsh = hsh.merge initiating_party.to_properties("group_header.initiating_party")
20
+
21
+ creditor_payments.each_with_index { |cp, i|
22
+ hsh = hsh.merge(cp.to_properties("payment_information[#{i}]"))
23
+ }
24
+
25
+ hsh
26
+ end
27
+
28
+ def to_xml
29
+ Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation.new(to_properties).generate_xml
30
+ end
31
+ end
32
+
33
+ class Party
34
+ attr_accessor :name, :address_line_1, :address_line_2, :postcode, :town, :country, :contact_name, :contact_phone, :contact_email
35
+
36
+ def initialize name, address_line_1, address_line_2, postcode, town, country, contact_name, contact_phone, contact_email
37
+ @name, @address_line_1, @address_line_2, @postcode, @town, @country = name, address_line_1, address_line_2, postcode, town, country
38
+ @contact_name, @contact_phone, @contact_email = contact_name, contact_phone, contact_email
39
+ end
40
+
41
+ def to_properties prefix
42
+ hsh = {
43
+ "#{prefix}.name" => name,
44
+ "#{prefix}.postal_address.address_line[0]" => address_line_1,
45
+ "#{prefix}.postal_address.post_code" => postcode,
46
+ "#{prefix}.postal_address.town_name" => town,
47
+ "#{prefix}.postal_address.country" => country,
48
+ "#{prefix}.contact_details.name" => contact_name,
49
+ "#{prefix}.contact_details.phone_number" => contact_phone,
50
+ "#{prefix}.contact_details.email_address" => contact_email,
51
+ }
52
+
53
+ hsh["#{prefix}.postal_address.address_line[1]"] = address_line_2 if address_line_2
54
+
55
+ hsh
56
+ end
57
+ end
58
+
59
+ class CreditorPayment
60
+ attr_accessor :creditor, :creditor_account, :id, :collection_date
61
+ attr_accessor :direct_debits
62
+
63
+ def initialize creditor, creditor_account, id, collection_date, direct_debits
64
+ @creditor, @creditor_account = creditor, creditor_account
65
+ @id, @collection_date = id, collection_date
66
+ @direct_debits = direct_debits
67
+ end
68
+
69
+ def number_of_transactions
70
+ direct_debits.length
71
+ end
72
+
73
+ def to_properties prefix
74
+ hsh = {
75
+ "#{prefix}.payment_information_identification" => id,
76
+ "#{prefix}.payment_method" => "DD",
77
+ "#{prefix}.requested_collection_date" => collection_date
78
+ }
79
+
80
+ hsh = hsh.merge creditor.to_properties("#{prefix}.creditor")
81
+ hsh = hsh.merge creditor_account.to_properties("#{prefix}.creditor")
82
+
83
+ direct_debits.each_with_index { |dd, j|
84
+ hsh = hsh.merge(dd.to_properties("#{prefix}.direct_debit_transaction_information[#{j}]"))
85
+ }
86
+
87
+ hsh
88
+ end
89
+ end
90
+
91
+ class BankAccount
92
+ attr_accessor :iban, :swift
93
+
94
+ def initialize iban, swift
95
+ @iban, @swift = iban, swift
96
+ end
97
+
98
+ def to_properties prefix
99
+ { "#{prefix}_account.identification.iban" => iban,
100
+ "#{prefix}_agent.financial_institution_identification.bic_fi" => swift }
101
+ end
102
+ end
103
+
104
+ class DirectDebit
105
+ attr_accessor :debtor, :debtor_account, :end_to_end_id, :amount, :currency
106
+
107
+ def initialize debtor, debtor_account, end_to_end_id, amount, currency
108
+ @debtor, @debtor_account, @end_to_end_id, @amount, @currency = debtor, debtor_account, end_to_end_id, amount, currency
109
+ end
110
+
111
+ def to_properties prefix
112
+ hsh = {
113
+ "#{prefix}.payment_identification.end_to_end_identification" => end_to_end_id,
114
+ "#{prefix}.instructed_amount" => ("%.2f" % amount),
115
+ "#{prefix}.instructed_amount_currency" => "EUR",
116
+ }
117
+ hsh = hsh.merge debtor.to_properties("#{prefix}.debtor")
118
+ hsh = hsh.merge debtor_account.to_properties("#{prefix}.debtor")
119
+ hsh
120
+ end
121
+ end
122
+
123
+ end
124
+
@@ -0,0 +1,14 @@
1
+ module Sepa
2
+ module PaymentsInitiation
3
+ module Pain00800104
4
+ end
5
+ end
6
+ end
7
+
8
+ Dir["lib/sepa/payments_initiation/*.rb"].each do |f|
9
+ require f.gsub("lib/", "")
10
+ end
11
+
12
+ Dir["lib/sepa/payments_initiation/pain00800104/**/*.rb"].each do |f|
13
+ require f.gsub("lib/", "")
14
+ end
@@ -0,0 +1,7 @@
1
+ require "sepa/payments_initiation/generic_account_identification"
2
+
3
+ class Sepa::PaymentsInitiation::AccountIdentificationChoice < Sepa::Base
4
+ definition "Specifies the unique identification of an account as assigned by the account servicer."
5
+ attribute :iban, "IBAN"
6
+ attribute :other, "Othr", Sepa::PaymentsInitiation::GenericAccountIdentification
7
+ end
@@ -0,0 +1,4 @@
1
+ class Sepa::PaymentsInitiation::AccountSchemeNameChoice < Sepa::Base
2
+ definition "Name of the identification scheme"
3
+ code_or_proprietary
4
+ end
@@ -0,0 +1,3 @@
1
+ class Sepa::PaymentsInitiation::Authorisation < Sepa::Base
2
+ code_or_proprietary
3
+ end
@@ -0,0 +1,6 @@
1
+ require "sepa/payments_initiation/financial_institution_identification"
2
+
3
+ class Sepa::PaymentsInitiation::BranchAndFinancialInstitutionIdentification < Sepa::Base
4
+ definition "Set of elements used to uniquely and unambiguously identify a financial institution or a branch of a financial institution."
5
+ attribute :financial_institution_identification, "FinInstnId", Sepa::PaymentsInitiation::FinancialInstitutionIdentification
6
+ end
@@ -0,0 +1,8 @@
1
+ require "sepa/payments_initiation/cash_account_type_choice"
2
+
3
+ class Sepa::PaymentsInitiation::CashAccount < Sepa::Base
4
+ attribute :identification, "Id", Sepa::PaymentsInitiation::AccountIdentificationChoice
5
+ attribute :type, "Tp", Sepa::PaymentsInitiation::CashAccountTypeChoice
6
+ attribute :currency, "Ccy"
7
+ attribute :name, "Nm"
8
+ end
@@ -0,0 +1,2 @@
1
+ class Sepa::PaymentsInitiation::CashAccountTypeChoice < Sepa::Base
2
+ end
@@ -0,0 +1,3 @@
1
+ class Sepa::PaymentsInitiation::CategoryPurposeChoice < Sepa::Base
2
+ code_or_proprietary
3
+ end
@@ -0,0 +1,9 @@
1
+ class Sepa::PaymentsInitiation::ContactDetails < Sepa::Base
2
+ attribute :name_prefix , "NmPrfx"
3
+ attribute :name , "Nm"
4
+ attribute :phone_number , "PhneNb"
5
+ attribute :mobile_number, "MobNb"
6
+ attribute :fax_number , "FaxNb"
7
+ attribute :email_address, "EmailAdr"
8
+ attribute :other , "Othr"
9
+ end
@@ -0,0 +1,9 @@
1
+ require "sepa/payments_initiation/postal_address"
2
+
3
+ class Sepa::PaymentsInitiation::FinancialInstitutionIdentification < Sepa::Base
4
+ definition "Unique and unambiguous identification of a financial institution, as assigned under an internationally recognised or proprietary identification scheme."
5
+ attribute :bic_fi, "BICFI"
6
+ attribute :name, "Nm"
7
+ attribute :postal_address, "PstlAdr", Sepa::PaymentsInitiation::PostalAddress
8
+
9
+ end
@@ -0,0 +1,8 @@
1
+ require "sepa/payments_initiation/account_scheme_name_choice"
2
+
3
+ class Sepa::PaymentsInitiation::GenericAccountIdentification < Sepa::Base
4
+ definition "Unique identification of an account, as assigned by the account servicer, using an identification scheme."
5
+ attribute :identification, "Id"
6
+ attribute :scheme_name , "SchmeNm", Sepa::PaymentsInitiation::AccountSchemeNameChoice
7
+ attribute :issuer , "Issr"
8
+ end
@@ -0,0 +1,3 @@
1
+ class Sepa::PaymentsInitiation::LocalInstrumentChoice < Sepa::Base
2
+ code_or_proprietary
3
+ end
@@ -0,0 +1,17 @@
1
+ require "sepa/payments_initiation/pain00800104/group_header"
2
+ require "sepa/payments_initiation/pain00800104/payment_information"
3
+
4
+ class Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation < Sepa::Base
5
+ attribute :group_header , "GrpHdr", Sepa::PaymentsInitiation::Pain00800104::GroupHeader
6
+ attribute :payment_information , "PmtInf", :[], Sepa::PaymentsInitiation::Pain00800104::PaymentInformation
7
+
8
+ def generate_xml
9
+ builder = Builder::XmlMarkup.new(:indent => 2)
10
+ 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") {
12
+ builder.CstmrDrctDbtInitn {
13
+ self.to_xml builder
14
+ }
15
+ }
16
+ end
17
+ end
@@ -0,0 +1,4 @@
1
+ class Sepa::PaymentsInitiation::Pain00800104::DirectDebitTransaction < Sepa::Base
2
+ definition "Provides information specific to the direct debit mandate."
3
+
4
+ end
@@ -0,0 +1,25 @@
1
+ require "sepa/payments_initiation/pain00800104/payment_identification"
2
+ require "sepa/payments_initiation/pain00800104/payment_type_information"
3
+ require "sepa/payments_initiation/pain00800104/direct_debit_transaction"
4
+ require "sepa/payments_initiation/pain00800104/purpose_choice"
5
+ require "sepa/payments_initiation/pain00800104/regulatory_reporting"
6
+
7
+ class Sepa::PaymentsInitiation::Pain00800104::DirectDebitTransactionInformation < Sepa::Base
8
+ definition "Provides information on the individual transaction(s) included in the message."
9
+ attribute :payment_identification , "PmtId" , Sepa::PaymentsInitiation::Pain00800104::PaymentIdentification
10
+ attribute :payment_type_information , "PmtTpInf" , Sepa::PaymentsInitiation::Pain00800104::PaymentTypeInformation
11
+ attribute :instructed_amount , "InstdAmt" , :string, nil, :attributes => { :Ccy => :instructed_amount_currency }
12
+ attribute :charge_bearer , "ChrgBr"
13
+ attribute :direct_debit_transation , "DrctDbtTx" , Sepa::PaymentsInitiation::Pain00800104::DirectDebitTransaction
14
+ attribute :ultimate_creditor , "UltmtCdtr" , Sepa::PaymentsInitiation::PartyIdentification
15
+ attribute :debtor_agent , "DbtrAgt" , Sepa::PaymentsInitiation::BranchAndFinancialInstitutionIdentification
16
+ attribute :debtor_agent_account , "DbtrAgtAcct" , Sepa::PaymentsInitiation::CashAccount
17
+ attribute :debtor , "Dbtr" , Sepa::PaymentsInitiation::PartyIdentification
18
+ attribute :debtor_account , "DbtrAcct" , Sepa::PaymentsInitiation::CashAccount
19
+ attribute :ultimate_debtor , "UltmtDbtr" , Sepa::PaymentsInitiation::PartyIdentification
20
+ attribute :instruction_for_creditor_agent, "InstrForCdtrAgt"
21
+ attribute :purpose , "Purp" , Sepa::PaymentsInitiation::Pain00800104::PurposeChoice
22
+ attribute :regulatory_reporting , "RgltryRptg" , :[], Sepa::PaymentsInitiation::Pain00800104::RegulatoryReporting
23
+
24
+ attr_accessor :instructed_amount_currency
25
+ end
@@ -0,0 +1,10 @@
1
+ class Sepa::PaymentsInitiation::Pain00800104::GroupHeader < Sepa::Base
2
+ definition "Set of characteristics shared by all individual transactions included in the message."
3
+ attribute :message_identification, "MsgId"
4
+ attribute :creation_date_time , "CreDtTm", Time
5
+ attribute :number_of_transactions, "NbOfTxs"
6
+ attribute :initiating_party , "InitgPty", Sepa::PaymentsInitiation::PartyIdentification
7
+ attribute :control_sum , "CtrlSum"
8
+ attribute :authorisation , "Authstn", Sepa::PaymentsInitiation::Authorisation
9
+ attribute :forwarding_agent , "FwdgAgt", Sepa::PaymentsInitiation::BranchAndFinancialInstitutionIdentification
10
+ end
@@ -0,0 +1,5 @@
1
+ class Sepa::PaymentsInitiation::Pain00800104::PaymentIdentification < Sepa::Base
2
+ definition "Set of elements used to reference a payment instruction."
3
+ attribute :instruction_identification, "InstrId"
4
+ attribute :end_to_end_identification, "EndToEndId"
5
+ end
@@ -0,0 +1,22 @@
1
+ require "sepa/payments_initiation/pain00800104/direct_debit_transaction_information"
2
+
3
+ class Sepa::PaymentsInitiation::Pain00800104::PaymentInformation < Sepa::Base
4
+ attribute :payment_information_identification , "PmtInfId"
5
+ attribute :payment_method , "PmtMtd"
6
+ attribute :batch_booking , "BtchBookg"
7
+ attribute :number_of_transactions , "NbOfTxs"
8
+ attribute :control_sum , "CtrlSum"
9
+ attribute :payment_type_information , "PmtTpInf"
10
+ attribute :requested_collection_date , "ReqdColltnDt", Date
11
+ attribute :creditor , "Cdtr" , Sepa::PaymentsInitiation::PartyIdentification
12
+ attribute :creditor_account , "CdtrAcct" , Sepa::PaymentsInitiation::CashAccount
13
+ attribute :creditor_agent , "CdtrAgt" , Sepa::PaymentsInitiation::BranchAndFinancialInstitutionIdentification
14
+ attribute :creditor_agent_account , "CdtrAgtAcct" , Sepa::PaymentsInitiation::CashAccount
15
+ attribute :ultimate_creditor , "UltmtCdtr" , Sepa::PaymentsInitiation::PartyIdentification
16
+ attribute :charge_bearer , "ChrgBr"
17
+ attribute :charges_account , "ChrgsAcct" , Sepa::PaymentsInitiation::CashAccount
18
+ attribute :charges_account_agent , "ChrgsAcctAgt", Sepa::PaymentsInitiation::BranchAndFinancialInstitutionIdentification
19
+ attribute :creditor_scheme_identification , "CdtrSchmeId" , Sepa::PaymentsInitiation::PartyIdentification
20
+ attribute :direct_debit_transaction_information, "DrctDbtTxInf", :[], Sepa::PaymentsInitiation::Pain00800104::DirectDebitTransactionInformation
21
+ end
22
+
@@ -0,0 +1,11 @@
1
+ require "sepa/payments_initiation/pain00800104/service_level_choice"
2
+ require "sepa/payments_initiation/local_instrument_choice"
3
+
4
+ class Sepa::PaymentsInitiation::Pain00800104::PaymentTypeInformation < Sepa::Base
5
+ definition "Set of elements used to further specify the type of transaction."
6
+ attribute :instruction_priority, "InstrPrty"
7
+ attribute :service_level , "SvcLvl", Sepa::PaymentsInitiation::Pain00800104::ServiceLevelChoice
8
+ attribute :local_instrument , "LclInstrm", Sepa::PaymentsInitiation::LocalInstrumentChoice
9
+ attribute :sequence_type , "SeqTp"
10
+ attribute :category_purpose , "CtgyPurp", Sepa::PaymentsInitiation::CategoryPurposeChoice
11
+ end
@@ -0,0 +1,4 @@
1
+ class Sepa::PaymentsInitiation::Pain00800104::PurposeChoice < Sepa::Base
2
+ definition "Underlying reason for the payment transaction."
3
+ code_or_proprietary
4
+ end
@@ -0,0 +1,5 @@
1
+ class Sepa::PaymentsInitiation::Pain00800104::RegulatoryAuthority < Sepa::Base
2
+ definition "Entity requiring the regulatory reporting information."
3
+ attribute :name, "Nm"
4
+ attribute :country, "Ctry"
5
+ end
@@ -0,0 +1,9 @@
1
+ require "sepa/payments_initiation/pain00800104/regulatory_authority"
2
+ require "sepa/payments_initiation/pain00800104/structured_regulatory_reporting"
3
+
4
+ class Sepa::PaymentsInitiation::Pain00800104::RegulatoryReporting < Sepa::Base
5
+ definition "Information needed due to regulatory and/or statutory requirements."
6
+ attribute :debit_credit_reporting_indicator, "DbtCdtRptgInd"
7
+ attribute :authority , "Authrty" , Sepa::PaymentsInitiation::Pain00800104::RegulatoryAuthority
8
+ attribute :details , "Dtls" , Sepa::PaymentsInitiation::Pain00800104::StructuredRegulatoryReporting
9
+ end
@@ -0,0 +1,3 @@
1
+ class Sepa::PaymentsInitiation::Pain00800104::ServiceLevelChoice < Sepa::Base
2
+ code_or_proprietary
3
+ end
@@ -0,0 +1,9 @@
1
+ class Sepa::PaymentsInitiation::Pain00800104::StructuredRegulatoryReporting < Sepa::Base
2
+ definition "Set of elements used to provide details on the regulatory reporting information."
3
+ attribute :type , "Tp"
4
+ attribute :date , "Dt" , Date
5
+ attribute :country , "Ctry"
6
+ attribute :code , "Cd"
7
+ attribute :amount , "Amt"
8
+ attribute :information, :[]
9
+ end
@@ -0,0 +1,5 @@
1
+ class Sepa::PaymentsInitiation::Pain00800104::TaxAuthorisation < Sepa::Base
2
+ definition "Details of the authorised tax paying party."
3
+ attribute :title, "Titl"
4
+ attribute :name, "Nm"
5
+ end
@@ -0,0 +1,7 @@
1
+ require "sepa/payments_initiation/pain00800104/tax_party"
2
+
3
+ class Sepa::PaymentsInitiation::Pain00800104::TaxInformation < Sepa::Base
4
+ definition "Details about tax paid, or to be paid, to the government in accordance with the law, including pre-defined parameters such as thresholds and type of account."
5
+ attribute :creditor, "Cdtr", Sepa::PaymentsInitiation::Pain00800104::TaxParty
6
+ attribute :debtor, "Dbtr", Sepa::PaymentsInitiation::Pain00800104::TaxParty
7
+ end
@@ -0,0 +1,7 @@
1
+ class Sepa::PaymentsInitiation::Pain00800104::TaxParty < Sepa::Base
2
+ definition "Party to the transaction to which the tax applies."
3
+ attribute :tax_identification, "TaxId"
4
+ attribute :registration_identification, "RegnId"
5
+ attribute :tax_type, "TaxTp"
6
+ attribute :authorisation, "Authstn", Sepa::PaymentsInitiation::Pain00800104::TaxAuthorisation
7
+ end
@@ -0,0 +1,2 @@
1
+ class Sepa::PaymentsInitiation::PartyChoiceIdentification < Sepa::Base
2
+ end
@@ -0,0 +1,12 @@
1
+ require "sepa/payments_initiation/postal_address"
2
+ require "sepa/payments_initiation/party_choice_identification"
3
+
4
+ class Sepa::PaymentsInitiation::PartyIdentification < Sepa::Base
5
+ definition "Set of elements used to identify a person or an organisation."
6
+ attribute :name , "Nm"
7
+ attribute :postal_address , "PstlAdr" , Sepa::PaymentsInitiation::PostalAddress
8
+ attribute :identification , "Id" , Sepa::PaymentsInitiation::PartyChoiceIdentification
9
+ attribute :country_of_residence, "CtryOfRes"
10
+ attribute :contact_details , "CtctDtls" , Sepa::PaymentsInitiation::ContactDetails
11
+ end
12
+
@@ -0,0 +1,13 @@
1
+ class Sepa::PaymentsInitiation::PostalAddress < Sepa::Base
2
+ definition "Information that locates and identifies a specific address, as defined by postal services."
3
+ attribute :address_type , "AdrTyp"
4
+ attribute :department , "Dept"
5
+ attribute :sub_department , "SubDept"
6
+ attribute :street_name , "StrtNm"
7
+ attribute :building_number , "BldgNb"
8
+ attribute :post_code , "PstCd"
9
+ attribute :town_name , "TwnNm"
10
+ attribute :country_sub_division , "CtySubDvsn"
11
+ attribute :country , "Ctry"
12
+ attribute :address_line , "AdrLine" , :[]
13
+ end
@@ -0,0 +1,3 @@
1
+ module Sepa
2
+ VERSION = "0.0.1"
3
+ end
data/sepa.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8; mode: ruby -*-
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ require 'sepa/version'
7
+
8
+ Gem::Specification.new do |gem|
9
+ gem.name = "sepa"
10
+ gem.version = Sepa::VERSION
11
+ gem.authors = ["Conan Dalton"]
12
+ gem.email = ["conan@conandalton.net"]
13
+ gem.description = %q{ Generate ISO20022 XML messages. Implements pain.008.001.04 CustomerDirectDebitInitiation for now.}
14
+ gem.summary = %q{ pain.008.001.04 CustomerDirectDebitInitiation ISO20022 XML }
15
+ gem.homepage = "https://github.com/conanite/sepa"
16
+
17
+ gem.add_dependency 'builder'
18
+ gem.add_dependency 'aduki'
19
+ gem.add_development_dependency 'rspec', '~> 2.9'
20
+
21
+ gem.files = `git ls-files`.split($/)
22
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
23
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
24
+ gem.require_paths = ["lib"]
25
+ end
@@ -0,0 +1,33 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require "spec_helper"
4
+ require "time"
5
+
6
+ describe Sepa::DirectDebitOrder do
7
+
8
+ it "should produce xml corresponding to the given inputs" do
9
+ bank_account0 = Sepa::DirectDebitOrder::BankAccount.new "FRZIZIPAPARAZZI345789", "FRZZPPKOOKOO"
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"
12
+
13
+ bank_account1 = Sepa::DirectDebitOrder::BankAccount.new "FRQUIQUIWIGWAM947551", "FRQQWIGGA"
14
+ 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"
16
+
17
+ sepa_now = Time.strptime "1992-02-28T18:30:00", "%Y-%m-%dT%H:%M:%S"
18
+ Time.stub(:now).and_return sepa_now
19
+
20
+ 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
+ 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]
23
+
24
+ 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
+
26
+ order = Sepa::DirectDebitOrder::Order.new "MSG0001", initiator, [payment]
27
+
28
+ xml = order.to_xml
29
+ expected = File.read(File.expand_path("../expected_customer_direct_debit_initiation.xml", __FILE__))
30
+ xml.should == expected
31
+ end
32
+ end
33
+
@@ -0,0 +1,42 @@
1
+ ---
2
+ group_header.message_identification: MSG0001
3
+ group_header.creation_date_time: '1992-02-28T18:30:00'
4
+ group_header.number_of_transactions: '3'
5
+ group_header.initiating_party.name: SOFTIFY SARL
6
+ group_header.initiating_party.postal_address.address_line[0]: 289, Livva de Getamire
7
+ group_header.initiating_party.postal_address.post_code: '75021'
8
+ group_header.initiating_party.postal_address.town_name: Paris
9
+ group_header.initiating_party.postal_address.country: FR
10
+ payment_information[0].payment_information_identification: MONECOLE_PAYMENTS_20130703
11
+ payment_information[0].payment_method: DD
12
+ payment_information[0].requested_collection_date: '2013-07-10'
13
+ payment_information[0].creditor.name: Mon École
14
+ payment_information[0].creditor.postal_address.address_line[0]: 3, Livva de Getamire
15
+ payment_information[0].creditor.postal_address.post_code: '75022'
16
+ payment_information[0].creditor.postal_address.town_name: Paris
17
+ payment_information[0].creditor.postal_address.country: FR
18
+ payment_information[0].creditor.contact_details.name: M. le Directeur
19
+ payment_information[0].creditor.contact_details.phone_number: +33 999 999 999
20
+ payment_information[0].creditor.contact_details.email_address: directeur@monecole.softify.com
21
+ payment_information[0].creditor_account.identification.iban: FRGOOGOOYADDA9999999
22
+ payment_information[0].creditor_agent.financial_institution_identification.bic_fi: FRGGYELLOW99
23
+ payment_information[0].direct_debit_transaction_information[0].payment_identification.end_to_end_identification: MONECOLE REG F13789 PVT 3
24
+ payment_information[0].direct_debit_transaction_information[0].instructed_amount: '1231.31'
25
+ payment_information[0].direct_debit_transaction_information[0].instructed_amount_currency: EUR
26
+ payment_information[0].direct_debit_transaction_information[0].debtor_agent.financial_institution_identification.bic_fi: FRZZPPKOOKOO
27
+ payment_information[0].direct_debit_transaction_information[0].debtor.name: DALTON/CONANMR
28
+ payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.address_line[0]: 64, Livva de Getamire
29
+ payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.post_code: '75024'
30
+ payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.town_name: PARIS
31
+ payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.country: FR
32
+ payment_information[0].direct_debit_transaction_information[0].debtor_account.identification.iban: FRZIZIPAPARAZZI345789
33
+ payment_information[0].direct_debit_transaction_information[1].payment_identification.end_to_end_identification: MONECOLE REG F13790 PVT 3
34
+ payment_information[0].direct_debit_transaction_information[1].instructed_amount: '1732.32'
35
+ payment_information[0].direct_debit_transaction_information[1].instructed_amount_currency: EUR
36
+ payment_information[0].direct_debit_transaction_information[1].debtor_agent.financial_institution_identification.bic_fi: FRQQWIGGA
37
+ payment_information[0].direct_debit_transaction_information[1].debtor.name: ADAMS/SAMUELMR
38
+ payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.address_line[0]: 256, Livva de Getamire
39
+ payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.post_code: '75048'
40
+ payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.town_name: PARIS
41
+ payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.country: FR
42
+ payment_information[0].direct_debit_transaction_information[1].debtor_account.identification.iban: FRQUIQUIWIGWAM947551
@@ -0,0 +1,113 @@
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>2</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
+ </GrpHdr>
23
+ <PmtInf>
24
+ <PmtInfId>MONECOLE_PAYMENTS_20130703</PmtInfId>
25
+ <PmtMtd>DD</PmtMtd>
26
+ <ReqdColltnDt>2013-07-10</ReqdColltnDt>
27
+ <Cdtr>
28
+ <Nm>Mon École</Nm>
29
+ <PstlAdr>
30
+ <PstCd>75022</PstCd>
31
+ <TwnNm>Paris</TwnNm>
32
+ <Ctry>FR</Ctry>
33
+ <AdrLine>3, Livva de Getamire</AdrLine>
34
+ </PstlAdr>
35
+ <CtctDtls>
36
+ <Nm>M. le Directeur</Nm>
37
+ <PhneNb>+33 999 999 999</PhneNb>
38
+ <EmailAdr>directeur@monecole.softify.com</EmailAdr>
39
+ </CtctDtls>
40
+ </Cdtr>
41
+ <CdtrAcct>
42
+ <Id>
43
+ <IBAN>FRGOOGOOYADDA9999999</IBAN>
44
+ </Id>
45
+ </CdtrAcct>
46
+ <CdtrAgt>
47
+ <FinInstnId>
48
+ <BICFI>FRGGYELLOW99</BICFI>
49
+ </FinInstnId>
50
+ </CdtrAgt>
51
+ <DrctDbtTxInf>
52
+ <PmtId>
53
+ <EndToEndId>MONECOLE REG F13789 PVT 3</EndToEndId>
54
+ </PmtId>
55
+ <InstdAmt Ccy="EUR">1231.31</InstdAmt>
56
+ <DbtrAgt>
57
+ <FinInstnId>
58
+ <BICFI>FRZZPPKOOKOO</BICFI>
59
+ </FinInstnId>
60
+ </DbtrAgt>
61
+ <Dbtr>
62
+ <Nm>DALTON/CONANMR</Nm>
63
+ <PstlAdr>
64
+ <PstCd>30005</PstCd>
65
+ <TwnNm>RENNES</TwnNm>
66
+ <Ctry>FR</Ctry>
67
+ <AdrLine>64, Livva de Getamire</AdrLine>
68
+ </PstlAdr>
69
+ <CtctDtls>
70
+ <Nm>Conan DALTON</Nm>
71
+ <PhneNb>01234567890</PhneNb>
72
+ <EmailAdr>conan@dalton.sepa.i.hope.this.works</EmailAdr>
73
+ </CtctDtls>
74
+ </Dbtr>
75
+ <DbtrAcct>
76
+ <Id>
77
+ <IBAN>FRZIZIPAPARAZZI345789</IBAN>
78
+ </Id>
79
+ </DbtrAcct>
80
+ </DrctDbtTxInf>
81
+ <DrctDbtTxInf>
82
+ <PmtId>
83
+ <EndToEndId>MONECOLE REG F13790 PVT 3</EndToEndId>
84
+ </PmtId>
85
+ <InstdAmt Ccy="EUR">1732.32</InstdAmt>
86
+ <DbtrAgt>
87
+ <FinInstnId>
88
+ <BICFI>FRQQWIGGA</BICFI>
89
+ </FinInstnId>
90
+ </DbtrAgt>
91
+ <Dbtr>
92
+ <Nm>ADAMS/SAMUELMR</Nm>
93
+ <PstlAdr>
94
+ <PstCd>75048</PstCd>
95
+ <TwnNm>PARIS</TwnNm>
96
+ <Ctry>FR</Ctry>
97
+ <AdrLine>256, Livva de Getamire</AdrLine>
98
+ </PstlAdr>
99
+ <CtctDtls>
100
+ <Nm>Samuel ADAMS</Nm>
101
+ <PhneNb>09876543210</PhneNb>
102
+ <EmailAdr>samuel@adams.sepa.i.hope.this.works</EmailAdr>
103
+ </CtctDtls>
104
+ </Dbtr>
105
+ <DbtrAcct>
106
+ <Id>
107
+ <IBAN>FRQUIQUIWIGWAM947551</IBAN>
108
+ </Id>
109
+ </DbtrAcct>
110
+ </DrctDbtTxInf>
111
+ </PmtInf>
112
+ </CstmrDrctDbtInitn>
113
+ </Document>
@@ -0,0 +1,66 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require "spec_helper"
4
+
5
+ describe Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation do
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",
32
+ "payment_information[0].creditor_agent.financial_institution_identification.bic_fi" => "FRGGYELLOW99",
33
+ "payment_information[0].direct_debit_transaction_information[0].payment_identification.end_to_end_identification" => "MONECOLE REG F13789 PVT 3",
34
+ "payment_information[0].direct_debit_transaction_information[0].instructed_amount" => "1231.31",
35
+ "payment_information[0].direct_debit_transaction_information[0].instructed_amount_currency" => "EUR",
36
+ "payment_information[0].direct_debit_transaction_information[0].debtor_agent.financial_institution_identification.bic_fi" => "FRZZPPKOOKOO",
37
+ "payment_information[0].direct_debit_transaction_information[0].debtor.name" => "DALTON/CONANMR",
38
+ "payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.address_line[0]" => "64, Livva de Getamire",
39
+ "payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.post_code" => "30005",
40
+ "payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.town_name" => "RENNES",
41
+ "payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.country" => "FR",
42
+ "payment_information[0].direct_debit_transaction_information[0].debtor.contact_details.name" => "Conan DALTON",
43
+ "payment_information[0].direct_debit_transaction_information[0].debtor.contact_details.phone_number" => "01234567890",
44
+ "payment_information[0].direct_debit_transaction_information[0].debtor.contact_details.email_address" => "conan@dalton.sepa.i.hope.this.works",
45
+ "payment_information[0].direct_debit_transaction_information[0].debtor_account.identification.iban" => "FRZIZIPAPARAZZI345789",
46
+ "payment_information[0].direct_debit_transaction_information[1].payment_identification.end_to_end_identification" => "MONECOLE REG F13790 PVT 3",
47
+ "payment_information[0].direct_debit_transaction_information[1].instructed_amount" => "1732.32",
48
+ "payment_information[0].direct_debit_transaction_information[1].instructed_amount_currency" => "EUR",
49
+ "payment_information[0].direct_debit_transaction_information[1].debtor_agent.financial_institution_identification.bic_fi" => "FRQQWIGGA",
50
+ "payment_information[0].direct_debit_transaction_information[1].debtor.name" => "ADAMS/SAMUELMR",
51
+ "payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.address_line[0]" => "256, Livva de Getamire",
52
+ "payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.post_code" => "75048",
53
+ "payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.town_name" => "PARIS",
54
+ "payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.country" => "FR",
55
+ "payment_information[0].direct_debit_transaction_information[1].debtor_account.identification.iban" => "FRQUIQUIWIGWAM947551",
56
+ "payment_information[0].direct_debit_transaction_information[1].debtor.contact_details.name" => "Samuel ADAMS",
57
+ "payment_information[0].direct_debit_transaction_information[1].debtor.contact_details.phone_number" => "09876543210",
58
+ "payment_information[0].direct_debit_transaction_information[1].debtor.contact_details.email_address" => "samuel@adams.sepa.i.hope.this.works"
59
+ }
60
+
61
+ xml = Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation.new(props).generate_xml
62
+ expected = File.read(File.expand_path("../../../expected_customer_direct_debit_initiation.xml", __FILE__))
63
+ xml.should == expected
64
+ end
65
+ end
66
+
@@ -0,0 +1,7 @@
1
+ require 'sepa'
2
+
3
+ RSpec.configure do |config|
4
+ config.treat_symbols_as_metadata_keys_with_true_values = true
5
+ config.run_all_when_everything_filtered = true
6
+ config.order = 'random'
7
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sepa
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Conan Dalton
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: builder
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: aduki
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '2.9'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.9'
62
+ description: ! ' Generate ISO20022 XML messages. Implements pain.008.001.04 CustomerDirectDebitInitiation
63
+ for now.'
64
+ email:
65
+ - conan@conandalton.net
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - .gitignore
71
+ - .rspec
72
+ - Gemfile
73
+ - LICENSE.txt
74
+ - README.md
75
+ - Rakefile
76
+ - lib/sepa.rb
77
+ - lib/sepa/base.rb
78
+ - lib/sepa/direct_debit_order.rb
79
+ - lib/sepa/payments_initiation.rb
80
+ - lib/sepa/payments_initiation/account_identification_choice.rb
81
+ - lib/sepa/payments_initiation/account_scheme_name_choice.rb
82
+ - lib/sepa/payments_initiation/authorisation.rb
83
+ - lib/sepa/payments_initiation/branch_and_financial_institution_identification.rb
84
+ - lib/sepa/payments_initiation/cash_account.rb
85
+ - lib/sepa/payments_initiation/cash_account_type_choice.rb
86
+ - lib/sepa/payments_initiation/category_purpose_choice.rb
87
+ - lib/sepa/payments_initiation/contact_details.rb
88
+ - lib/sepa/payments_initiation/financial_institution_identification.rb
89
+ - lib/sepa/payments_initiation/generic_account_identification.rb
90
+ - lib/sepa/payments_initiation/local_instrument_choice.rb
91
+ - lib/sepa/payments_initiation/pain00800104/customer_direct_debit_initiation.rb
92
+ - lib/sepa/payments_initiation/pain00800104/direct_debit_transaction.rb
93
+ - lib/sepa/payments_initiation/pain00800104/direct_debit_transaction_information.rb
94
+ - lib/sepa/payments_initiation/pain00800104/group_header.rb
95
+ - lib/sepa/payments_initiation/pain00800104/payment_identification.rb
96
+ - lib/sepa/payments_initiation/pain00800104/payment_information.rb
97
+ - lib/sepa/payments_initiation/pain00800104/payment_type_information.rb
98
+ - lib/sepa/payments_initiation/pain00800104/purpose_choice.rb
99
+ - lib/sepa/payments_initiation/pain00800104/regulatory_authority.rb
100
+ - lib/sepa/payments_initiation/pain00800104/regulatory_reporting.rb
101
+ - lib/sepa/payments_initiation/pain00800104/service_level_choice.rb
102
+ - lib/sepa/payments_initiation/pain00800104/structured_regulatory_reporting.rb
103
+ - lib/sepa/payments_initiation/pain00800104/tax_authorisation.rb
104
+ - lib/sepa/payments_initiation/pain00800104/tax_information.rb
105
+ - lib/sepa/payments_initiation/pain00800104/tax_party.rb
106
+ - lib/sepa/payments_initiation/party_choice_identification.rb
107
+ - lib/sepa/payments_initiation/party_identification.rb
108
+ - lib/sepa/payments_initiation/postal_address.rb
109
+ - lib/sepa/version.rb
110
+ - sepa.gemspec
111
+ - spec/sepa/direct_debit_order_spec.rb
112
+ - spec/sepa/direct_debit_properties.yml
113
+ - spec/sepa/expected_customer_direct_debit_initiation.xml
114
+ - spec/sepa/payments_initiation/pain00800104/customer_direct_debit_initiation_spec.rb
115
+ - spec/spec_helper.rb
116
+ homepage: https://github.com/conanite/sepa
117
+ licenses: []
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 1.8.24
137
+ signing_key:
138
+ specification_version: 3
139
+ summary: pain.008.001.04 CustomerDirectDebitInitiation ISO20022 XML
140
+ test_files:
141
+ - spec/sepa/direct_debit_order_spec.rb
142
+ - spec/sepa/direct_debit_properties.yml
143
+ - spec/sepa/expected_customer_direct_debit_initiation.xml
144
+ - spec/sepa/payments_initiation/pain00800104/customer_direct_debit_initiation_spec.rb
145
+ - spec/spec_helper.rb