Class: ActiveMerchant::Billing::LitleGateway
- Defined in:
- lib/active_merchant/billing/gateways/litle.rb
Defined Under Namespace
Classes: LitleCardToken
Constant Summary collapse
- LITLE_SCHEMA_VERSION =
'8.13'
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
- #authorize(money, creditcard_or_token, options = {}) ⇒ Object
- #capture(money, authorization, options = {}) ⇒ Object
- #credit(money, identification_or_token, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ LitleGateway
constructor
A new instance of LitleGateway.
- #purchase(money, creditcard_or_token, options = {}) ⇒ Object
- #store(creditcard, options = {}) ⇒ Object
-
#void(identification, options = {}) ⇒ Object
Note: Litle requires that authorization requests be voided via auth_reversal and other requests via void.
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
Methods included from CreditCardFormatting
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( = {}) 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 [:version] ||= LITLE_SCHEMA_VERSION [:merchant] ||= 'Default Report Group' [:user] ||= [:login] requires!(, :merchant_id, :user, :password, :merchant, :version) super end |
Instance Method Details
#authorize(money, creditcard_or_token, options = {}) ⇒ Object
74 75 76 77 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 74 def (money, creditcard_or_token, = {}) to_pass = (money, creditcard_or_token, ) build_response(:authorization, @litle.(to_pass)) end |
#capture(money, authorization, options = {}) ⇒ Object
84 85 86 87 88 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 84 def capture(money, , = {}) transaction_id, kind = () to_pass = create_capture_hash(money, transaction_id, ) build_response(:capture, @litle.capture(to_pass)) end |
#credit(money, identification_or_token, options = {}) ⇒ Object
107 108 109 110 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 107 def credit(money, identification_or_token, = {}) to_pass = build_credit_request(money, identification_or_token, ) build_response(:credit, @litle.credit(to_pass)) end |
#purchase(money, creditcard_or_token, options = {}) ⇒ Object
79 80 81 82 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 79 def purchase(money, creditcard_or_token, = {}) to_pass = build_purchase_request(money, creditcard_or_token, ) build_response(:sale, @litle.sale(to_pass)) end |
#store(creditcard, options = {}) ⇒ Object
112 113 114 115 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 112 def store(creditcard, = {}) to_pass = create_token_hash(creditcard, ) build_response(:registerToken, @litle.register_token_request(to_pass), %w(000 801 802)) end |
#void(identification, options = {}) ⇒ Object
Note: Litle requires that authorization requests be voided via auth_reversal and other requests via void. To maintain the same interface as the other gateways the transaction_id and the kind of transaction are concatenated together with a ; separator (e.g. 1234;authorization)
A partial auth_reversal can be accomplished by passing :amount as an option
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 96 def void(identification, = {}) transaction_id, kind = (identification) if(kind == 'authorization') to_pass = create_auth_reversal_hash(transaction_id, [:amount], ) build_response(:authReversal, @litle.auth_reversal(to_pass)) else to_pass = create_void_hash(transaction_id, ) build_response(:void, @litle.void(to_pass)) end end |