Class: Hps::HpsCheckService
- Inherits:
-
HpsService
- Object
- HpsService
- Hps::HpsCheckService
- Defined in:
- lib/hps/services/hps_check_service.rb
Instance Attribute Summary
Attributes inherited from HpsService
Instance Method Summary collapse
- #sale(check, amount, client_txn_id = nil) ⇒ Object
- #void(transaction_id = nil, client_txn_id = nil) ⇒ Object
Methods inherited from HpsService
#doTransaction, #gateway_url_for_key, #hydrate_transaction_header, #initialize
Constructor Details
This class inherits a constructor from Hps::HpsService
Instance Method Details
#sale(check, amount, client_txn_id = nil) ⇒ Object
3 4 5 |
# File 'lib/hps/services/hps_check_service.rb', line 3 def sale(check, amount, client_txn_id = nil) build_transaction('SALE', check, amount, client_txn_id) end |
#void(transaction_id = nil, client_txn_id = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/hps/services/hps_check_service.rb', line 7 def void(transaction_id = nil, client_txn_id = nil) if (transaction_id == nil && client_txn_id == nil) || (transaction_id != nil && client_txn_id != nil) raise Error, 'Please provide either a transaction ID or a client transaction ID' end xml = Builder::XmlMarkup.new xml.hps :Transaction do xml.hps :CheckVoid do xml.hps :Block1 do xml.hps :GatewayTxnId, transaction_id if transaction_id xml.hps :ClientTxnId, client_txn_id if client_txn_id end end end submit_transaction(xml.target!, :CheckVoid) end |