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

#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

#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



135
136
137
138
# File 'lib/active_merchant/billing/gateways/opp.rb', line 135

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

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



140
141
142
143
# File 'lib/active_merchant/billing/gateways/opp.rb', line 140

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

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



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

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

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



145
146
147
148
# File 'lib/active_merchant/billing/gateways/opp.rb', line 145

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

#scrub(transcript) ⇒ Object



170
171
172
173
174
175
# File 'lib/active_merchant/billing/gateways/opp.rb', line 170

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

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



162
163
164
# File 'lib/active_merchant/billing/gateways/opp.rb', line 162

def store(credit_card, options = {})
  execute_store(credit_card, options.merge(store: true))
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


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

def supports_scrubbing?
  true
end

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



155
156
157
158
159
160
# File 'lib/active_merchant/billing/gateways/opp.rb', line 155

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



150
151
152
153
# File 'lib/active_merchant/billing/gateways/opp.rb', line 150

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