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, #strftime_yyyymm

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.



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

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

Instance Method Details

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



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

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

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



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

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

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



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

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

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



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

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

#scrub(transcript) ⇒ Object



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

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

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



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

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

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


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

def supports_scrubbing?
  true
end

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



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

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



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

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