Sha256: 3fc6632b27984823cc962e14ae85227af9bdb2afd2a500fdfee6f99bcba45c77
Contents?: true
Size: 1008 Bytes
Versions: 2
Compression:
Stored size: 1008 Bytes
Contents
# encoding: utf-8 module SEPA class Transaction include ActiveModel::Validations extend Converter attr_accessor :name, :iban, :bic, :amount, :reference, :remittance_information, :requested_date, :batch_booking convert :name, :reference, :remittance_information, to: :text convert :amount, to: :decimal validates_length_of :name, within: 1..70 validates_length_of :reference, within: 1..35, allow_nil: true validates_length_of :remittance_information, within: 1..140, allow_nil: true validates_numericality_of :amount, greater_than: 0 validates_presence_of :requested_date validates_inclusion_of :batch_booking, :in => [true, false] validates_with BICValidator, IBANValidator def initialize(attributes = {}) attributes.each do |name, value| send("#{name}=", value) end self.requested_date ||= Date.today.next self.reference ||= 'NOTPROVIDED' self.batch_booking = true if self.batch_booking.nil? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sepa_king-0.3.0 | lib/sepa_king/transaction.rb |
sepa_king-0.2.0 | lib/sepa_king/transaction.rb |