Class: Sepa::DirectDebitOrder::BankAccount

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(iban, swift) ⇒ BankAccount

Returns a new instance of BankAccount.



232
233
234
# File 'lib/sepa/direct_debit_order.rb', line 232

def initialize iban, swift
  @iban, @swift = iban, swift
end

Instance Attribute Details

#ibanObject

Returns the value of attribute iban.



230
231
232
# File 'lib/sepa/direct_debit_order.rb', line 230

def iban
  @iban
end

#swiftObject

Returns the value of attribute swift.



230
231
232
# File 'lib/sepa/direct_debit_order.rb', line 230

def swift
  @swift
end

Instance Method Details

#to_properties(prefix, opts) ⇒ Object



236
237
238
239
240
241
242
243
244
245
246
# File 'lib/sepa/direct_debit_order.rb', line 236

def to_properties prefix, opts
  bic_tag = ( opts[:pain_008_001_version] == "04" ? "bic_fi" : "bic" )

  if swift.nil?
    { "#{prefix}_account.identification.iban"                                     => iban.gsub(/\s/, ''),
      "#{prefix}_agent.financial_institution_identification.other.identification" => "NOTPROVIDED" }
  else
    { "#{prefix}_account.identification.iban"                           => iban.gsub(/\s/, ''),
      "#{prefix}_agent.financial_institution_identification.#{bic_tag}" => swift }
  end
end