Class: Sepa::DirectDebitOrder::DirectDebit

Inherits:
Object
  • Object
show all
Defined in:
lib/sepa/direct_debit_order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(debtor, debtor_account, end_to_end_id, amount, currency, mandate_info) ⇒ DirectDebit

Returns a new instance of DirectDebit.



249
250
251
# File 'lib/sepa/direct_debit_order.rb', line 249

def initialize debtor, , end_to_end_id, amount, currency, mandate_info
  @debtor, @debtor_account, @end_to_end_id, @amount, @currency, @mandate_info = debtor, , end_to_end_id, amount, currency, mandate_info
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



247
248
249
# File 'lib/sepa/direct_debit_order.rb', line 247

def amount
  @amount
end

#currencyObject

Returns the value of attribute currency.



247
248
249
# File 'lib/sepa/direct_debit_order.rb', line 247

def currency
  @currency
end

#debtorObject

Returns the value of attribute debtor.



247
248
249
# File 'lib/sepa/direct_debit_order.rb', line 247

def debtor
  @debtor
end

#debtor_accountObject

Returns the value of attribute debtor_account.



247
248
249
# File 'lib/sepa/direct_debit_order.rb', line 247

def 
  @debtor_account
end

#end_to_end_idObject

Returns the value of attribute end_to_end_id.



247
248
249
# File 'lib/sepa/direct_debit_order.rb', line 247

def end_to_end_id
  @end_to_end_id
end

#mandate_infoObject

Returns the value of attribute mandate_info.



247
248
249
# File 'lib/sepa/direct_debit_order.rb', line 247

def mandate_info
  @mandate_info
end

Instance Method Details

#sequence_typeObject



253
254
255
# File 'lib/sepa/direct_debit_order.rb', line 253

def sequence_type
  mandate_info.sequence_type
end

#to_properties(prefix, opts) ⇒ Object



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/sepa/direct_debit_order.rb', line 257

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
  }
  hsh = hsh.merge debtor.to_properties("#{prefix}.debtor", opts)
  hsh = hsh.merge .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