Class: ActiveMerchant::Billing::SecureNetGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/secure_net.rb

Constant Summary collapse

API_VERSION =
"4.0"
TRANSACTIONS =
{
  :auth_only                      => "0000",
  :auth_capture                   => "0100",
  :prior_auth_capture             => "0200",
  :void                           => "0400",
  :credit                         => "0500"
}
XML_ATTRIBUTES =
{
 'xmlns' => "http://gateway.securenet.com/API/Contracts",
 'xmlns:i' => "http://www.w3.org/2001/XMLSchema-instance"
}
NIL_ATTRIBUTE =
{ 'i:nil' => "true" }
CARD_CODE_ERRORS =
%w( N S )
AVS_ERRORS =
%w( A E N R W Z )

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ SecureNetGateway

Returns a new instance of SecureNetGateway.



34
35
36
37
# File 'lib/active_merchant/billing/gateways/secure_net.rb', line 34

def initialize(options = {})
  requires!(options, :login, :password)
  super
end

Instance Method Details

#authorize(money, creditcard, options = {}) ⇒ Object



39
40
41
# File 'lib/active_merchant/billing/gateways/secure_net.rb', line 39

def authorize(money, creditcard, options = {})
  commit(build_sale_or_authorization(creditcard, options, :auth_only, money))
end

#capture(money, authorization, options = {}) ⇒ Object



47
48
49
# File 'lib/active_merchant/billing/gateways/secure_net.rb', line 47

def capture(money, authorization, options = {})
  commit(build_capture_refund_void(authorization, options, :prior_auth_capture, money))
end

#credit(money, authorization, options = {}) ⇒ Object



59
60
61
62
# File 'lib/active_merchant/billing/gateways/secure_net.rb', line 59

def credit(money, authorization, options = {})
  ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
  refund(money, authorization, options)
end

#purchase(money, creditcard, options = {}) ⇒ Object



43
44
45
# File 'lib/active_merchant/billing/gateways/secure_net.rb', line 43

def purchase(money, creditcard, options = {})
  commit(build_sale_or_authorization(creditcard, options, :auth_capture, money))
end

#refund(money, authorization, options = {}) ⇒ Object



55
56
57
# File 'lib/active_merchant/billing/gateways/secure_net.rb', line 55

def refund(money, authorization, options = {})
  commit(build_capture_refund_void(authorization, options, :credit, money))
end

#void(authorization, options = {}) ⇒ Object



51
52
53
# File 'lib/active_merchant/billing/gateways/secure_net.rb', line 51

def void(authorization, options = {})
  commit(build_capture_refund_void(authorization, options, :void))
end