Sha256: ed10ecfdc8b412187004712f50d045a50c13f017d21471d018df1f8b262a380f

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 KB

Contents

class CabooseStore::PaymentProcessors::Authorizenet < CabooseStore::PaymentProcessors::Base
  def self.api(root, body, test=false)
  end
  
  def self.form_url(order=nil)
    #if Rails.env == 'development'
    'https://test.authorize.net/gateway/transact.dll'
    #else
    #  'https://secure.authorize.net/gateway/transact.dll'
    #end
  end
  
  def self.authorize(order, params)
    order.update_attribute(:transaction_id, params[:x_trans_id]) if params[:x_trans_id]
    return params[:x_response_code] == '1'
  end
  
  def self.void(order)
    response = AuthorizeNet::SIM::Transaction.new(
      CabooseStore::authorize_net_login_id,
      CabooseStore::authorize_net_transaction_key,
      order.total,
      :transaction_type => 'VOID',
      :transaction_id => order.transaction_id
    )
    
    ap response
  end
  
  def self.capture(order)
    response = AuthorizeNet::SIM::Transaction.new(
      CabooseStore::authorize_net_login_id,
      CabooseStore::authorize_net_transaction_key,
      order.total,
      :transaction_type => 'CAPTURE_ONLY',
      :transaction_id => order.transaction_id
    )
    
    ap response
  end
  
  def self.refund(order)
    response = AuthorizeNet::SIM::Transaction.new(
      CabooseStore::authorize_net_login_id,
      CabooseStore::authorize_net_transaction_key,
      order.total,
      :transaction_type => 'CREDIT',
      :transaction_id => order.transaction_id
    )
    
    ap response
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
caboose-store-0.0.43 app/models/caboose_store/payment_processors/authorizenet.rb
caboose-store-0.0.42 app/models/caboose_store/payment_processors/authorizenet.rb
caboose-store-0.0.41 app/models/caboose_store/payment_processors/authorizenet.rb
caboose-store-0.0.40 app/models/caboose_store/payment_processors/authorizenet.rb