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.com
Setup
In order to set-up the gateway you need only one paramater: the api_key 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, payment_method, 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, payment_method, options = {}) ⇒ Object
Public: Performs purchase operation.
-
#refund(money, authorization, options = {}) ⇒ Object
Public: Refunds from previous purchase.
- #scrub(transcript) ⇒ Object
- #store(payment_method, options = {}) ⇒ Object
- #supports_scrubbing? ⇒ Boolean
-
#verify(payment_method, 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, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #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
:api_key Account's API KEY
29 30 31 32 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 29 def initialize( = {}) requires!(, :api_key) super end |
Instance Method Details
#authorize(money, payment_method, options = {}) ⇒ Object
Public: Performs authorization operation
money - Amount to authorize payment_method - Credit card options - Hash containing authorization options
:order_id Merchant created id for the
:billing_address Hash with billing address information
:description Merchant created description (optional)
:currency Sale currency to override money object or default (optional)
Returns Active Merchant response object
60 61 62 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 60 def (money, payment_method, = {}) execute_new_order(:authorize, money, payment_method, ) 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 (optional)
:description Merchant created 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
76 77 78 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 76 def capture(money, , = {}) execute_dependant(:capture, money, , ) end |
#purchase(money, payment_method, options = {}) ⇒ Object
Public: Performs purchase operation
money - Amount of purchase payment_method - 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
45 46 47 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 45 def purchase(money, payment_method, = {}) execute_new_order(:purchase, money, payment_method, ) 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 (optional)
:description Merchant created 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
92 93 94 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 92 def refund(money, , = {}) execute_dependant(:refund, money, , ) end |
#scrub(transcript) ⇒ Object
132 133 134 135 136 137 138 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 132 def scrub(transcript) transcript. gsub(%r((Authorization: )\w+), '\1[FILTERED]'). gsub(%r(("number\\?":\\?")[^"]*)i, '\1[FILTERED]'). gsub(%r(("cvc\\?":\\?")[^"]*)i, '\1[FILTERED]'). gsub(%r(("cavv\\?":\\?")[^"]*)i, '\1[FILTERED]') end |
#store(payment_method, options = {}) ⇒ Object
124 125 126 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 124 def store(payment_method, = {}) execute_new_order(:store, 0, payment_method, ) end |
#supports_scrubbing? ⇒ Boolean
128 129 130 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 128 def supports_scrubbing? true end |
#verify(payment_method, options = {}) ⇒ Object
Public: Verifies credit card. Does this by doing a authorization of 1.00 Euro and then voiding it.
payment_method - Credit card options - Hash containing authorization options
:order_id Merchant created id for the
:billing_address Hash with billing address information
:description Merchant created description (optional)
:currency Sale currency to override money object or default (optional)
Returns Active Merchant response object of Authorization operation
117 118 119 120 121 122 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 117 def verify(payment_method, = {}) MultiResponse.run(:use_first_response) do |r| r.process { (100, payment_method, ) } 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 (optional)
Returns Active Merchant response object
103 104 105 |
# File 'lib/active_merchant/billing/gateways/monei.rb', line 103 def void(, = {}) execute_dependant(:void, nil, , ) end |