Class: ActiveMerchant::Billing::ViaklixGateway

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

Constant Summary

APPROVED =
'0'

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?, #test?

Methods included from CreditCardFormatting

#expdate, #format

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



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

def initialize(options = {})
  requires!(options, :login, :password)
  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



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/active_merchant/billing/gateways/viaklix.rb', line 51

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)
  add_test_mode(form, options)
  commit(:credit, money, form)
end

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

Make a purchase



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

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