Class: ActiveMerchant::Billing::NetaxeptGateway

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

Defined Under Namespace

Classes: Response

Constant Summary collapse

TEST_URL =
'https://epayment-test.bbs.no/'
LIVE_URL =
'https://epayment.bbs.no/'

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, 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 CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ NetaxeptGateway

Returns a new instance of NetaxeptGateway.



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

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

Instance Method Details

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



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

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

  post = {}
  add_credentials(post, options)
  add_transaction(post, options)
  add_order(post, money, options)
  add_creditcard(post, creditcard)
  commit('Auth', post)
end

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



53
54
55
56
57
58
# File 'lib/active_merchant/billing/gateways/netaxept.rb', line 53

def capture(money, authorization, options = {})
  post = {}
  add_credentials(post, options)
  add_authorization(post, authorization, money)
  commit('Capture', post, false)
end

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



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

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

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



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

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

  post = {}
  add_credentials(post, options)
  add_transaction(post, options)
  add_order(post, money, options)
  add_creditcard(post, creditcard)
  commit('Sale', post)
end

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



60
61
62
63
64
65
# File 'lib/active_merchant/billing/gateways/netaxept.rb', line 60

def refund(money, authorization, options = {})
  post = {}
  add_credentials(post, options)
  add_authorization(post, authorization, money)
  commit('Credit', post, false)
end

#test?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/active_merchant/billing/gateways/netaxept.rb', line 79

def test?
  @options[:test] || Base.gateway_mode == :test
end

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



72
73
74
75
76
77
# File 'lib/active_merchant/billing/gateways/netaxept.rb', line 72

def void(authorization, options = {})
  post = {}
  add_credentials(post, options)
  add_authorization(post, authorization)
  commit('Annul', post, false)
end