Class/Module Index [+]

Quicksearch

ActiveMerchant::Billing::DataCashGateway

Constants

AUTH_TYPE

Different Card Transaction Types

CANCEL_TYPE
DATACASH_SUCCESS

Datacash success code

FULFILL_TYPE
LIVE_URL
POLICY_ACCEPT

Constant strings for use in the ExtendedPolicy complex element for CV2 checks

POLICY_REJECT
PRE_TYPE
REFUND_TYPE
TEST_URL

Datacash server URLs

TRANSACTION_REFUND_TYPE

Public Class Methods

new(options = {}) click to toggle source

Creates a new DataCashGateway

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

Options

  • :login -- The Datacash account login.

  • :password -- The Datacash account password.

  • :test => true or false -- Use the test or live Datacash url.

# File lib/active_merchant/billing/gateways/data_cash.rb, line 50
def initialize(options = {})
  requires!(options, :login, :password)
  @options = options
  super
end

Public Instance Methods

authorize(money, authorization_or_credit_card, options = {}) click to toggle source

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.

  • authorization_or_credit_card

    The continuous authority reference or CreditCard details for the transaction.

  • options A hash of optional parameters.

    • :order_id A unique reference for this order (corresponds to merchantreference in datacash documentation)

    • :set_up_continuous_authority

      Set to true to set up a recurring historic transaction account be set up. Only supported for :visa, :master and :american_express card types See www.datacash.com/services/recurring/historic.php for more details of historic transactions.

    • :address

      billing address for card

The continuous authority reference will be available in response#params if you have requested one

# File lib/active_merchant/billing/gateways/data_cash.rb, line 98
def authorize(money, authorization_or_credit_card, options = {})
  requires!(options, :order_id)

  if authorization_or_credit_card.is_a?(String)
    request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)
  else
    request = build_purchase_or_authorization_request_with_credit_card_request(PRE_TYPE, money, authorization_or_credit_card, options)
  end

  commit(request)
end
capture(money, authorization, options = {}) click to toggle source

Captures the funds from an authorized transaction.

Parameters

  • money -- The amount to be captured as anInteger value in cents.

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

# File lib/active_merchant/billing/gateways/data_cash.rb, line 116
def capture(money, authorization, options = {})
  commit(build_void_or_capture_request(FULFILL_TYPE, money, authorization, options))
end
credit(money, reference_or_credit_card, options = {}) click to toggle source

Refund to a card

Parameters

  • money The amount to be refunded as an Integer value in cents. Set to nil for a full refund on existing transaction.

  • reference_or_credit_card The credit card you want to refund OR the datacash_reference for the existing transaction you are refunding

  • options Are ignored when refunding via reference to an existing transaction, otherwise

    • :order_id A unique reference for this order (corresponds to merchantreference in datacash documentation)

    • :address

      billing address for card

# File lib/active_merchant/billing/gateways/data_cash.rb, line 140
def credit(money, reference_or_credit_card, options = {})
  if reference_or_credit_card.is_a?(String)
    deprecated CREDIT_DEPRECATION_MESSAGE
    refund(money, reference_or_credit_card)
  else
    request = build_refund_request(money, reference_or_credit_card, options)
    commit(request)
  end
end
purchase(money, authorization_or_credit_card, options = {}) click to toggle source

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

Parameters

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

  • authorization_or_credit_card

    The continuous authority reference or CreditCard details for the transaction.

  • options A hash of optional parameters.

    • :order_id A unique reference for this order (corresponds to merchantreference in datacash documentation)

    • :set_up_continuous_authority

      Set to true to set up a recurring historic transaction account be set up.
      Only supported for :visa, :master and :american_express card types 
      See http://www.datacash.com/services/recurring/historic.php for more details of historic transactions.
    • :address

      billing address for card

The continuous authority reference will be available in response#params if you have requested one

# File lib/active_merchant/billing/gateways/data_cash.rb, line 70
def purchase(money, authorization_or_credit_card, options = {})
  requires!(options, :order_id)

  if authorization_or_credit_card.is_a?(String)
    request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)
  else
    request = build_purchase_or_authorization_request_with_credit_card_request(AUTH_TYPE, money, authorization_or_credit_card, options)
  end

  commit(request)
end
refund(money, reference, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/data_cash.rb, line 150
def refund(money, reference, options = {})
  commit(build_transaction_refund_request(money, reference))
end
test?() click to toggle source

Is the gateway running in test mode?

# File lib/active_merchant/billing/gateways/data_cash.rb, line 155
def test?
  @options[:test] || super
end
void(authorization, options = {}) click to toggle source

Void a previous transaction

Parameters

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

# File lib/active_merchant/billing/gateways/data_cash.rb, line 125
def void(authorization, options = {})
  request = build_void_or_capture_request(CANCEL_TYPE, nil, authorization, options)

  commit(request)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.