mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
20 lines
473 B
Ruby
20 lines
473 B
Ruby
# frozen_string_literal: true
|
|
|
|
# track of all transactions payed using the given wallet
|
|
class WalletTransaction < ActiveRecord::Base
|
|
include AmountConcern
|
|
|
|
belongs_to :invoicing_profile
|
|
belongs_to :wallet
|
|
belongs_to :reservation
|
|
belongs_to :transactable, polymorphic: true
|
|
has_one :invoice
|
|
|
|
validates_inclusion_of :transaction_type, in: %w[credit debit]
|
|
validates :invoicing_profile, :wallet, presence: true
|
|
|
|
def user
|
|
invoicing_profile.user
|
|
end
|
|
end
|