Class: ActiveMerchant::Billing::MerchantESolutionsGateway

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

Constant Summary

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, inherited, supports?, #test?

Methods included from CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ MerchantESolutionsGateway

Returns a new instance of MerchantESolutionsGateway.



19
20
21
22
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 19

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

Instance Method Details

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



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

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)
  commit('P', money, post)
end

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



44
45
46
47
48
49
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 44

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

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



74
75
76
77
78
79
80
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 74

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



34
35
36
37
38
39
40
41
42
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 34

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)
  commit('D', money, post)
end

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



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

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

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



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

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

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



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

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



82
83
84
85
86
87
88
89
# File 'lib/active_merchant/billing/gateways/merchant_e_solutions.rb', line 82

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