Class: ActiveMerchant::Billing::MonerisGateway
- Defined in:
- lib/active_merchant/billing/gateways/moneris.rb
Constant Summary collapse
- TEST_URL =
'https://esqa.moneris.com/gateway2/servlet/MpgRequest'
- LIVE_URL =
'https://www3.moneris.com/gateway2/servlet/MpgRequest'
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
-
.supported_cardtypes ⇒ Object
We support visa and master card.
Instance Method Summary collapse
- #authorize(money, creditcard, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
Moneris requires both the order_id and the transaction number of the original authorization.
-
#initialize(options = {}) ⇒ MonerisGateway
constructor
login is your Store ID password is your API Token.
-
#purchase(money, creditcard, options = {}) ⇒ Object
Pass in
order_id
and optionally acustomer
parameter. - #void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
Methods included from RequiresParameters
Methods included from PostsData
Constructor Details
#initialize(options = {}) ⇒ MonerisGateway
login is your Store ID password is your API Token
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 16 def initialize( = {}) requires!(, :login, :password) @options = { :strict_ssl => true, :crypt_type => 7 }.update() @url = test? ? TEST_URL : LIVE_URL super end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 9 def @options end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
8 9 10 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 8 def response @response end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 7 def url @url end |
Class Method Details
.supported_cardtypes ⇒ Object
We support visa and master card
90 91 92 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 90 def self.supported_cardtypes [:visa, :master] end |
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 29 def (money, creditcard, = {}) requires!(, :order_id) parameters = { :order_id => [:order_id], :cust_id => [:customer], :amount => amount(money), :pan => creditcard.number, :expdate => expdate(creditcard), :crypt_type => [:crypt_type] || @options[:crypt_type] } commit('preauth', parameters) end |
#capture(money, authorization, options = {}) ⇒ Object
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 an _ separator as the authorization number returned by authorization
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 64 def capture(money, , = {}) txn_number, order_id = .split(';') parameters = { :txn_number => txn_number, :order_id => order_id, :comp_amount => amount(money), :crypt_type => [:crypt_type] || @options[:crypt_type] } commit('completion', parameters) end |
#purchase(money, creditcard, options = {}) ⇒ Object
Pass in order_id
and optionally a customer
parameter
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 45 def purchase(money, creditcard, = {}) requires!(, :order_id) parameters = { :order_id => [:order_id], :cust_id => [:customer], :amount => amount(money), :pan => creditcard.number, :expdate => expdate(creditcard), :crypt_type => [:crypt_type] || @options[:crypt_type] } commit('purchase', parameters) end |
#void(authorization, options = {}) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/active_merchant/billing/gateways/moneris.rb', line 77 def void(, = {}) txn_number, order_id = .split(';') parameters = { :txn_number => txn_number, :order_id => order_id, :crypt_type => [:crypt_type] || @options[:crypt_type] } commit('purchasecorrection', parameters) end |