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(invoice, params) ⇒ Object


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

def self.authorize(invoice, params)
  invoice.update_attribute(:transaction_id, params[:x_trans_id]) if params[:x_trans_id]
  return params[:x_response_code] == '1'
end

.capture(invoice) ⇒ Object


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

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

.form_url(invoice = nil) ⇒ Object


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

def self.form_url(invoice=nil)
  if Rails.env == 'development'
    'https://test.authorize.net/gateway/transact.dll'
  else
    'https://secure.authorize.net/gateway/transact.dll'
  end
end

.refund(invoice) ⇒ Object


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

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

.void(invoice) ⇒ Object


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

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