Class: ActiveMerchant::Billing::CashnetGateway

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

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

#format

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ CashnetGateway

Creates a new CashnetGateway

Options

  • :merchant – Gateway Merchant (REQUIRED)

  • :operator – Operator (REQUIRED)

  • :password – Password (REQUIRED)

  • :merchant_gateway_name – Site name (REQUIRED)

  • :station – Station (defaults to “WEB”)

  • :custcode – Customer code (defaults to “ActiveMerchant/#VERSION”)

  • :default_item_code – Default item code (defaults to “FEE”, can be overridden on a per-transaction basis with options)



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

def initialize(options = {})
  requires!(
    options,
    :merchant,
    :operator,
    :password,
    :merchant_gateway_name
  )
  options[:default_item_code] ||= "FEE"
  super
end

Instance Method Details

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



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

def purchase(money, payment_object, options = {})
  post = {}
  add_creditcard(post, payment_object)
  add_invoice(post, options)
  add_address(post, options)
  add_customer_data(post, options)
  commit('SALE', money, post)
end

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



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

def refund(money, identification, options = {})
  post = {}
  post[:origtx]  = identification
  add_invoice(post, options)
  commit('REFUND', money, post)
end