Class: ActiveMerchant::Billing::MetricsGlobalGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/metrics_global.rb

Overview

For more information on the Metrics Global Payment Gateway, visit the Metrics Global website. Further documentation on AVS and CVV response codes are available under the support section of the Metrics Global control panel.

Metrics Global Payment Gateway Authentication

The login and password for the gateway are the same as the username and password used to log in to the Metrics Global control panel. Contact Metrics Global support to receive credentials for the control panel.

Demo Account

There is a public demo account available with the following credentials:

Login: demo Password: password

Constant Summary collapse

API_VERSION =
'3.1'
CARD_CODE_ERRORS =
%w( N S )
AVS_ERRORS =
%w( A E N R W Z )
AVS_REASON_CODES =
%w(27 45)

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 = {}) ⇒ MetricsGlobalGateway

Creates a new MetricsGlobalGateway

The gateway requires that a valid login and password be passed in the options hash.

Options

  • :login – The username required to access the Metrics Global control panel. (REQUIRED)

  • :password – The password required to access the Metrics Global control panel. (REQUIRED)

  • :testtrue or false. If true, perform transactions against the test server. Otherwise, perform transactions against the production server.



53
54
55
56
# File 'lib/active_merchant/billing/gateways/metrics_global.rb', line 53

def initialize(options = {})
  requires!(options, :login, :password)
  super
end

Instance Method Details

#authorize(money, creditcard, options = {}) ⇒ Object

Performs an authorization, which reserves the funds on the customer’s credit card, but does not charge the card.

Parameters

  • money – The amount to be authorized as an Integer value in cents.

  • creditcard – The CreditCard details for the transaction.

  • options – A hash of optional parameters.



66
67
68
69
70
71
72
73
74
75
# File 'lib/active_merchant/billing/gateways/metrics_global.rb', line 66

def authorize(money, creditcard, options = {})
  post = {}
  add_invoice(post, options)
  add_creditcard(post, creditcard)
  add_address(post, options)
  add_customer_data(post, options)
  add_duplicate_window(post)

  commit('AUTH_ONLY', money, post)
end

#capture(money, authorization, options = {}) ⇒ Object

Captures the funds from an authorized transaction.

Parameters

  • money – The amount to be captured as an Integer value in cents.

  • authorization – The authorization returned from the previous authorize request.



101
102
103
104
105
# File 'lib/active_merchant/billing/gateways/metrics_global.rb', line 101

def capture(money, authorization, options = {})
  post = {:trans_id => authorization}
  add_customer_data(post, options)
  commit('PRIOR_AUTH_CAPTURE', money, post)
end

#credit(money, identification, options = {}) ⇒ Object



152
153
154
155
# File 'lib/active_merchant/billing/gateways/metrics_global.rb', line 152

def credit(money, identification, options = {})
  ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
  refund(money, identification, options)
end

#purchase(money, creditcard, options = {}) ⇒ Object

Perform a purchase, which is essentially an authorization and capture in a single operation.

Parameters

  • money – The amount to be purchased as an Integer value in cents.

  • creditcard – The CreditCard details for the transaction.

  • options – A hash of optional parameters.



84
85
86
87
88
89
90
91
92
93
# File 'lib/active_merchant/billing/gateways/metrics_global.rb', line 84

def purchase(money, creditcard, options = {})
  post = {}
  add_invoice(post, options)
  add_creditcard(post, creditcard)
  add_address(post, options)
  add_customer_data(post, options)
  add_duplicate_window(post)

  commit('AUTH_CAPTURE', money, post)
end

#refund(money, identification, options = {}) ⇒ Object

Refund a transaction.

This transaction indicates to the gateway that money should flow from the merchant to the customer.

Parameters

  • money – The amount to be credited to the customer as an Integer value in cents.

  • identification – The ID of the original transaction against which the refund is being issued.

  • options – A hash of parameters.

Options

  • :card_number – The credit card number the refund is being issued to. (REQUIRED)

  • :first_name – The first name of the account being refunded.

  • :last_name – The last name of the account being refunded.

  • :zip – The postal code of the account being refunded.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/active_merchant/billing/gateways/metrics_global.rb', line 135

def refund(money, identification, options = {})
  requires!(options, :card_number)

  post = { :trans_id => identification,
           :card_num => options[:card_number]
         }

  post[:first_name] = options[:first_name] if options[:first_name]
  post[:last_name] = options[:last_name] if options[:last_name]
  post[:zip] = options[:zip] if options[:zip]

  add_invoice(post, options)
  add_duplicate_window(post)

  commit('CREDIT', money, post)
end

#void(authorization, options = {}) ⇒ Object

Void a previous transaction

Parameters

  • authorization - The authorization returned from the previous authorize request.



112
113
114
115
116
# File 'lib/active_merchant/billing/gateways/metrics_global.rb', line 112

def void(authorization, options = {})
  post = {:trans_id => authorization}
  add_duplicate_window(post)
  commit('VOID', nil, post)
end