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::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#add_field_to_post_if_present, #add_fields_to_post_if_present, 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



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

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

Instance Method Details

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



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

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

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



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

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



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

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



66
67
68
69
70
# File 'lib/active_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



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

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

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



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

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



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

def system_check
  commit(:system_check, {})
end

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



60
61
62
63
64
# File 'lib/active_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/active_merchant/billing/gateways/efsnet.rb', line 54

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