Class: ActiveMerchant::Billing::ViaklixGateway

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

Constant Summary collapse

TEST_URL =
'https://demo.viaklix.com/process.asp'
LIVE_URL =
'https://www.viaklix.com/process.asp'
APPROVED =
'0'

Constants inherited from Gateway

Gateway::DEBIT_CARDS

Constants included from PostsData

PostsData::MAX_RETRIES, PostsData::OPEN_TIMEOUT, PostsData::READ_TIMEOUT

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, inherited, supports?, #test?

Methods included from Utils

generate_unique_id

Methods included from CreditCardFormatting

#format

Methods included from RequiresParameters

#requires!

Methods included from PostsData

included, #retry_exceptions, #ssl_post

Constructor Details

#initialize(options = {}) ⇒ ViaklixGateway

Initialize the Gateway

The gateway requires that a valid login and password be passed in the options hash.

Options

  • :login – Merchant ID

  • :password – PIN

  • :user – Specify a subuser of the account (optional)

  • :test => true or false – Force test transactions



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

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

Instance Method Details

#credit(money, creditcard, options = {}) ⇒ Object

Make a credit to a card (Void can only be done from the virtual terminal) Viaklix does not support credits by reference. You must pass in the credit card



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/active_merchant/billing/gateways/viaklix.rb', line 43

def credit(money, creditcard, options = {})
  if creditcard.is_a?(String)
    raise ArgumentError, "Reference credits are not supported. Please supply the original credit card"
  end
  
  form = {}
  add_invoice(form, options)
  add_creditcard(form, creditcard)        
  add_address(form, options)   
  add_customer_data(form, options)
  commit('CREDIT', money, form)
end

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

Make a purchase



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

def purchase(money, creditcard, options = {})
  form = {}
  add_invoice(form, options)
  add_creditcard(form, creditcard)        
  add_address(form, options)   
  add_customer_data(form, options)
  commit('SALE', money, form)
end