Class: SEPA::DirectDebitTransaction

Inherits:
Transaction show all
Defined in:
lib/sepa_king/transaction/direct_debit_transaction.rb

Constant Summary collapse

SEQUENCE_TYPES =
%w(FRST OOFF RCUR FNAL)
LOCAL_INSTRUMENTS =
%w(CORE COR1 B2B)

Constants inherited from Transaction

Transaction::DEFAULT_REQUESTED_DATE

Instance Attribute Summary collapse

Attributes inherited from Transaction

#amount, #batch_booking, #bic, #creditor_address, #currency, #iban, #instruction, #name, #reference, #remittance_information, #requested_date

Instance Method Summary collapse

Methods included from Converter

#convert

Constructor Details

#initialize(attributes = {}) ⇒ DirectDebitTransaction

Returns a new instance of DirectDebitTransaction.



35
36
37
38
39
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 35

def initialize(attributes = {})
  super
  self.local_instrument ||= 'CORE'
  self.sequence_type ||= 'OOFF'
end

Instance Attribute Details

#creditor_accountObject

Returns the value of attribute creditor_account.



7
8
9
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 7

def 
  @creditor_account
end

#debtor_addressObject

Returns the value of attribute debtor_address.



7
8
9
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 7

def debtor_address
  @debtor_address
end

#local_instrumentObject

Returns the value of attribute local_instrument.



7
8
9
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 7

def local_instrument
  @local_instrument
end

#mandate_date_of_signatureObject

Returns the value of attribute mandate_date_of_signature.



7
8
9
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 7

def mandate_date_of_signature
  @mandate_date_of_signature
end

#mandate_idObject

Returns the value of attribute mandate_id.



7
8
9
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 7

def mandate_id
  @mandate_id
end

#original_creditor_accountObject

Returns the value of attribute original_creditor_account.



7
8
9
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 7

def 
  @original_creditor_account
end

#original_debtor_accountObject

Returns the value of attribute original_debtor_account.



7
8
9
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 7

def 
  @original_debtor_account
end

#same_mandate_new_debtor_agentObject

Returns the value of attribute same_mandate_new_debtor_agent.



7
8
9
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 7

def same_mandate_new_debtor_agent
  @same_mandate_new_debtor_agent
end

#sequence_typeObject

Returns the value of attribute sequence_type.



7
8
9
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 7

def sequence_type
  @sequence_type
end

Instance Method Details

#amendment_informations?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 41

def amendment_informations?
   || same_mandate_new_debtor_agent || 
end

#schema_compatible?(schema_name) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
48
49
50
51
52
53
54
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 45

def schema_compatible?(schema_name)
  case schema_name
  when PAIN_008_002_02
    self.bic.present? && %w(CORE B2B).include?(self.local_instrument) && self.currency == 'EUR'
  when PAIN_008_003_02
    self.currency == 'EUR'
  when PAIN_008_001_02
    true
  end
end