Class: Caboose::OrderTransaction

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/caboose/order_transaction.rb

Constant Summary collapse

TYPE_AUTHORIZE =
'auth'
TYPE_CAPTURE =
'capture'
TYPE_VOID =
'void'
TYPE_REFUND =
'refund'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.type_from_authnet_status(status) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'app/models/caboose/order_transaction.rb', line 28

def self.type_from_authnet_status(status)
  case status
    when 'settledSuccessfully'        then OrderTransaction::TYPE_CAPTURE
    when 'voided'                     then OrderTransaction::TYPE_VOID
    when 'declined'                   then OrderTransaction::TYPE_AUTHORIZE
    when 'authorizedPendingCapture'   then OrderTransaction::TYPE_AUTHORIZE
    when 'refundSettledSuccessfully'  then OrderTransaction::TYPE_REFUND
  end
end

Instance Method Details

#check_nil_fieldsObject



24
25
26
# File 'app/models/caboose/order_transaction.rb', line 24

def check_nil_fields
  self.amount = 0.00 if self.amount.nil?        
end