Class: ActiveMerchant::Billing::ExactGateway

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

Constant Summary collapse

URL =
'https://secure2.e-xact.com/vplug-in/transaction/rpc-enc/service.asmx'
API_VERSION =
"8.5"
TEST_LOGINS =
[ {:login => "A00049-01", :password => "test1"},
{:login => "A00427-01", :password => "testus"} ]
TRANSACTIONS =
{ :sale          => "00",
:authorization => "01",
:capture       => "32",
:credit        => "34" }
ENVELOPE_NAMESPACES =
{ 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
  'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/',
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
}
SEND_AND_COMMIT_ATTRIBUTES =
{ 'xmlns:n1' => "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Request",
  'env:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/'
}
SEND_AND_COMMIT_SOURCE_ATTRIBUTES =
{ 'xmlns:n2' => 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes',
  'xsi:type' => 'n2:Transaction'
}
POST_HEADERS =
{ 'soapAction' => "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/SendAndCommit",
  'Content-Type' => 'text/xml' 
}
SUCCESS =
"true"
SENSITIVE_FIELDS =
[ :verification_str2, :expiry_date, :card_number ]

Constants inherited from Gateway

Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, inherited, supports?

Methods included from Utils

generate_unique_id

Methods included from CreditCardFormatting

#format

Methods included from RequiresParameters

#requires!

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ ExactGateway

Returns a new instance of ExactGateway.



43
44
45
46
47
48
49
50
51
52
# File 'lib/active_merchant/billing/gateways/exact.rb', line 43

def initialize(options = {})
  requires!(options, :login, :password)
  @options = options
  
  if TEST_LOGINS.include?( { :login => options[:login], :password => options[:password] } )
    @test_mode = true
  end

  super
end

Instance Method Details

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



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

def authorize(money, credit_card, options = {})
  commit(:authorization, build_sale_or_authorization_request(money, credit_card, options))
end

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



66
67
68
# File 'lib/active_merchant/billing/gateways/exact.rb', line 66

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

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



70
71
72
# File 'lib/active_merchant/billing/gateways/exact.rb', line 70

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

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



62
63
64
# File 'lib/active_merchant/billing/gateways/exact.rb', line 62

def purchase(money, credit_card, options = {})
  commit(:sale, build_sale_or_authorization_request(money, credit_card, options))
end

#test?Boolean

Returns:

  • (Boolean)


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

def test?
  @test_mode || Base.gateway_mode == :test
end