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, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ LitleGateway
constructor
A new instance of LitleGateway.
- #purchase(money, creditcard_or_token, options = {}) ⇒ Object
- #refund(money, authorization, options = {}) ⇒ Object
- #store(creditcard_or_paypage_registration_id, 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 73 74 75 76 77 78 79 80 |
# 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.15.0). Use `gem install LitleOnline` to install it." end if wiredump_device LitleOnline::Configuration.logger = ((Logger === wiredump_device) ? wiredump_device : Logger.new(wiredump_device)) LitleOnline::Configuration.logger.level = Logger::DEBUG else LitleOnline::Configuration.logger = Logger.new(STDOUT) LitleOnline::Configuration.logger.level = Logger::WARN 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
82 83 84 85 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 82 def (money, creditcard_or_token, = {}) to_pass = (money, creditcard_or_token, ) build_response(:authorization, @litle.(to_pass)) end |
#capture(money, authorization, options = {}) ⇒ Object
92 93 94 95 96 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 92 def capture(money, , = {}) transaction_id, kind = () to_pass = create_capture_hash(money, transaction_id, ) build_response(:capture, @litle.capture(to_pass)) end |
#credit(money, authorization, options = {}) ⇒ Object
120 121 122 123 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 120 def credit(money, , = {}) deprecated CREDIT_DEPRECATION_MESSAGE refund(money, , ) end |
#purchase(money, creditcard_or_token, options = {}) ⇒ Object
87 88 89 90 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 87 def purchase(money, creditcard_or_token, = {}) to_pass = build_purchase_request(money, creditcard_or_token, ) build_response(:sale, @litle.sale(to_pass)) end |
#refund(money, authorization, options = {}) ⇒ Object
115 116 117 118 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 115 def refund(money, , = {}) to_pass = build_credit_request(money, , ) build_response(:credit, @litle.credit(to_pass)) end |
#store(creditcard_or_paypage_registration_id, options = {}) ⇒ Object
125 126 127 128 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 125 def store(creditcard_or_paypage_registration_id, = {}) to_pass = create_token_hash(creditcard_or_paypage_registration_id, ) 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
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/active_merchant/billing/gateways/litle.rb', line 104 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 |