Class: Xpay::TransactionQuery

Inherits:
Transaction show all
Defined in:
lib/xpay/transaction_query.rb

Overview

This class allows you to query the status of a transaction processed with Xpay the following attributes are required: either a TransactionReference or your own OrderReference from a previous transaction and your SiteReference if not already set in the config, you can also pass it to overwrite it for this transaction

Instance Attribute Summary collapse

Attributes inherited from Transaction

#request_xml, #response_xml, #three_secure

Instance Method Summary collapse

Methods inherited from Transaction

#request_method, #response_code

Constructor Details

#initialize(options = {}) ⇒ TransactionQuery

Returns a new instance of TransactionQuery.



10
11
12
13
14
15
16
# File 'lib/xpay/transaction_query.rb', line 10

def initialize(options={})
  @request_xml = REXML::Document.new(Xpay.root_to_s)
  options.each do |key, value|
    self.send("#{key}=", value) if self.respond_to? key
  end
  create_request
end

Instance Attribute Details

#order_referenceObject

Returns the value of attribute order_reference.



8
9
10
# File 'lib/xpay/transaction_query.rb', line 8

def order_reference
  @order_reference
end

#site_aliasObject

Returns the value of attribute site_alias.



8
9
10
# File 'lib/xpay/transaction_query.rb', line 8

def site_alias
  @site_alias
end

#site_referenceObject

Returns the value of attribute site_reference.



8
9
10
# File 'lib/xpay/transaction_query.rb', line 8

def site_reference
  @site_reference
end

#transaction_referenceObject

Returns the value of attribute transaction_reference.



8
9
10
# File 'lib/xpay/transaction_query.rb', line 8

def transaction_reference
  @transaction_reference
end

Instance Method Details

#queryObject



18
19
20
21
# File 'lib/xpay/transaction_query.rb', line 18

def query
  @response_xml = process()
  return response_code
end

#response_blockObject

The response_block is a hash and can have one of several values: the follwing values are always present after a transaction and can be queried to gain further details of the transaction:

* result_code:
    0 for failure, check error_code for further details
    1 transaction was succesful
    2 transaction was denied
* transaction_reference
* transactionverifier
* transaction_time
* auth_code
* amount
* the order reference


35
36
37
# File 'lib/xpay/transaction_query.rb', line 35

def response_block
  create_response_block
end