Sha256: 651ddd2c996cfbf833a74af96ff99c258bfa79b251de3a69202c19d98edb462b
Contents?: true
Size: 756 Bytes
Versions: 1
Compression:
Stored size: 756 Bytes
Contents
module Transactionable class Transaction < ActiveRecord::Base has_one :remote_transaction, as: :local_entity, dependent: :destroy belongs_to :transactionable, polymorphic: true has_many :transaction_logs 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 ) Transactionable::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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
transactionable-0.3.1 | app/models/transactionable/transaction.rb |