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::DEBIT_CARDS, 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 = {}) ⇒ OptimalPaymentGateway

Returns a new instance of OptimalPaymentGateway.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 19

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



35
36
37
38
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 35

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



57
58
59
60
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 57

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



41
42
43
44
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 41

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



47
48
49
50
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 47

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

#scrub(transcript) ⇒ Object



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

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

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


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

def supports_scrubbing?
  true
end

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



52
53
54
55
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 52

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