Class: ActiveMerchant::Billing::ElavonGateway

Inherits:
Gateway
  • Object
show all
Includes:
Empty
Defined in:
lib/active_merchant/billing/gateways/elavon.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, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #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 = {}) ⇒ ElavonGateway

Returns a new instance of ElavonGateway.



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

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

Instance Method Details

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



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 56

def authorize(money, creditcard, options = {})
  form = {}
  add_salestax(form, options)
  add_invoice(form, options)
  add_creditcard(form, creditcard)
  add_currency(form, money, options)
  add_address(form, options)
  add_customer_data(form, options)
  add_test_mode(form, options)
  add_ip(form, options)
  add_auth_purchase_params(form, options)
  add_level_3_fields(form, options) if options[:level_3_data]
  commit(:authorize, money, form, options)
end

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



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 71

def capture(money, authorization, options = {})
  form = {}
  if options[:credit_card]
    action = :capture
    add_salestax(form, options)
    add_approval_code(form, authorization)
    add_invoice(form, options)
    add_creditcard(form, options[:credit_card])
    add_currency(form, money, options)
    add_address(form, options)
    add_customer_data(form, options)
    add_test_mode(form, options)
  else
    action = :capture_complete
    add_txn_id(form, authorization)
    add_partial_shipment_flag(form, options)
    add_test_mode(form, options)
  end
  commit(action, money, form, options)
end

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

Raises:

  • (ArgumentError)


106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 106

def credit(money, creditcard, options = {})
  raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card or use the #refund method.' if creditcard.is_a?(String)

  form = {}
  add_invoice(form, options)
  add_creditcard(form, creditcard)
  add_currency(form, money, options)
  add_address(form, options)
  add_customer_data(form, options)
  add_test_mode(form, options)
  commit(:credit, money, form, options)
end

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



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 37

def purchase(money, payment_method, options = {})
  form = {}
  add_salestax(form, options)
  add_invoice(form, options)
  if payment_method.is_a?(String)
    add_token(form, payment_method)
  else
    add_creditcard(form, payment_method)
  end
  add_currency(form, money, options)
  add_address(form, options)
  add_customer_data(form, options)
  add_test_mode(form, options)
  add_ip(form, options)
  add_auth_purchase_params(form, options)
  add_level_3_fields(form, options) if options[:level_3_data]
  commit(:purchase, money, form, options)
end

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



92
93
94
95
96
97
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 92

def refund(money, identification, options = {})
  form = {}
  add_txn_id(form, identification)
  add_test_mode(form, options)
  commit(:refund, money, form, options)
end

#scrub(transcript) ⇒ Object



153
154
155
156
157
158
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 153

def scrub(transcript)
  transcript.
    gsub(%r((&?ssl_pin=)[^&]*)i, '\1[FILTERED]').
    gsub(%r((&?ssl_card_number=)[^&\\n\r\n]*)i, '\1[FILTERED]').
    gsub(%r((&?ssl_cvv2cvc2=)[^&]*)i, '\1[FILTERED]')
end

#store(creditcard, options = {}) ⇒ Object



128
129
130
131
132
133
134
135
136
137
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 128

def store(creditcard, options = {})
  form = {}
  add_creditcard(form, creditcard)
  add_address(form, options)
  add_customer_data(form, options)
  add_test_mode(form, options)
  add_verification(form, options)
  form[:add_token] = 'Y'
  commit(:store, nil, form, options)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


149
150
151
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 149

def supports_scrubbing?
  true
end

#update(token, creditcard, options = {}) ⇒ Object



139
140
141
142
143
144
145
146
147
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 139

def update(token, creditcard, options = {})
  form = {}
  add_token(form, token)
  add_creditcard(form, creditcard)
  add_address(form, options)
  add_customer_data(form, options)
  add_test_mode(form, options)
  commit(:update, nil, form, options)
end

#verify(credit_card, options = {}) ⇒ Object



119
120
121
122
123
124
125
126
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 119

def verify(credit_card, options = {})
  form = {}
  add_creditcard(form, credit_card)
  add_address(form, options)
  add_test_mode(form, options)
  add_ip(form, options)
  commit(:verify, 0, form, options)
end

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



99
100
101
102
103
104
# File 'lib/active_merchant/billing/gateways/elavon.rb', line 99

def void(identification, options = {})
  form = {}
  add_txn_id(form, identification)
  add_test_mode(form, options)
  commit(:void, nil, form, options)
end