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::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

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?, #supports_network_tokenization?, #test?

Methods included from CreditCardFormatting

#format

Methods included from PostsData

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

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, payment_method, 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, payment_method, options={})
  post = initialize_required_fields("Auth")

  add_invoice(post, amount, options)
  add_payment_method(post, payment_method)
  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 = initialize_required_fields("Force")

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

  commit(post)
end

#purchase(amount, payment_method, 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, payment_method, options={})
  post = initialize_required_fields("Sale")

  # Allow the same amount in multiple transactions.
  post[:ExtData] = "<Force>T</Force>"
  add_invoice(post, amount, options)
  add_payment_method(post, payment_method)
  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 = initialize_required_fields("Return")

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

  commit(post)
end

#scrub(transcript) ⇒ Object



93
94
95
96
97
98
99
100
# File 'lib/active_merchant/billing/gateways/bridge_pay.rb', line 93

def scrub(transcript)
  transcript.
    gsub(%r((&?CardNum=)[^&]*)i, '\1[FILTERED]').
    gsub(%r((&?CVNum=)[^&]*)i, '\1[FILTERED]').
    gsub(%r((&?Password=)[^&]*)i, '\1[FILTERED]').
    gsub(%r((&?TransitNum=)[^&]*)i, '\1[FILTERED]').
    gsub(%r((&?AccountNum=)[^&]*)i, '\1[FILTERED]')
end

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



78
79
80
81
82
83
84
85
86
87
# File 'lib/active_merchant/billing/gateways/bridge_pay.rb', line 78

def store(creditcard, options={})
  post = initialize_required_fields('')
  post[:transaction] = 'Create'
  post[:CardNumber]    = creditcard.number
  post[:CustomerPaymentInfoKey] = ''
  post[:token] = ''
  add_payment_method(post, creditcard)

  commit(post)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/active_merchant/billing/gateways/bridge_pay.rb', line 89

def supports_scrubbing?
  true
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 = initialize_required_fields("Void")

  add_reference(post, authorization)

  commit(post)
end