class Sepa::DirectDebitOrder::DirectDebit

Attributes

amount[RW]
currency[RW]
debtor[RW]
debtor_account[RW]
end_to_end_id[RW]
mandate_info[RW]
remittance_information[RW]

Public Class Methods

new(debtor, debtor_account, end_to_end_id, amount, currency, mandate_info, remittance_information = nil) click to toggle source
# File lib/sepa/direct_debit_order.rb, line 253
def initialize debtor, debtor_account, end_to_end_id, amount, currency, mandate_info, remittance_information = nil
  @debtor, @debtor_account, @end_to_end_id, @amount, @currency, @mandate_info, @remittance_information = debtor, debtor_account, end_to_end_id, amount, currency, mandate_info, remittance_information
end

Public Instance Methods

sequence_type() click to toggle source
# File lib/sepa/direct_debit_order.rb, line 257
def sequence_type
  mandate_info.sequence_type
end
to_properties(prefix, opts) click to toggle source
# File lib/sepa/direct_debit_order.rb, line 261
def to_properties prefix, opts
  hsh = {
    "#{prefix}.payment_identification.end_to_end_identification"         => end_to_end_id,
    "#{prefix}.instructed_amount"                                        => ("%.2f" % amount),
    "#{prefix}.instructed_amount_currency"                               => "EUR",
    "#{prefix}.direct_debit_transaction.mandate_related_information.mandate_identification" => mandate_info.identification,
    "#{prefix}.direct_debit_transaction.mandate_related_information.date_of_signature"      => mandate_info.signature_date,
    "#{prefix}.remittance_information.unstructured_remittance_information"                  => remittance_information
  }
  hsh = hsh.merge debtor.to_properties("#{prefix}.debtor", opts)
  hsh = hsh.merge debtor_account.to_properties("#{prefix}.debtor", opts)

  if opts[:pain_008_001_version] == "04"
    hsh["#{prefix}.payment_type_information.sequence_type"] = mandate_info.sequence_type
  end

  hsh
end