Class: Caboose::PaymentProcessors::Authorizenet

Inherits:
Base
  • Object
show all
Defined in:
app/models/caboose/payment_processors/authorizenet.rb

Class Method Summary collapse

Class Method Details

.api(root, body, test = false) ⇒ Object



3
4
# File 'app/models/caboose/payment_processors/authorizenet.rb', line 3

def self.api(root, body, test=false)
end

.authorize(order, params) ⇒ Object



14
15
16
17
# File 'app/models/caboose/payment_processors/authorizenet.rb', line 14

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

.capture(order) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'app/models/caboose/payment_processors/authorizenet.rb', line 29

def self.capture(order)
  sc = order.site.store_config
  response = AuthorizeNet::SIM::Transaction.new(
    sc.pp_username, sc.pp_password, order.total,
    :transaction_type => 'CAPTURE_ONLY',
    :transaction_id => order.transaction_id
  )    
  #ap response
end

.form_url(order = nil) ⇒ Object



6
7
8
9
10
11
12
# File 'app/models/caboose/payment_processors/authorizenet.rb', line 6

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

.refund(order) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'app/models/caboose/payment_processors/authorizenet.rb', line 39

def self.refund(order)
  sc = order.site.store_config
  response = AuthorizeNet::SIM::Transaction.new(
    sc.pp_username, sc.pp_password, order.total,
    :transaction_type => 'CREDIT',
    :transaction_id => order.transaction_id
  )    
  #ap response
end

.void(order) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'app/models/caboose/payment_processors/authorizenet.rb', line 19

def self.void(order)
  sc = order.site.store_config
  response = AuthorizeNet::SIM::Transaction.new(
    sc.pp_username, sc.pp_password, order.total,
    :transaction_type => 'VOID',
    :transaction_id => order.transaction_id
  )    
  #ap response
end