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::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

#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.



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

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

Instance Method Details

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



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

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



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

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



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

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



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

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



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

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



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

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)


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

def supports_scrubbing?
  true
end

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



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

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



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

def void(authorization, options={})
  post = initialize_required_fields('Void')

  add_reference(post, authorization)

  commit(post)
end