Class: ActiveMerchant::Billing::OptimalPaymentGateway

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

#fetch_version, included

Methods included from CreditCardFormatting

#expdate, #format, #strftime_yyyymm, #strftime_yyyymmdd_last_day

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ OptimalPaymentGateway

Returns a new instance of OptimalPaymentGateway.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 23

def initialize(options = {})
  if options[:login]
    ActiveMerchant.deprecated("The 'login' option is deprecated in favor of 'store_id' and will be removed in a future version.")
    options[:store_id] = options[:login]
  end

  if options[:account]
    ActiveMerchant.deprecated("The 'account' option is deprecated in favor of 'account_number' and will be removed in a future version.")
    options[:account_number] = options[:account]
  end

  requires!(options, :account_number, :store_id, :password)
  super
end

Instance Method Details

#authorize(money, card_or_auth, options = {}) ⇒ Object Also known as: stored_authorize



38
39
40
41
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 38

def authorize(money, card_or_auth, options = {})
  parse_card_or_auth(card_or_auth, options)
  commit("cc#{@stored_data}Authorize", money, options)
end

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



60
61
62
63
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 60

def capture(money, authorization, options = {})
  options[:confirmationNumber] = authorization
  commit('ccSettlement', money, options)
end

#purchase(money, card_or_auth, options = {}) ⇒ Object Also known as: stored_purchase



44
45
46
47
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 44

def purchase(money, card_or_auth, options = {})
  parse_card_or_auth(card_or_auth, options)
  commit("cc#{@stored_data}Purchase", money, options)
end

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



50
51
52
53
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 50

def refund(money, authorization, options = {})
  options[:confirmationNumber] = authorization
  commit('ccCredit', money, options)
end

#scrub(transcript) ⇒ Object



78
79
80
81
82
83
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 78

def scrub(transcript)
  transcript.
    gsub(%r((%3CstorePwd%3E).*(%3C(%2F|/)storePwd%3E))i, '\1[FILTERED]\2').
    gsub(%r((%3CcardNum%3E)\d*(%3C(%2F|/)cardNum%3E))i, '\1[FILTERED]\2').
    gsub(%r((%3Ccvd%3E)\d*(%3C(%2F|/)cvd%3E))i, '\1[FILTERED]\2')
end

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



70
71
72
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 70

def store(credit_card, options = {})
  verify(credit_card, options)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 74

def supports_scrubbing?
  true
end

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



65
66
67
68
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 65

def verify(credit_card, options = {})
  parse_card_or_auth(credit_card, options)
  commit('ccVerification', 0, options)
end

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



55
56
57
58
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 55

def void(authorization, options = {})
  options[:confirmationNumber] = authorization
  commit('ccAuthorizeReversal', nil, options)
end