Class: ActiveMerchant::Billing::AxcessmsGateway

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

Constant Summary collapse

API_VERSION =
'1.0'
PAYMENT_CODE_PREAUTHORIZATION =
'CC.PA'
PAYMENT_CODE_DEBIT =
'CC.DB'
PAYMENT_CODE_CAPTURE =
'CC.CP'
PAYMENT_CODE_REVERSAL =
'CC.RV'
PAYMENT_CODE_REFUND =
'CC.RF'
PAYMENT_CODE_REBILL =
'CC.RB'

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, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #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 = {}) ⇒ AxcessmsGateway

Returns a new instance of AxcessmsGateway.



26
27
28
29
# File 'lib/active_merchant/billing/gateways/axcessms.rb', line 26

def initialize(options = {})
  requires!(options, :sender, :login, :password, :channel)
  super
end

Instance Method Details

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



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

def authorize(money, authorization, options = {})
  commit(PAYMENT_CODE_PREAUTHORIZATION, money, authorization, options)
end

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



40
41
42
# File 'lib/active_merchant/billing/gateways/axcessms.rb', line 40

def capture(money, authorization, options = {})
  commit(PAYMENT_CODE_CAPTURE, money, authorization, options)
end

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



31
32
33
34
# File 'lib/active_merchant/billing/gateways/axcessms.rb', line 31

def purchase(money, payment, options = {})
  payment_code = payment.respond_to?(:number) ? PAYMENT_CODE_DEBIT : PAYMENT_CODE_REBILL
  commit(payment_code, money, payment, options)
end

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



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

def refund(money, authorization, options = {})
  commit(PAYMENT_CODE_REFUND, money, authorization, options)
end

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



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

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



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

def void(authorization, options = {})
  commit(PAYMENT_CODE_REVERSAL, nil, authorization, options)
end