Class: ActiveMerchant::Billing::MerchantOneGateway

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

Defined Under Namespace

Classes: MerchantOneSslConnection

Constant Summary collapse

BASE_URL =
'https://secure.merchantonegateway.com/api/transact.php'

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

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

#expdate, #format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ MerchantOneGateway

Returns a new instance of MerchantOneGateway.



21
22
23
24
# File 'lib/active_merchant/billing/gateways/merchant_one.rb', line 21

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

Instance Method Details

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



26
27
28
29
30
31
32
33
34
# File 'lib/active_merchant/billing/gateways/merchant_one.rb', line 26

def authorize(money, creditcard, options = {})
  post = {}
  add_customer_data(post, options)
  add_creditcard(post, creditcard)
  add_address(post, creditcard, options)
  add_customer_data(post, options)
  add_amount(post, money, options)
  commit('auth', money, post)
end

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



46
47
48
49
50
51
# File 'lib/active_merchant/billing/gateways/merchant_one.rb', line 46

def capture(money, authorization, options = {})
  post = {}
  post[:transactionid] = authorization
  add_amount(post, money, options)
  commit('capture', money, post)
end

#new_connection(endpoint) ⇒ Object



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

def new_connection(endpoint)
  MerchantOneSslConnection.new(endpoint)
end

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



36
37
38
39
40
41
42
43
44
# File 'lib/active_merchant/billing/gateways/merchant_one.rb', line 36

def purchase(money, creditcard, options = {})
  post = {}
  add_customer_data(post, options)
  add_creditcard(post, creditcard)
  add_address(post, creditcard, options)
  add_customer_data(post, options)
  add_amount(post, money, options)
  commit('sale', money, post)
end