Class: Payment::AuthorizeNet

Inherits:
Base
  • Object
show all
Defined in:
lib/payment/authorize_net.rb

Constant Summary collapse

API_VERSION =

version of the gateway’s API

'3.1'

Instance Attribute Summary collapse

Attributes inherited from Base

#account_number, #action, #address, #amount, #authorization, #bank_name, #card_number, #city, #country, #customer_id, #email, #error_code, #error_message, #expiration, #fax, #invoice_number, #login, #method, #name, #password, #phone, #require_avs, #response, #result_code, #routing_code, #state, #test_transaction, #transaction_type, #type, #url, #zip

Instance Method Summary collapse

Methods inherited from Base

plain

Constructor Details

#initialize(options = {}) ⇒ AuthorizeNet

:login => ‘username’,

 :password    => 'password',
 :amount      => '49.95',
 :card_number => '4012888818888',
 :expiration  => '03/10',
 :first_name  => 'John',
 :last_name   => 'Doe'
)


30
31
32
33
34
35
36
37
38
39
# File 'lib/payment/authorize_net.rb', line 30

def initialize(options = {})
  # set some sensible defaults
  @url = 'https://secure.authorize.net/gateway/transact.dll'
  @delim_data = 'TRUE'
  @relay_response = 'FALSE'
  @version = API_VERSION
  
  # include all provided data
  super options
end

Instance Attribute Details

#avs_codeObject (readonly)

Returns the value of attribute avs_code.



13
14
15
# File 'lib/payment/authorize_net.rb', line 13

def avs_code
  @avs_code
end

#cavv_responseObject (readonly)

Returns the value of attribute cavv_response.



13
14
15
# File 'lib/payment/authorize_net.rb', line 13

def cavv_response
  @cavv_response
end

#cvv2_responseObject (readonly)

Returns the value of attribute cvv2_response.



13
14
15
# File 'lib/payment/authorize_net.rb', line 13

def cvv2_response
  @cvv2_response
end

#descriptionObject

Returns the value of attribute description.



14
15
16
# File 'lib/payment/authorize_net.rb', line 14

def description
  @description
end

#first_nameObject

Returns the value of attribute first_name.



14
15
16
# File 'lib/payment/authorize_net.rb', line 14

def first_name
  @first_name
end

#invoice_numObject

Returns the value of attribute invoice_num.



14
15
16
# File 'lib/payment/authorize_net.rb', line 14

def invoice_num
  @invoice_num
end

#last_nameObject

Returns the value of attribute last_name.



14
15
16
# File 'lib/payment/authorize_net.rb', line 14

def last_name
  @last_name
end

#md5Object (readonly)

Returns the value of attribute md5.



13
14
15
# File 'lib/payment/authorize_net.rb', line 13

def md5
  @md5
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



13
14
15
# File 'lib/payment/authorize_net.rb', line 13

def order_number
  @order_number
end

#server_responseObject (readonly)

Returns the value of attribute server_response.



13
14
15
# File 'lib/payment/authorize_net.rb', line 13

def server_response
  @server_response
end

#transaction_idObject

Returns the value of attribute transaction_id.



14
15
16
# File 'lib/payment/authorize_net.rb', line 14

def transaction_id
  @transaction_id
end

#transaction_keyObject

Returns the value of attribute transaction_key.



14
15
16
# File 'lib/payment/authorize_net.rb', line 14

def transaction_key
  @transaction_key
end

Instance Method Details

#submitObject

Submit the order to be processed. If it is not fulfilled for any reason this method will raise an exception.



43
44
45
46
47
# File 'lib/payment/authorize_net.rb', line 43

def submit
  set_post_data
   get_response @url
   parse_response
end