Class: ActiveMerchant::Billing::ViaklixGateway

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

Constant Summary collapse

APPROVED =
'0'

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 = {}) ⇒ 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

Raises:

  • (ArgumentError)

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

def credit(money, creditcard, options = {})
  raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card' if creditcard.is_a?(String)

  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