Sha256: bc10e8f6425799bd14586ef112c156a7ebb00a4ac79011e65d4e003ef8af567a
Contents?: true
Size: 764 Bytes
Versions: 2
Compression:
Stored size: 764 Bytes
Contents
module Transactionable class Transaction < ActiveRecord::Base has_one :remote_transaction, as: :local_entity, dependent: :destroy belongs_to :transactionable, polymorphic: true belongs_to :transaction_loggable, polymorphic: true TRANSACTION_TYPES = [:hold, :credit, :debit, :refund, :reversal] def self.create_from_remote(remote_trans) transaction = create( amount: remote_trans.amount/100.0, status: remote_trans.status, description: remote_trans.description ) RemoteTransaction.create(local_entity: transaction, uri: remote_trans.uri) transaction end def remote if remote_transaction && remote_transaction.synced? remote_transaction.fetch end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
transactionable-0.2.0 | app/models/transactionable/transaction.rb |
transactionable-0.1.0 | app/models/transactionable/transaction.rb |