Sha256: b2f3f0540e6fa51814a49dd9a4625b660a4d1b4a4310b6cebd1296afe86f12a7

Contents?: true

Size: 529 Bytes

Versions: 3

Compression:

Stored size: 529 Bytes

Contents

module Billing
  class Origin < ActiveRecord::Base
    has_many :accounts, inverse_of: :origin
    has_many :charges, inverse_of: :origin
    has_many :payments, through: :accounts
    if defined? Extface
      belongs_to :fiscal_device, ->(o) { where( extfaceable_id: o.master_id ) }, class_name: 'Extface::Device'
    end

    validates_presence_of :name
    validates :payment_model, inclusion: { in: Payment::PAYMENT_MODELS }
    
    def external_payment?
      payment_model != Payment::PAYMENT_WITH_TYPE
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
billing-0.0.4b app/models/billing/origin.rb
billing-0.0.4a app/models/billing/origin.rb
billing-0.0.4 app/models/billing/origin.rb