Class: ActiveMerchant::Billing::MoneiGateway

Inherits:
Gateway
  • Object
show all
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::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#expdate, #format

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(options={})
  requires!(options, :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 authorize(money, credit_card, options={})
  execute_new_order(:authorize, money, credit_card, options)
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, authorization, options={})
  execute_dependant(:capture, money, authorization, options)
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, options)
  execute_new_order(:purchase, money, credit_card, options)
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, authorization, options={})
  execute_dependant(:refund, money, authorization, options)
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, options={})
  MultiResponse.run(:use_first_response) do |r|
    r.process { authorize(100, credit_card, options) }
    r.process(:ignore_result) { void(r.authorization, options) }
  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(authorization, options={})
  execute_dependant(:void, nil, authorization, options)
end