Class: ActiveMerchant::Billing::MercuryGateway

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

Constant Summary collapse

URLS =
{
  :test => 'https://w1.mercurydev.net/ws/ws.asmx',
  :live => 'https://w1.mercurypay.com/ws/ws.asmx'
}

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 = {}) ⇒ MercuryGateway

Returns a new instance of MercuryGateway.



15
16
17
18
# File 'lib/active_merchant/billing/gateways/mercury.rb', line 15

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

Instance Method Details

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



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

def authorize(money, credit_card, options = {})
  requires!(options, :order_id)

  options[:authorized] ||= money
  request = build_non_authorized_request('PreAuth', money, credit_card, options)
  commit('PreAuth', request)
end

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



42
43
44
45
46
47
# File 'lib/active_merchant/billing/gateways/mercury.rb', line 42

def capture(money, authorization, options = {})
  requires!(options, :credit_card)
  options[:authorized] ||= money
  request = build_authorized_request('PreAuthCapture', money, authorization, options[:credit_card], options)
  commit('PreAuthCapture', request)
end

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



27
28
29
30
31
32
# File 'lib/active_merchant/billing/gateways/mercury.rb', line 27

def credit(money, credit_card, options = {})
  requires!(options, :order_id)

  request = build_non_authorized_request('Return', money, credit_card, options)
  commit('Return', request)
end

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



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

def purchase(money, credit_card, options = {})
  requires!(options, :order_id)

  request = build_non_authorized_request('Sale', money, credit_card, options)
  commit('Sale', request)
end

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



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

def refund(money, authorization, options = {})
  requires!(options, :credit_card)

  request = build_authorized_request('VoidSale', money, authorization, options[:credit_card], options)
  commit(options[:void], request)
end