Class: ActiveMerchant::Billing::OppGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/opp.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

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

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ OppGateway

Returns a new instance of OppGateway.



121
122
123
124
# File 'lib/active_merchant/billing/gateways/opp.rb', line 121

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

Instance Method Details

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



132
133
134
135
# File 'lib/active_merchant/billing/gateways/opp.rb', line 132

def authorize(money, payment, options={})
  # preauthorization PA
  execute_dbpa('PA', money, payment, options)
end

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



137
138
139
140
# File 'lib/active_merchant/billing/gateways/opp.rb', line 137

def capture(money, authorization, options={})
  # capture CP
  execute_referencing('CP', money, authorization, options)
end

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



126
127
128
129
130
# File 'lib/active_merchant/billing/gateways/opp.rb', line 126

def purchase(money, payment, options={})
  # debit
  execute_dbpa(options[:risk_workflow] ? 'PA.CP': 'DB',
    money, payment, options)
end

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



142
143
144
145
# File 'lib/active_merchant/billing/gateways/opp.rb', line 142

def refund(money, authorization, options={})
  # refund RF
  execute_referencing('RF', money, authorization, options)
end

#scrub(transcript) ⇒ Object



163
164
165
166
167
168
# File 'lib/active_merchant/billing/gateways/opp.rb', line 163

def scrub(transcript)
  transcript.
    gsub(%r((authentication\.password=)\w+), '\1[FILTERED]').
    gsub(%r((card\.number=)\d+), '\1[FILTERED]').
    gsub(%r((card\.cvv=)\d+), '\1[FILTERED]')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


159
160
161
# File 'lib/active_merchant/billing/gateways/opp.rb', line 159

def supports_scrubbing?
  true
end

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



152
153
154
155
156
157
# File 'lib/active_merchant/billing/gateways/opp.rb', line 152

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

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



147
148
149
150
# File 'lib/active_merchant/billing/gateways/opp.rb', line 147

def void(authorization, options={})
  # reversal RV
  execute_referencing('RV', nil, authorization, options)
end