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, #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.



28
29
30
31
32
# File 'lib/sepa_king/transaction/direct_debit_transaction.rb', line 28

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

#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_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

#schema_compatible?(schema_name) ⇒ Boolean

Returns:

  • (Boolean)


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

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