Class: ActiveMerchant::Billing::LitleGateway

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

Constant Summary collapse

TEST_URL =

Specific to Litle options:

  • :merchant_id - Merchant Id assigned by Litle

  • :user - Username assigned by Litle

  • :password - Password assigned by Litle

  • :version - The version of the api you are using (eg, ‘8.10’)

  • :proxy_addr - Proxy address - nil if not needed

  • :proxy_port - Proxy port - nil if not needed

  • :url - URL assigned by Litle (for testing, use the sandbox)

Standard Active Merchant options

  • :order_id - The order number

  • :ip - The IP address of the customer making the purchase

  • :customer - The name, customer number, or other information that identifies the customer

  • :invoice - The invoice number

  • :merchant - The name or description of the merchant offering the product

  • :description - A description of the transaction

  • :email - The email address of the customer

  • :currency - The currency of the transaction. Only important when you are using a currency that is not the default with a gateway that supports multiple currencies.

  • :billing_address - A hash containing the billing address of the customer.

  • :shipping_address - A hash containing the shipping address of the customer.

The :billing_address, and :shipping_address hashes can have the following keys:

  • :name - The full name of the customer.

  • :company - The company name of the customer.

  • :address1 - The primary street address of the customer.

  • :address2 - Additional line of address information.

  • :city - The city of the customer.

  • :state - The state of the customer. The 2 digit code for US and Canadian addresses. The full name of the state or province for foreign addresses.

  • :country - The [ISO 3166-1-alpha-2 code](www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm) for the customer.

  • :zip - The zip or postal code of the customer.

  • :phone - The phone number of the customer.

'https://www.testlitle.com/sandbox/communicator/online'
LIVE_URL =
'https://payments.litle.com/vap/communicator/online'

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.



57
58
59
60
61
# File 'lib/active_merchant/billing/gateways/litle.rb', line 57

def initialize(options = {})
  @litle = LitleOnline::LitleOnlineRequest.new
  requires!(options, :merchant_id, :user, :password, :version, :url)
  @options = options
end

Instance Method Details

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



63
64
65
66
# File 'lib/active_merchant/billing/gateways/litle.rb', line 63

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



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

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



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

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



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

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



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

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



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

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