Class: ActiveMerchant::Billing::MoneiGateway
- Defined in:
- lib/active_merchant/billing/gateways/monei.rb
Overview
Monei gateway
This class implements Monei gateway for Active Merchant. For more information about Monei gateway please go to www.monei.net
Setup
In order to set-up the gateway you need four paramaters: sender_id, channel_id, login and pwd. Request that data to Monei.
Constant Summary
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#authorize(money, credit_card, options = {}) ⇒ Object
Public: Performs authorization operation.
-
#capture(money, authorization, options = {}) ⇒ Object
Public: Performs capture operation on previous authorization.
-
#initialize(options = {}) ⇒ MoneiGateway
constructor
Constructor.
-
#purchase(money, credit_card, options = {}) ⇒ Object
Public: Performs purchase operation.
-
#refund(money, authorization, options = {}) ⇒ Object
Public: Refunds from previous purchase.
-
#verify(credit_card, options = {}) ⇒ Object
Public: Verifies credit card.
-
#void(authorization, options = {}) ⇒ Object
Public: Voids previous authorization.
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #scrub, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ MoneiGateway
Constructor
options - Hash containing the gateway credentials, ALL MANDATORY
:sender_id Sender ID
:channel_id Channel ID
:login User login
:pwd User password
32 33 34 35 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 32 def initialize( = {}) requires!(, :sender_id, :channel_id, :login, :pwd) super end |
Instance Method Details
#authorize(money, credit_card, options = {}) ⇒ Object
Public: Performs authorization operation
money - Amount to authorize credit_card - Credit card options - Hash containing authorization options
:order_id Merchant created id for the authorization
:billing_address Hash with billing address information
:description Merchant created authorization description (optional)
:currency Sale currency to override money object or default (optional)
Returns Active Merchant response object
63 64 65 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 63 def (money, credit_card, = {}) execute_new_order(:authorize, money, credit_card, ) end |
#capture(money, authorization, options = {}) ⇒ Object
Public: Performs capture operation on previous authorization
money - Amount to capture authorization - Reference to previous authorization, obtained from response object returned by authorize options - Hash containing capture options
:order_id Merchant created id for the authorization (optional)
:description Merchant created authorization description (optional)
:currency Sale currency to override money object or default (optional)
Note: you should pass either order_id or description
Returns Active Merchant response object
79 80 81 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 79 def capture(money, , = {}) execute_dependant(:capture, money, , ) end |
#purchase(money, credit_card, options = {}) ⇒ Object
Public: Performs purchase operation
money - Amount of purchase credit_card - Credit card options - Hash containing purchase options
:order_id Merchant created id for the purchase
:billing_address Hash with billing address information
:description Merchant created purchase description (optional)
:currency Sale currency to override money object or default (optional)
Returns Active Merchant response object
48 49 50 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 48 def purchase(money, credit_card, = {}) execute_new_order(:purchase, money, credit_card, ) end |
#refund(money, authorization, options = {}) ⇒ Object
Public: Refunds from previous purchase
money - Amount to refund authorization - Reference to previous purchase, obtained from response object returned by purchase options - Hash containing refund options
:order_id Merchant created id for the authorization (optional)
:description Merchant created authorization description (optional)
:currency Sale currency to override money object or default (optional)
Note: you should pass either order_id or description
Returns Active Merchant response object
95 96 97 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 95 def refund(money, , = {}) execute_dependant(:refund, money, , ) end |
#verify(credit_card, options = {}) ⇒ Object
Public: Verifies credit card. Does this by doing a authorization of 1.00 Euro and then voiding it.
credit_card - Credit card options - Hash containing authorization options
:order_id Merchant created id for the authorization
:billing_address Hash with billing address information
:description Merchant created authorization description (optional)
:currency Sale currency to override money object or default (optional)
Returns Active Merchant response object of Authorization operation
120 121 122 123 124 125 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 120 def verify(credit_card, = {}) MultiResponse.run(:use_first_response) do |r| r.process { (100, credit_card, ) } r.process(:ignore_result) { void(r., ) } end end |
#void(authorization, options = {}) ⇒ Object
Public: Voids previous authorization
authorization - Reference to previous authorization, obtained from response object returned by authorize options - Hash containing capture options
:order_id Merchant created id for the authorization (optional)
Returns Active Merchant response object
106 107 108 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 106 def void(, = {}) execute_dependant(:void, nil, , ) end |