Class: ActiveMerchant::Billing::CashnetGateway

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

Constant Summary

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, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #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)



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/active_merchant/billing/gateways/cashnet.rb', line 29

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



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

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

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



50
51
52
53
54
55
56
# File 'lib/active_merchant/billing/gateways/cashnet.rb', line 50

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

#scrub(transcript) ⇒ Object



62
63
64
65
66
67
# File 'lib/active_merchant/billing/gateways/cashnet.rb', line 62

def scrub(transcript)
  transcript.
    gsub(%r{(password=)[^&]+}, '\1[FILTERED]').
    gsub(%r{(cardno=)[^&]+}, '\1[FILTERED]').
    gsub(%r{(cid=)[^&]+}, '\1[FILTERED]')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/active_merchant/billing/gateways/cashnet.rb', line 58

def supports_scrubbing?
  true
end