Class: ActiveMerchant::Billing::DataCashGateway
- Defined in:
- lib/active_merchant/billing/gateways/data_cash.rb
Constant Summary collapse
- TEST_URL =
Datacash server URLs
'https://testserver.datacash.com/Transaction'
- LIVE_URL =
'https://mars.transaction.datacash.com/Transaction'
- AUTH_TYPE =
Different Card Transaction Types
'auth'
- CANCEL_TYPE =
'cancel'
- FULFILL_TYPE =
'fulfill'
- PRE_TYPE =
'pre'
- POLICY_ACCEPT =
Constant strings for use in the ExtendedPolicy complex element for CV2 checks
'accept'
- POLICY_REJECT =
'reject'
- DATACASH_SUCCESS =
Datacash success code
'1'
Constants inherited from Gateway
Constants included from PostsData
PostsData::MAX_RETRIES, PostsData::OPEN_TIMEOUT, PostsData::READ_TIMEOUT
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#authorize(money, credit_card, options = {}) ⇒ Object
Performs an authorization, which reserves the funds on the customer’s credit card, but does not charge the card.
-
#capture(money, authorization, options = {}) ⇒ Object
Captures the funds from an authorized transaction.
-
#initialize(options = {}) ⇒ DataCashGateway
constructor
Creates a new DataCashGateway.
-
#purchase(money, credit_card, options = {}) ⇒ Object
Perform a purchase, which is essentially an authorization and capture in a single operation.
-
#test? ⇒ Boolean
Is the gateway running in test mode?.
-
#void(authorization, options = {}) ⇒ Object
Void a previous transaction.
Methods inherited from Gateway
Methods included from Utils
Methods included from CreditCardFormatting
Methods included from RequiresParameters
Methods included from PostsData
included, #retry_exceptions, #ssl_post
Constructor Details
#initialize(options = {}) ⇒ DataCashGateway
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.
49 50 51 52 53 |
# File 'lib/active_merchant/billing/gateways/data_cash.rb', line 49 def initialize( = {}) requires!(, :login, :password) @options = super end |
Instance Method Details
#authorize(money, credit_card, options = {}) ⇒ Object
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. -
credit_card
– The CreditCard details for the transaction. -
options
– A hash of optional parameters.
74 75 76 |
# File 'lib/active_merchant/billing/gateways/data_cash.rb', line 74 def (money, credit_card, = {}) commit((PRE_TYPE, money, credit_card, )) end |
#capture(money, authorization, options = {}) ⇒ Object
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.
84 85 86 |
# File 'lib/active_merchant/billing/gateways/data_cash.rb', line 84 def capture(money, , = {}) commit(build_void_or_capture_request(FULFILL_TYPE, money, , )) end |
#purchase(money, credit_card, options = {}) ⇒ Object
Perform a purchase, which is essentially an authorization and capture in a single operation.
Parameters
-
money
– The amount to be purchased. Either an Integer value in cents or a Money object. -
credit_card
– The CreditCard details for the transaction. -
options
– A hash of optional parameters.
62 63 64 |
# File 'lib/active_merchant/billing/gateways/data_cash.rb', line 62 def purchase(money, credit_card, = {}) commit((AUTH_TYPE, money, credit_card, )) end |
#test? ⇒ Boolean
Is the gateway running in test mode?
100 101 102 |
# File 'lib/active_merchant/billing/gateways/data_cash.rb', line 100 def test? @options[:test] || super end |
#void(authorization, options = {}) ⇒ Object
Void a previous transaction
Parameters
-
authorization
- The authorization returned from the previous authorize request.
93 94 95 96 97 |
# File 'lib/active_merchant/billing/gateways/data_cash.rb', line 93 def void(, = {}) request = build_void_or_capture_request(CANCEL_TYPE, nil, , ) commit(request) end |