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 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.


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

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


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

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


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

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


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

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


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

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

#scrub(transcript) ⇒ Object


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

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


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

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

#supports_scrubbing?Boolean

Returns:

  • (Boolean)

72
73
74
# File 'lib/active_merchant/billing/gateways/optimal_payment.rb', line 72

def supports_scrubbing?
  true
end

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


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

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

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


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

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