Class: ActiveMerchant::Billing::BridgePayGateway

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

Constant Summary

Constants inherited from Gateway

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

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, supported_countries, #supported_countries, supported_countries=, supports?, #test?

Methods included from CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ BridgePayGateway

Returns a new instance of BridgePayGateway.



17
18
19
20
# File 'lib/active_merchant/billing/gateways/bridge_pay.rb', line 17

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

Instance Method Details

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



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

def authorize(amount, creditcard, options={})
  post = post_required_fields("Auth")

  add_invoice(post, amount, options)
  add_creditcard(post, creditcard)
  add_customer_data(post, options)

  commit(post)
end

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



44
45
46
47
48
49
50
51
52
# File 'lib/active_merchant/billing/gateways/bridge_pay.rb', line 44

def capture(amount, authorization, options={})
  post = post_required_fields("Force")

  add_invoice(post, amount, options)
  add_reference(post, authorization)
  add_customer_data(post, options)

  commit(post)
end

#purchase(amount, creditcard, options = {}) ⇒ Object



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

def purchase(amount, creditcard, options={})
  post = post_required_fields("Sale")

  # Allow the same amount in multiple transactions.
  post[:ExtData] = "<Force>T</Force>"
  add_invoice(post, amount, options)
  add_creditcard(post, creditcard)
  add_customer_data(post, options)

  commit(post)
end

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



54
55
56
57
58
59
60
61
# File 'lib/active_merchant/billing/gateways/bridge_pay.rb', line 54

def refund(amount, authorization, options={})
  post = post_required_fields("Return")

  add_invoice(post, amount, options)
  add_reference(post, authorization)

  commit(post)
end

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



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

def verify(creditcard, options = {})
  MultiResponse.run(:use_first_response) do |r|
    r.process { authorize(100, creditcard, options) }
    r.process(:ignore_result) { void(r.authorization, options) }
  end
end

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



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

def void(authorization, options={})
  post = post_required_fields("Void")

  add_reference(post, authorization)

  commit(post)
end