Class: ActiveMerchant::Billing::SecurionPayGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/securion_pay.rb

Constant Summary collapse

STANDARD_ERROR_CODE_MAPPING =
{
  'incorrect_number' => STANDARD_ERROR_CODE[:incorrect_number],
  'invalid_number' => STANDARD_ERROR_CODE[:invalid_number],
  'invalid_expiry_month' => STANDARD_ERROR_CODE[:invalid_expiry_date],
  'invalid_expiry_year' => STANDARD_ERROR_CODE[:invalid_expiry_date],
  'invalid_cvc' => STANDARD_ERROR_CODE[:invalid_cvc],
  'expired_card' => STANDARD_ERROR_CODE[:expired_card],
  'insufficient_funds' => STANDARD_ERROR_CODE[:card_declined],
  'incorrect_cvc' => STANDARD_ERROR_CODE[:incorrect_cvc],
  'incorrect_zip' => STANDARD_ERROR_CODE[:incorrect_zip],
  'card_declined' => STANDARD_ERROR_CODE[:card_declined],
  'processing_error' => STANDARD_ERROR_CODE[:processing_error],
  'lost_or_stolen' => STANDARD_ERROR_CODE[:card_declined],
  'suspected_fraud' => STANDARD_ERROR_CODE[:card_declined],
  'expired_token' => STANDARD_ERROR_CODE[:card_declined]
}

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, 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?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ SecurionPayGateway

Returns a new instance of SecurionPayGateway.



43
44
45
46
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 43

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

Instance Method Details

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



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

def authorize(money, payment, options={})
  post = create_post_for_auth_or_purchase(money, payment, options)
  post[:captured] = "false"
  commit('charges', post, options)
end

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



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

def capture(money, authorization, options = {})
  post = {}
  add_amount(post, money, options)
  commit("charges/#{CGI.escape(authorization)}/capture", post, options)
end

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



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

def purchase(money, payment, options={})
  post = create_post_for_auth_or_purchase(money, payment, options)
  commit('charges', post, options)
end

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



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

def refund(money, authorization, options = {})
  post = {}
  add_amount(post, money, options)
  commit("charges/#{CGI.escape(authorization)}/refund", post, options)
end

#scrub(transcript) ⇒ Object



86
87
88
89
90
91
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 86

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

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 82

def supports_scrubbing?
  true
end

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



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

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



71
72
73
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 71

def void(authorization, options = {})
  commit("charges/#{CGI.escape(authorization)}/refund", {}, options)
end