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

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, supported_countries, #supported_countries, supported_countries=, supports?, #test?

Methods included from CreditCardFormatting

#format

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”)

  • :default_item_code – Item code (defaults to “FEE”)



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/active_merchant/billing/gateways/cashnet.rb', line 22

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, fields = {}) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/active_merchant/billing/gateways/cashnet.rb', line 34

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

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



43
44
45
46
# File 'lib/active_merchant/billing/gateways/cashnet.rb', line 43

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