class AuthorizeNet::XmlTransaction

The ARB transaction class.

Constants

XML_NAMESPACE

The XML namespace used by the ARB API.

Public Class Methods

new(api_login_id, api_transaction_key, options = {}) click to toggle source

DO NOT USE. Instantiate AuthorizeNet::ARB::Transaction or AuthorizeNet::CIM::Transaction instead.

Calls superclass method AuthorizeNet::Transaction::new
# File lib/authorize_net/xml_transaction.rb, line 65
def initialize(api_login_id, api_transaction_key, options = {})
  super()
  @api_login_id = api_login_id
  @api_transaction_key = api_transaction_key
  
  @response ||= nil
  @type ||= nil
  
  options = @@option_defaults.merge(options)
  @verify_ssl = options[:verify_ssl]
  @reference_id = options[:reference_id]
  case options[:gateway]
  when :sandbox, :test
    @gateway = Gateway::TEST
  when :production, :live
    @gateway = Gateway::LIVE
  else
    @gateway = options[:gateway]
  end
end

Public Instance Methods

has_response?() click to toggle source

Checks to see if the transaction has a response (meaning it has been submitted to the gateway). Returns TRUE if a response is present, FALSE otherwise.

# File lib/authorize_net/xml_transaction.rb, line 94
def has_response?
  !@response.nil?
end
response() click to toggle source

Retrieve the response object (or Nil if transaction hasn’t been sent to the gateway).

# File lib/authorize_net/xml_transaction.rb, line 99
def response
  @response
end
run() click to toggle source

Submits the transaction to the gateway for processing. Returns a response object. If the transaction has already been run, it will return nil.

# File lib/authorize_net/xml_transaction.rb, line 105
def run
  make_request
end
test?() click to toggle source

Checks if the transaction has been configured for the sandbox or not. Return FALSE if the transaction is running against the production, TRUE otherwise.

# File lib/authorize_net/xml_transaction.rb, line 88
def test?
  @gateway != Gateway::LIVE
end
xml() click to toggle source

Returns a deep-copy of the XML object sent to the payment gateway. Or nil if there was no XML payload.

# File lib/authorize_net/xml_transaction.rb, line 110
def xml
  @xml
end