Class: ActiveMerchant::Billing::AuthorizeNetGateway
- Defined in:
- lib/active_merchant/billing/gateways/authorize_net.rb
Constant Summary collapse
- API_VERSION =
'3.1'
- LIVE_URL =
"https://secure.authorize.net/gateway/transact.dll"
- TEST_URL =
"https://test.authorize.net/gateway/transact.dll"
- CARD_CODE_ERRORS =
%w( N S )
- CARD_CODE_MESSAGES =
{ "M" => "Card verification number matched", "N" => "Card verification number didn't match", "P" => "Card verification number was not processed", "S" => "Card verification number should be on card but was not indicated", "U" => "Issuer was not certified for card verification" }
- AVS_ERRORS =
%w( A E N R W Z )
- AVS_MESSAGES =
{ "A" => "Street address matches billing information, zip/postal code does not", "B" => "Address information not provided for address verification check", "E" => "Address verification service error", "G" => "Non-U.S. card-issuing bank", "N" => "Neither street address nor zip/postal match billing information", "P" => "Address verification not applicable for this transaction", "R" => "Payment gateway was unavailable or timed out", "S" => "Address verification service not supported by issuer", "U" => "Address information is unavailable", "W" => "9-digit zip/postal code matches billing information, street address does not", "X" => "Street address and 9-digit zip/postal code matches billing information", "Y" => "Street address and 5-digit zip/postal code matches billing information", "Z" => "5-digit zip/postal code matches billing information, street address does not", }
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#url ⇒ Object
readonly
URL.
Class Method Summary collapse
-
.supported_cardtypes ⇒ Object
We support visa and master card.
Instance Method Summary collapse
- #authorize(money, creditcard, options = {}) ⇒ Object
- #capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ AuthorizeNetGateway
constructor
A new instance of AuthorizeNetGateway.
- #purchase(money, creditcard, options = {}) ⇒ Object
- #void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
Methods included from RequiresParameters
Methods included from PostsData
Constructor Details
#initialize(options = {}) ⇒ AuthorizeNetGateway
Returns a new instance of AuthorizeNetGateway.
47 48 49 50 51 |
# File 'lib/active_merchant/billing/gateways/authorize_net.rb', line 47 def initialize( = {}) requires!(, :login, :password) @options = super end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
45 46 47 |
# File 'lib/active_merchant/billing/gateways/authorize_net.rb', line 45 def @options end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
44 45 46 |
# File 'lib/active_merchant/billing/gateways/authorize_net.rb', line 44 def response @response end |
#url ⇒ Object (readonly)
URL
43 44 45 |
# File 'lib/active_merchant/billing/gateways/authorize_net.rb', line 43 def url @url end |
Class Method Details
.supported_cardtypes ⇒ Object
We support visa and master card
85 86 87 |
# File 'lib/active_merchant/billing/gateways/authorize_net.rb', line 85 def self.supported_cardtypes [:visa, :master, :american_express, :discover] end |
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/active_merchant/billing/gateways/authorize_net.rb', line 53 def (money, creditcard, = {}) post = {} add_invoice(post, ) add_creditcard(post, creditcard) add_address(post, ) add_customer_data(post, ) commit('AUTH_ONLY', money, post) end |
#capture(money, authorization, options = {}) ⇒ Object
73 74 75 76 77 |
# File 'lib/active_merchant/billing/gateways/authorize_net.rb', line 73 def capture(money, , = {}) post = {:trans_id => } add_customer_data(post, ) commit('PRIOR_AUTH_CAPTURE', money, post) end |
#purchase(money, creditcard, options = {}) ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'lib/active_merchant/billing/gateways/authorize_net.rb', line 63 def purchase(money, creditcard, = {}) post = {} add_invoice(post, ) add_creditcard(post, creditcard) add_address(post, ) add_customer_data(post, ) commit('AUTH_CAPTURE', money, post) end |
#void(authorization, options = {}) ⇒ Object
79 80 81 82 |
# File 'lib/active_merchant/billing/gateways/authorize_net.rb', line 79 def void(, = {}) post = {:trans_id => } commit('VOID', nil, post) end |