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.


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


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


125
126
127
128
129
130
# 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


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


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

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


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

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

#supports_scrubbing?Boolean

Returns:

  • (Boolean)

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

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