Sha256: e0ecfad50bf90c022e7eb5ea212b1531348812ef7259b5d0532600bc4f6196eb

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

# encoding: utf-8
module SEPA
  class CreditTransferTransaction < Transaction
    attr_accessor :service_level

    validates_inclusion_of :service_level, :in => %w(SEPA URGP)

    validate do |t|
      if t.requested_date.is_a?(Date)
        errors.add(:requested_date, 'is in the past') if t.requested_date < Date.today
      end
    end

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

    def schema_compatible?(schema_name)
      case schema_name
      when PAIN_001_002_03
        self.bic.present? && self.service_level == 'SEPA'
      when PAIN_001_003_03
        true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sepa_king-0.2.0 lib/sepa_king/transaction/credit_transfer_transaction.rb