Class: ActiveMerchant::Billing::MerchantESolutionsGateway

Inherits:
Gateway
  • Object
show all
Includes:
Empty
Defined in:
lib/active_merchant/billing/gateways/merchant_e_solutions.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 = {}) ⇒ MerchantESolutionsGateway

Returns a new instance of MerchantESolutionsGateway.



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

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

Instance Method Details

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



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

def authorize(money, creditcard_or_card_id, options = {})
  post = {}
  post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
  post[:moto_ecommerce_ind] = options[:moto_ecommerce_ind] if options.has_key?(:moto_ecommerce_ind)
  add_invoice(post, options)
  add_payment_source(post, creditcard_or_card_id, options)
  add_address(post, options)
  add_3dsecure_params(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



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

def purchase(money, creditcard_or_card_id, options = {})
  post = {}
  post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
  post[:moto_ecommerce_ind] = options[:moto_ecommerce_ind] if options.has_key?(:moto_ecommerce_ind)
  add_invoice(post, options)
  add_payment_source(post, creditcard_or_card_id, options)
  add_address(post, options)
  add_3dsecure_params(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



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

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 = {})
  post = {}
  post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
  add_creditcard(post, creditcard, options)
  commit('T', nil, post)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


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

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

#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