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



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

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

.authorize(order, params) ⇒ Object



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

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



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

def self.capture(order)
  response = AuthorizeNet::SIM::Transaction.new(
    Caboose::,
    Caboose::authorize_net_transaction_key,
    order.total,
    :transaction_type => 'CAPTURE_ONLY',
    :transaction_id => order.transaction_id
  )
  
  ap response
end

.form_url(order = nil) ⇒ Object



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

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



42
43
44
45
46
47
48
49
50
51
52
# File 'app/models/caboose/payment_processors/authorizenet.rb', line 42

def self.refund(order)
  response = AuthorizeNet::SIM::Transaction.new(
    Caboose::,
    Caboose::authorize_net_transaction_key,
    order.total,
    :transaction_type => 'CREDIT',
    :transaction_id => order.transaction_id
  )
  
  ap response
end

.void(order) ⇒ Object



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

def self.void(order)
  response = AuthorizeNet::SIM::Transaction.new(
    Caboose::,
    Caboose::authorize_net_transaction_key,
    order.total,
    :transaction_type => 'VOID',
    :transaction_id => order.transaction_id
  )
  
  ap response
end