Class: Sepa::DirectDebitOrder::Order
- Inherits:
-
Object
- Object
- Sepa::DirectDebitOrder::Order
- Defined in:
- lib/sepa/direct_debit_order.rb
Instance Attribute Summary collapse
-
#creditor_payments ⇒ Object
Returns the value of attribute creditor_payments.
-
#initiating_party ⇒ Object
Returns the value of attribute initiating_party.
-
#message_id ⇒ Object
Returns the value of attribute message_id.
Instance Method Summary collapse
-
#initialize(message_id, initiating_party, creditor_payments) ⇒ Order
constructor
A new instance of Order.
- #to_properties ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(message_id, initiating_party, creditor_payments) ⇒ Order
Returns a new instance of Order.
10 11 12 |
# File 'lib/sepa/direct_debit_order.rb', line 10 def initialize , initiating_party, creditor_payments @message_id, @initiating_party, @creditor_payments = , initiating_party, creditor_payments end |
Instance Attribute Details
#creditor_payments ⇒ Object
Returns the value of attribute creditor_payments.
8 9 10 |
# File 'lib/sepa/direct_debit_order.rb', line 8 def creditor_payments @creditor_payments end |
#initiating_party ⇒ Object
Returns the value of attribute initiating_party.
8 9 10 |
# File 'lib/sepa/direct_debit_order.rb', line 8 def initiating_party @initiating_party end |
#message_id ⇒ Object
Returns the value of attribute message_id.
8 9 10 |
# File 'lib/sepa/direct_debit_order.rb', line 8 def @message_id end |
Instance Method Details
#to_properties ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sepa/direct_debit_order.rb', line 14 def to_properties hsh = { "group_header.message_identification" => , "group_header.creation_date_time" => Time.now, "group_header.number_of_transactions" => creditor_payments.inject(0) { |sum, cp| sum + cp.number_of_transactions }, } hsh = hsh.merge initiating_party.to_properties("group_header.initiating_party") creditor_payments.each_with_index { |cp, i| hsh = hsh.merge(cp.to_properties("payment_information[#{i}]")) } hsh end |
#to_xml ⇒ Object
30 31 32 |
# File 'lib/sepa/direct_debit_order.rb', line 30 def to_xml Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation.new(to_properties).generate_xml end |