| Class | ActiveMerchant::Billing::DataCashGateway |
| In: |
lib/active_merchant/billing/gateways/data_cash.rb
|
| Parent: | Gateway |
| 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 |
Creates a new DataCashGateway
The gateway requires that a valid login and password be passed in the options hash.
# 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
Performs an authorization, which reserves the funds on the customer‘s credit card, but does not charge the card.
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.
The continuous authority reference will be available in response#params[‘ca_referece’] if you have requested one
# 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.
# 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
# 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.
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.
The continuous authority reference will be available in response#params[‘ca_referece’] if you have requested one
# 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?
# File lib/active_merchant/billing/gateways/data_cash.rb, line 153
153: def test?
154: @options[:test] || super
155: end
Void a previous transaction
# 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