Class: ActiveMerchant::Billing::EfsnetGateway

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

Constant Summary

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, 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, #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 = {}) ⇒ EfsnetGateway

login is your Store ID password is your Store Key



17
18
19
20
# File 'lib/active_merchant/billing/gateways/efsnet.rb', line 17

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

Instance Method Details

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



22
23
24
25
# File 'lib/active_merchant/billing/gateways/efsnet.rb', line 22

def authorize(money, creditcard, options = {})
  request = build_credit_card_request(money, creditcard, options)
  commit(:credit_card_authorize, request)
end

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



32
33
34
35
# File 'lib/active_merchant/billing/gateways/efsnet.rb', line 32

def capture(money, identification, options = {})
  request = build_refund_or_settle_request(money, identification, options)
  commit(:credit_card_settle, request)
end

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



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

def credit(money, identification_or_credit_card, options = {})
  if identification_or_credit_card.is_a?(String)
    ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
    # Perform authorization reversal
    refund(money, identification_or_credit_card, options)
  else
    # Perform credit
    request = build_credit_card_request(money, identification_or_credit_card, options)
    commit(:credit_card_credit, request)
  end
end

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



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

def force(money, authorization_code, creditcard, options = {})
  options[:authorization_number] = authorization_code
  request = build_credit_card_request(money, creditcard, options)
  commit(:credit_card_capture, request)
end

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



27
28
29
30
# File 'lib/active_merchant/billing/gateways/efsnet.rb', line 27

def purchase(money, creditcard, options = {})
  request = build_credit_card_request(money, creditcard, options)
  commit(:credit_card_charge, request)
end

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



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

def refund(money, reference, options = {})
  # Perform authorization reversal
  request = build_refund_or_settle_request(money, reference, options)
  commit(:credit_card_refund, request)
end

#system_checkObject



73
74
75
# File 'lib/active_merchant/billing/gateways/efsnet.rb', line 73

def system_check
  commit(:system_check, {})
end

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



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

def voice_authorize(money, authorization_code, creditcard, options = {})
  options[:authorization_number] = authorization_code
  request = build_credit_card_request(money, creditcard, options)
  commit(:credit_card_voice_authorize, request)
end

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



55
56
57
58
59
# File 'lib/active_merchant/billing/gateways/efsnet.rb', line 55

def void(identification, options = {})
  requires!(options, :order_id)
  original_transaction_id, _ = identification.split(";")
  commit(:void_transaction, {:reference_number => format_reference_number(options[:order_id]), :transaction_id => original_transaction_id})
end