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::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #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.



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

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

Instance Method Details

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



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

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

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



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

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

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



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

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

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



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

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

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



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

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

#scrub(transcript) ⇒ Object



67
68
69
70
71
72
# File 'lib/active_merchant/billing/gateways/secure_net.rb', line 67

def scrub(transcript)
  transcript.
    gsub(%r((<CARDNUMBER>)\d+(</CARDNUMBER>))i, '\1[FILTERED]\2').
    gsub(%r((<CARDCODE>)\d+(</CARDCODE>))i, '\1[FILTERED]\2').
    gsub(%r((<SECUREKEY>).+(</SECUREKEY>))i, '\1[FILTERED]\2')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/active_merchant/billing/gateways/secure_net.rb', line 63

def supports_scrubbing?
  true
end

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



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

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