Class: ActiveMerchant::Billing::MerchantESolutionsGateway

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

Constant Summary collapse

SUCCESS_RESPONSE_CODES =
%w(000 085)

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, #strftime_yyyymm

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ MerchantESolutionsGateway

Returns a new instance of MerchantESolutionsGateway.



23
24
25
26
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 23

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

Instance Method Details

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



28
29
30
31
32
33
34
35
36
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 28

def authorize(money, creditcard_or_card_id, options = {})
  post = {}
  add_invoice(post, options)
  add_payment_source(post, creditcard_or_card_id, options)
  add_address(post, options)
  add_3dsecure_params(post, options)
  add_stored_credentials(post, options)
  commit('P', money, post)
end

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



48
49
50
51
52
53
54
55
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 48

def capture(money, transaction_id, options = {})
  post = {}
  post[:transaction_id] = transaction_id
  post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
  add_invoice(post, options)
  add_3dsecure_params(post, options)
  commit('S', money, post)
end

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



80
81
82
83
84
85
86
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 80

def credit(money, creditcard_or_card_id, options = {})
  post = {}
  post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
  add_invoice(post, options)
  add_payment_source(post, creditcard_or_card_id, options)
  commit('C', money, post)
end

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



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

def purchase(money, creditcard_or_card_id, options = {})
  post = {}
  add_invoice(post, options)
  add_payment_source(post, creditcard_or_card_id, options)
  add_address(post, options)
  add_3dsecure_params(post, options)
  add_stored_credentials(post, options)
  commit('D', money, post)
end

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



71
72
73
74
75
76
77
78
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 71

def refund(money, identification, options = {})
  post = {}
  post[:transaction_id] = identification
  post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
  options.delete(:customer)
  options.delete(:billing_address)
  commit('U', money, options.merge(post))
end

#scrub(transcript) ⇒ Object



108
109
110
111
112
113
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 108

def scrub(transcript)
  transcript.
    gsub(%r((&?profile_key=)\w*(&?)), '\1[FILTERED]\2').
    gsub(%r((&?card_number=)\d*(&?)), '\1[FILTERED]\2').
    gsub(%r((&?cvv2=)\d*(&?)), '\1[FILTERED]\2')
end

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



57
58
59
60
61
62
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 57

def store(creditcard, options = {})
  MultiResponse.run do |r|
    r.process { temporary_store(creditcard, options) }
    r.process { verify(r.authorization, { store_card: 'y' }) }
  end
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


104
105
106
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 104

def supports_scrubbing?
  true
end

#unstore(card_id, options = {}) ⇒ Object



64
65
66
67
68
69
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 64

def unstore(card_id, options = {})
  post = {}
  post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
  post[:card_id] = card_id
  commit('X', nil, post)
end

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



97
98
99
100
101
102
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 97

def verify(credit_card, options = {})
  post = {}
  post[:store_card] = options[:store_card] if options[:store_card]
  add_payment_source(post, credit_card, options)
  commit('A', 0, post)
end

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



88
89
90
91
92
93
94
95
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 88

def void(transaction_id, options = {})
  post = {}
  post[:transaction_id] = transaction_id
  post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
  options.delete(:customer)
  options.delete(:billing_address)
  commit('V', nil, options.merge(post))
end