Class: ActiveMerchant::Billing::MonerisGateway
- Defined in:
- lib/active_merchant/billing/gateways/moneris.rb
Overview
To learn more about the Moneris gateway, please contact [email protected] for a copy of their integration guide. For information on remote testing, please see “Test Environment Penny Value Response Table”, and “Test Environment eFraud (AVS and CVD) Penny Response Values”, available at Moneris’ eSelect Plus Documentation Centre.
Constant Summary
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_datakey, options = {}) ⇒ Object
Referred to as “PreAuth” in the Moneris integration guide, this action verifies and locks funds on a customer’s card, which then must be captured at a later date.
-
#capture(money, authorization, options = {}) ⇒ Object
This method retrieves locked funds from a customer’s account (from a PreAuth) and prepares them for deposit in a merchant’s account.
-
#credit(money, authorization, options = {}) ⇒ Object
Performs a refund.
-
#initialize(options = {}) ⇒ MonerisGateway
constructor
login is your Store ID password is your API Token.
-
#purchase(money, creditcard_or_datakey, options = {}) ⇒ Object
This action verifies funding on a customer’s card and readies them for deposit in a merchant’s account.
- #refund(money, authorization, options = {}) ⇒ Object
- #store(credit_card, options = {}) ⇒ Object
- #unstore(data_key, options = {}) ⇒ Object
- #update(data_key, credit_card, options = {}) ⇒ Object
-
#void(authorization, options = {}) ⇒ Object
Voiding cancels an open authorization.
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
Methods included from CreditCardFormatting
Constructor Details
#initialize(options = {}) ⇒ MonerisGateway
login is your Store ID password is your API Token
23 24 25 26 27 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 23 def initialize( = {}) requires!(, :login, :password) = { :crypt_type => 7 }.merge() super end |
Instance Method Details
#authorize(money, creditcard_or_datakey, options = {}) ⇒ Object
Referred to as “PreAuth” in the Moneris integration guide, this action verifies and locks funds on a customer’s card, which then must be captured at a later date.
Pass in order_id
and optionally a customer
parameter.
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 34 def (money, creditcard_or_datakey, = {}) requires!(, :order_id) post = {} add_payment_source(post, creditcard_or_datakey) post[:amount] = amount(money) post[:order_id] = [:order_id] post[:cust_id] = [:customer] post[:crypt_type] = [:crypt_type] || @options[:crypt_type] action = (post[:data_key].blank?) ? 'preauth' : 'res_preauth_cc' commit(action, post) end |
#capture(money, authorization, options = {}) ⇒ Object
This method retrieves locked funds from a customer’s account (from a PreAuth) and prepares them for deposit in a merchant’s account.
Note: Moneris requires both the order_id and the transaction number of the original authorization. To maintain the same interface as the other gateways the two numbers are concatenated together with a ; separator as the authorization number returned by authorization
69 70 71 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 69 def capture(money, , = {}) commit 'completion', crediting_params(, :comp_amount => amount(money)) end |
#credit(money, authorization, options = {}) ⇒ Object
Performs a refund. This method requires that the original transaction number and order number be included. Concatenate your transaction number and order_id by using a semicolon (‘;’). This is to keep the Moneris interface consistent with other gateways. (See capture
for details.)
87 88 89 90 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 87 def credit(money, , = {}) deprecated CREDIT_DEPRECATION_MESSAGE refund(money, , ) end |
#purchase(money, creditcard_or_datakey, options = {}) ⇒ Object
This action verifies funding on a customer’s card and readies them for deposit in a merchant’s account.
Pass in order_id
and optionally a customer
parameter
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 50 def purchase(money, creditcard_or_datakey, = {}) requires!(, :order_id) post = {} add_payment_source(post, creditcard_or_datakey) post[:amount] = amount(money) post[:order_id] = [:order_id] post[:cust_id] = [:customer] post[:crypt_type] = [:crypt_type] || @options[:crypt_type] action = (post[:data_key].blank?) ? 'purchase' : 'res_purchase_cc' commit(action, post) end |
#refund(money, authorization, options = {}) ⇒ Object
92 93 94 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 92 def refund(money, , = {}) commit 'refund', crediting_params(, :amount => amount(money)) end |
#store(credit_card, options = {}) ⇒ Object
96 97 98 99 100 101 102 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 96 def store(credit_card, = {}) post = {} post[:pan] = credit_card.number post[:expdate] = expdate(credit_card) post[:crypt_type] = [:crypt_type] || @options[:crypt_type] commit('res_add_cc', post) end |
#unstore(data_key, options = {}) ⇒ Object
104 105 106 107 108 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 104 def unstore(data_key, = {}) post = {} post[:data_key] = data_key commit('res_delete', post) end |
#update(data_key, credit_card, options = {}) ⇒ Object
110 111 112 113 114 115 116 117 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 110 def update(data_key, credit_card, = {}) post = {} post[:pan] = credit_card.number post[:expdate] = expdate(credit_card) post[:data_key] = data_key post[:crypt_type] = [:crypt_type] || @options[:crypt_type] commit('res_update_cc', post) end |
#void(authorization, options = {}) ⇒ Object
Voiding cancels an open authorization.
Concatenate your transaction number and order_id by using a semicolon (‘;’). This is to keep the Moneris interface consistent with other gateways. (See capture
for details.)
78 79 80 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 78 def void(, = {}) capture(0, , ) end |