Sha256: 6388ba8c7378ec4c0500425bd120efb94882bb233063fbc28acc16bf02fd61c6

Contents?: true

Size: 621 Bytes

Versions: 4

Compression:

Stored size: 621 Bytes

Contents

module Comable
  class Payment < ActiveRecord::Base
    validates :name, presence: true
    validates :payment_method_type, presence: true
    validates :payment_method_kind, presence: true

    def payment_method
      return unless Object.const_defined?(payment_method_type)
      Object.const_get(payment_method_type)
    end

    def payment_method_name
      payment_method.display_name
    end

    def payment_method_kind_key
      payment_method.kind.keys.slice(payment_method_kind)
    end

    def payment_method_kind_name
      payment_method.kind.slice(payment_method_kind_key).values.first
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
comable_core-0.2.3 app/models/comable/payment.rb
comable_core-0.2.2 app/models/comable/payment.rb
comable_core-0.2.1 app/models/comable/payment.rb
comable_core-0.2.0 app/models/comable/payment.rb