Class: SEPA::CreditTransferTransaction

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

Constant Summary

Constants inherited from Transaction

Transaction::DEFAULT_REQUESTED_DATE

Instance Attribute Summary collapse

Attributes inherited from Transaction

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

Instance Method Summary collapse

Methods included from Converter

#convert

Constructor Details

#initialize(attributes = {}) ⇒ CreditTransferTransaction

Returns a new instance of CreditTransferTransaction.



13
14
15
16
# File 'lib/sepa_king/transaction/credit_transfer_transaction.rb', line 13

def initialize(attributes = {})
  super
  self.service_level ||= 'SEPA' if self.currency == 'EUR'
end

Instance Attribute Details

#category_purposeObject

Returns the value of attribute category_purpose.



4
5
6
# File 'lib/sepa_king/transaction/credit_transfer_transaction.rb', line 4

def category_purpose
  @category_purpose
end

#creditor_addressObject

Returns the value of attribute creditor_address.



4
5
6
# File 'lib/sepa_king/transaction/credit_transfer_transaction.rb', line 4

def creditor_address
  @creditor_address
end

#service_levelObject

Returns the value of attribute service_level.



4
5
6
# File 'lib/sepa_king/transaction/credit_transfer_transaction.rb', line 4

def service_level
  @service_level
end

Instance Method Details

#schema_compatible?(schema_name) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/sepa_king/transaction/credit_transfer_transaction.rb', line 18

def schema_compatible?(schema_name)
  case schema_name
  when PAIN_001_001_03
    !self.service_level || (self.service_level == 'SEPA' && self.currency == 'EUR')
  when PAIN_001_002_03
    self.bic.present? && self.service_level == 'SEPA' && self.currency == 'EUR'
  when PAIN_001_003_03
    self.currency == 'EUR'
  when PAIN_001_001_03_CH_02
    self.currency == 'CHF'
  end
end