Class: ActiveMerchant::Billing::HpsGateway

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

Constant Summary

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, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_scrubbing?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ HpsGateway

Returns a new instance of HpsGateway.



18
19
20
21
# File 'lib/active_merchant/billing/gateways/hps.rb', line 18

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

Instance Method Details

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



23
24
25
26
27
28
29
30
31
# File 'lib/active_merchant/billing/gateways/hps.rb', line 23

def authorize(money, card_or_token, options={})
  commit('CreditAuth') do |xml|
    add_amount(xml, money)
    add_allow_dup(xml)
    add_customer_data(xml, card_or_token, options)
    add_details(xml, options)
    add_payment(xml, card_or_token, options)
  end
end

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



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

def capture(money, transaction_id, options={})
  commit('CreditAddToBatch') do |xml|
    add_amount(xml, money)
    add_reference(xml, transaction_id)
  end
end

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



40
41
42
43
44
45
46
47
48
# File 'lib/active_merchant/billing/gateways/hps.rb', line 40

def purchase(money, card_or_token, options={})
  commit('CreditSale') do |xml|
    add_amount(xml, money)
    add_allow_dup(xml)
    add_customer_data(xml, card_or_token,options)
    add_details(xml, options)
    add_payment(xml, card_or_token, options)
  end
end

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



50
51
52
53
54
55
56
57
58
# File 'lib/active_merchant/billing/gateways/hps.rb', line 50

def refund(money, transaction_id, options={})
  commit('CreditReturn') do |xml|
    add_amount(xml, money)
    add_allow_dup(xml)
    add_reference(xml, transaction_id)
    add_customer_data(xml, transaction_id,options)
    add_details(xml, options)
  end
end

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



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

def verify(card_or_token, options={})
  commit('CreditAccountVerify') do |xml|
    add_customer_data(xml, card_or_token, options)
    add_payment(xml, card_or_token, options)
  end
end

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



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

def void(transaction_id, options={})
  commit('CreditVoid') do |xml|
    add_reference(xml, transaction_id)
  end
end