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



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

def credit(money, authorization, options = {})
  post = {}
  add_credentials(post, options)
  add_authorization(post, authorization, money)
  commit('Credit', post, false)
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

#test?Boolean

Returns:

  • (Boolean)


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

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

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



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

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