Class: ActiveMerchant::Billing::NetaxeptGateway

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

Constant Summary

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 = {}) ⇒ NetaxeptGateway

Returns a new instance of NetaxeptGateway



25
26
27
28
# File 'lib/active_merchant/billing/gateways/netaxept.rb', line 25

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

Instance Method Details

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



39
40
41
42
43
44
45
46
47
# File 'lib/active_merchant/billing/gateways/netaxept.rb', line 39

def authorize(money, creditcard, options = {})
  requires!(options, :order_id)

  MultiResponse.run do |r|
    r.process{setup_transaction(money, options)}
    r.process{add_and_auth_credit_card(r.authorization, creditcard, options)}
    r.process{query_transaction(r.authorization, options)}
  end
end

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



49
50
51
52
53
54
55
# File 'lib/active_merchant/billing/gateways/netaxept.rb', line 49

def capture(money, authorization, options = {})
  post = {}
  add_credentials(post, options)
  add_authorization(post, authorization, money)
  post[:operation] = "Capture"
  commit("Netaxept/process.aspx", post)
end

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



30
31
32
33
34
35
36
37
# File 'lib/active_merchant/billing/gateways/netaxept.rb', line 30

def purchase(money, creditcard, options = {})
  requires!(options, :order_id)

  MultiResponse.run do |r|
    r.process{authorize(money, creditcard, options)}
    r.process{capture(money, r.authorization, options)}
  end
end

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



57
58
59
60
61
62
63
# File 'lib/active_merchant/billing/gateways/netaxept.rb', line 57

def refund(money, authorization, options = {})
  post = {}
  add_credentials(post, options)
  add_authorization(post, authorization, money)
  post[:operation] = "Credit"
  commit("Netaxept/process.aspx", post)
end

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



65
66
67
68
69
70
71
# File 'lib/active_merchant/billing/gateways/netaxept.rb', line 65

def void(authorization, options = {})
  post = {}
  add_credentials(post, options)
  add_authorization(post, authorization)
  post[:operation] = "Annul"
  commit("Netaxept/process.aspx", post)
end