Class ActiveMerchant::Billing::DataCashGateway
In: lib/active_merchant/billing/gateways/data_cash.rb
Parent: Gateway

Methods

authorize   capture   credit   new   purchase   test?   void  

Constants

TEST_URL = 'https://testserver.datacash.com/Transaction'   Datacash server URLs
LIVE_URL = 'https://mars.transaction.datacash.com/Transaction'
AUTH_TYPE = 'auth'   Different Card Transaction Types
CANCEL_TYPE = 'cancel'
FULFILL_TYPE = 'fulfill'
PRE_TYPE = 'pre'
REFUND_TYPE = 'refund'
TRANSACTION_REFUND_TYPE = 'txn_refund'
POLICY_ACCEPT = 'accept'   Constant strings for use in the ExtendedPolicy complex element for CV2 checks
POLICY_REJECT = 'reject'
DATACASH_SUCCESS = '1'   Datacash success code

Public Class methods

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.

[Source]

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

Public Instance methods

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. Either an Integer value in cents or a Money object.
  • 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[‘ca_referece’] if you have requested one

[Source]

     # File lib/active_merchant/billing/gateways/data_cash.rb, line 100
100:       def authorize(money, authorization_or_credit_card, options = {})
101:         requires!(options, :order_id)
102: 
103:         if authorization_or_credit_card.is_a?(String)
104:           request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)
105:         else
106:           request = build_purchase_or_authorization_request_with_credit_card_request(PRE_TYPE, money, authorization_or_credit_card, options)
107:         end
108: 
109:         commit(request)
110:       end

Captures the funds from an authorized transaction.

Parameters

  • money — The amount to be captured. Either an Integer value in cents or a Money object.
  • authorization — The authorization returned from the previous authorize request.

[Source]

     # File lib/active_merchant/billing/gateways/data_cash.rb, line 118
118:       def capture(money, authorization, options = {})
119:         commit(build_void_or_capture_request(FULFILL_TYPE, money, authorization, options))
120:       end

Refund to a card

Parameters

  • money The amount to be refunded. Either an Integer value in cents or a Money object. 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

[Source]

     # File lib/active_merchant/billing/gateways/data_cash.rb, line 142
142:       def credit(money, reference_or_credit_card, options = {})
143:         if reference_or_credit_card.is_a?(String)
144:           request = build_transaction_refund_request(money, reference_or_credit_card)
145:         else
146:           request = build_refund_request(money, reference_or_credit_card, options)
147:         end
148: 
149:         commit(request)
150:       end

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

Parameters

  • money The amount to be authorized. Either an Integer value in cents or a Money object.
  • 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[‘ca_referece’] if you have requested one

[Source]

    # File lib/active_merchant/billing/gateways/data_cash.rb, line 72
72:       def purchase(money, authorization_or_credit_card, options = {})
73:         requires!(options, :order_id)
74: 
75:         if authorization_or_credit_card.is_a?(String)
76:           request = build_purchase_or_authorization_request_with_continuous_authority_reference_request(AUTH_TYPE, money, authorization_or_credit_card, options)
77:         else
78:           request = build_purchase_or_authorization_request_with_credit_card_request(AUTH_TYPE, money, authorization_or_credit_card, options)
79:         end
80: 
81:         commit(request)
82:       end

Is the gateway running in test mode?

[Source]

     # File lib/active_merchant/billing/gateways/data_cash.rb, line 153
153:       def test?
154:         @options[:test] || super
155:       end

Void a previous transaction

Parameters

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

[Source]

     # File lib/active_merchant/billing/gateways/data_cash.rb, line 127
127:       def void(authorization, options = {})
128:         request = build_void_or_capture_request(CANCEL_TYPE, nil, authorization, options)
129: 
130:         commit(request)
131:       end

[Validate]