sepa 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Sepa
2
2
 
3
- An implementation of pain.008.001.04 CustomerDirectDebitInitiation. WARNING: NO WARRANTY, USE AT YOUR OWN RISK AND PERIL.
3
+ An implementation of pain.008.001.04 CustomerDirectDebitInitiation. WARNING: NO WARRANTY, USE AT YOUR OWN RISK AND PERIL.
4
4
 
5
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
6
 
@@ -22,30 +22,36 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
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.
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
26
+ is still a lot, but hey, this is a banking standard, what do you expect.
26
27
 
27
- Here's an example, ripped off from the spec, of a direct debit order for payments to a single creditor -
28
+ Here's an example, ripped off from the spec, of a direct debit order for payments to a single creditor. You need to provide a list of direct
29
+ debits, each with information about the amount, the bank account to debit, and the name and contact details of the debtor. You also need to
30
+ provide a "creditor" and "initiator" object, which also contain bank account and contact details. Finally, you need to supply a message identifier.
28
31
 
29
- direct_debits = []
32
+ def create_sepa_direct_debit_order direct_debits, creditor, initiator, message_id
33
+ dd_list = []
30
34
 
31
- # for each direct debit you want to order ...
35
+ # for each direct debit you want to order ...
32
36
 
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
37
+ for(each direct_debit to order) do | ... |
38
+ bank_account = Sepa::DirectDebitOrder::BankAccount.new direct_debit.iban, direct_debit.bic
39
+ debtor = Sepa::DirectDebitOrder::Party.new direct_debit.name, direct_debit.addr, nil, direct_debit.postcode, direct_debit.town, direct_debit.country, direct_debit.contact, direct_debit.phone, direct_debit.email
40
+ dd_list << Sepa::DirectDebitOrder::DirectDebit.new debtor, bank_account, end_to_end_id(direct_debit), direct_debit.amount, "EUR"
41
+ end
42
+
43
+ creditor = Sepa::DirectDebitOrder::Party.new creditor.name, creditor.address, nil, creditor.postcode, creditor.town, creditor.country, creditor.contact, creditor.phone, creditor.email
38
44
 
39
- creditor = Sepa::DirectDebitOrder::Party.new creditor_name, creditor_addr, nil, creditor_postcode, creditor_town, creditor_country, creditor_contact, creditor_phone, creditor_email
45
+ creditor_account = Sepa::DirectDebitOrder::BankAccount.new creditor.iban, creditor.bic
40
46
 
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
47
+ payment = Sepa::DirectDebitOrder::CreditorPayment.new creditor, creditor_account, payment_identifier, collection_date, dd_list
43
48
 
44
- initiator = Sepa::DirectDebitOrder::Party.new initiator, initiator_addr, nil, initiator_postcode, initiator_town, initiator_country, initiator_contact, initiator_phone, initiator_email
49
+ initiator = Sepa::DirectDebitOrder::Party.new initiator.identifier, initiator.address, nil, initiator.postcode, initiator.town, initiator.country, initiator.contact, initiator.phone, initiator.email
45
50
 
46
- order = Sepa::DirectDebitOrder::Order.new message_identifier, initiator, [payment]
51
+ order = Sepa::DirectDebitOrder::Order.new message_id, initiator, [payment]
47
52
 
48
- order.to_xml
53
+ order.to_xml
54
+ end
49
55
 
50
56
  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
57
 
@@ -1,5 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ require 'sepa/payments_initiation/pain00800104/customer_direct_debit_initiation'
4
+
3
5
  class Sepa::DirectDebitOrder
4
6
 
5
7
  class Order
@@ -1,3 +1,4 @@
1
+ require "sepa/payments_initiation/account_identification_choice"
1
2
  require "sepa/payments_initiation/cash_account_type_choice"
2
3
 
3
4
  class Sepa::PaymentsInitiation::CashAccount < Sepa::Base
@@ -1,3 +1,5 @@
1
+ require "sepa/payments_initiation/cash_account"
2
+ require "sepa/payments_initiation/party_identification"
1
3
  require "sepa/payments_initiation/pain00800104/payment_identification"
2
4
  require "sepa/payments_initiation/pain00800104/payment_type_information"
3
5
  require "sepa/payments_initiation/pain00800104/direct_debit_transaction"
@@ -1,3 +1,7 @@
1
+ require 'sepa/payments_initiation/branch_and_financial_institution_identification'
2
+ require 'sepa/payments_initiation/authorisation'
3
+ require 'sepa/payments_initiation/party_identification'
4
+
1
5
  class Sepa::PaymentsInitiation::Pain00800104::GroupHeader < Sepa::Base
2
6
  definition "Set of characteristics shared by all individual transactions included in the message."
3
7
  attribute :message_identification, "MsgId"
@@ -1,3 +1,4 @@
1
+ require "sepa/payments_initiation/contact_details"
1
2
  require "sepa/payments_initiation/postal_address"
2
3
  require "sepa/payments_initiation/party_choice_identification"
3
4
 
data/lib/sepa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sepa
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
4
+ version: 0.0.3
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-07-15 00:00:00.000000000 Z
12
+ date: 2013-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder