Class: MerbMerchant::Billing::EfsnetGateway

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

Constant Summary collapse

TEST_URL =
'https://testefsnet.concordebiz.com/efsnet.dll'
LIVE_URL =
'https://efsnet.concordebiz.com/efsnet.dll'

Constants inherited from Gateway

Gateway::DEBIT_CARDS

Constants included from PostsData

PostsData::MAX_RETRIES, PostsData::OPEN_TIMEOUT, PostsData::READ_TIMEOUT

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, #ssl_get, #ssl_post

Constructor Details

#initialize(options = {}) ⇒ EfsnetGateway

login is your Store ID password is your Store Key



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

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

Instance Method Details

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



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

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

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



37
38
39
40
# File 'lib/merb_merchant/billing/gateways/efsnet.rb', line 37

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



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

def credit(money, identification_or_credit_card, options = {})
  if identification_or_credit_card.is_a?(String)
    # Perform authorization reversal
    request = build_refund_or_settle_request(money, identification_or_credit_card, options)
    commit(:credit_card_refund, request)
  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



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

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



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

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

#system_checkObject



72
73
74
# File 'lib/merb_merchant/billing/gateways/efsnet.rb', line 72

def system_check
  commit(:system_check, {})      
end

#test?Boolean

Returns:

  • (Boolean)


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

def test?
  @options[:test] || super
end

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



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

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



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

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