Class: ActiveMerchant::Billing::LitleGateway

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

Constant Summary collapse

LITLE_SCHEMA_VERSION =
'8.10'

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

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 CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ LitleGateway

Returns a new instance of LitleGateway.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/active_merchant/billing/gateways/litle.rb', line 56

def initialize(options = {})
  begin
    require 'LitleOnline'
  rescue LoadError
    raise "Could not load the LitleOnline gem (>= 08.13.2).  Use `gem install LitleOnline` to install it."
  end

  @litle = LitleOnline::LitleOnlineRequest.new

  options[:version]  ||= LITLE_SCHEMA_VERSION
  options[:merchant] ||= 'Default Report Group'
  options[:user]     ||= options[:login]

  requires!(options, :merchant_id, :user, :password, :merchant, :version)

  super
end

Instance Method Details

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



74
75
76
77
# File 'lib/active_merchant/billing/gateways/litle.rb', line 74

def authorize(money, creditcard, options = {})
  to_pass = create_credit_card_hash(money, creditcard, options)
  build_response(:authorization, @litle.authorization(to_pass))
end

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



84
85
86
87
# File 'lib/active_merchant/billing/gateways/litle.rb', line 84

def capture(money, authorization, options = {})
  to_pass = create_capture_hash(money, authorization, options)
  build_response(:capture, @litle.capture(to_pass))
end

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



94
95
96
97
# File 'lib/active_merchant/billing/gateways/litle.rb', line 94

def credit(money, identification, options = {})
  to_pass = create_credit_hash(money, identification, options)
  build_response(:credit, @litle.credit(to_pass))
end

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



79
80
81
82
# File 'lib/active_merchant/billing/gateways/litle.rb', line 79

def purchase(money, creditcard, options = {})
  to_pass = create_credit_card_hash(money, creditcard, options)
  build_response(:sale, @litle.sale(to_pass))
end

#store(creditcard, options = {}) ⇒ Object



99
100
101
102
# File 'lib/active_merchant/billing/gateways/litle.rb', line 99

def store(creditcard, options = {})
  to_pass = create_token_hash(creditcard, options)
  build_response(:registerToken, @litle.register_token_request(to_pass), %w(801 802))
end

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



89
90
91
92
# File 'lib/active_merchant/billing/gateways/litle.rb', line 89

def void(identification, options = {})
  to_pass = create_void_hash(identification, options)
  build_response(:void, @litle.void(to_pass))
end