Class: AuthorizeNet::XmlTransaction
- Inherits:
-
Transaction
- Object
- Transaction
- AuthorizeNet::XmlTransaction
- Defined in:
- lib/authorize_net/xml_transaction.rb
Overview
The ARB transaction class.
Direct Known Subclasses
Defined Under Namespace
Constant Summary collapse
- XML_NAMESPACE =
The XML namespace used by the ARB API.
'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.freeze
- @@boolean_fields =
Fields to convert to/from booleans.
[]
- @@decimal_fields =
Fields to convert to/from BigDecimal.
[]
- @@date_fields =
Fields to convert to/from Date.
[]
- @@datetime_fields =
Fields to convert to/from DateTime.
[]
- @@option_defaults =
The default options for the constructor.
{ gateway: :production, verify_ssl: true, reference_id: nil }
Constants included from TypeConversions
TypeConversions::API_FIELD_PREFIX
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Retrieve the response object (or Nil if transaction hasn’t been sent to the gateway).
-
#xml ⇒ Object
readonly
Returns a deep-copy of the XML object sent to the payment gateway.
Attributes inherited from Transaction
Instance Method Summary collapse
-
#has_response? ⇒ Boolean
Checks to see if the transaction has a response (meaning it has been submitted to the gateway).
-
#initialize(api_login_id, api_transaction_key, options = {}) ⇒ XmlTransaction
constructor
DO NOT USE.
-
#run ⇒ Object
Submits the transaction to the gateway for processing.
- #setOAuthOptions ⇒ Object
-
#test? ⇒ Boolean
Checks if the transaction has been configured for the sandbox or not.
Methods inherited from Transaction
#set_address, #set_customer, #set_fields, #set_shipping_address
Methods included from TypeConversions
#boolean_to_value, #date_to_value, #datetime_to_value, #decimal_to_value, #integer_to_value, #to_external_field, #to_internal_field, #to_param, #value_to_boolean, #value_to_date, #value_to_datetime, #value_to_decimal, #value_to_integer
Constructor Details
#initialize(api_login_id, api_transaction_key, options = {}) ⇒ XmlTransaction
DO NOT USE. Instantiate AuthorizeNet::ARB::Transaction or AuthorizeNet::CIM::Transaction instead.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/authorize_net/xml_transaction.rb', line 66 def initialize(api_login_id, api_transaction_key, = {}) super() @api_login_id = api_login_id @api_transaction_key = api_transaction_key @response ||= nil @type ||= nil = @@option_defaults.merge() @verify_ssl = [:verify_ssl] @reference_id = [:reference_id] @gateway = case [:gateway].to_s when 'sandbox', 'test' Gateway::TEST when 'production', 'live' Gateway::LIVE else @gateway = [:gateway] [:gateway] end end |
Instance Attribute Details
#response ⇒ Object (readonly)
Retrieve the response object (or Nil if transaction hasn’t been sent to the gateway).
119 120 121 |
# File 'lib/authorize_net/xml_transaction.rb', line 119 def response @response end |
#xml ⇒ Object (readonly)
Returns a deep-copy of the XML object sent to the payment gateway. Or nil if there was no XML payload.
128 129 130 |
# File 'lib/authorize_net/xml_transaction.rb', line 128 def xml @xml end |
Instance Method Details
#has_response? ⇒ Boolean
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.
114 115 116 |
# File 'lib/authorize_net/xml_transaction.rb', line 114 def has_response? !@response.nil? end |
#run ⇒ Object
Submits the transaction to the gateway for processing. Returns a response object. If the transaction has already been run, it will return nil.
123 124 125 |
# File 'lib/authorize_net/xml_transaction.rb', line 123 def run make_request end |
#setOAuthOptions ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/authorize_net/xml_transaction.rb', line 88 def setOAuthOptions unless @options_OAuth.blank? @options_OAuth = @@option_defaults.merge(@options_OAuth) @verify_ssl = [:verify_ssl] @reference_id = [:reference_id] @gateway = case [:gateway].to_s when 'sandbox', 'test' Gateway::TEST when 'production', 'live' Gateway::LIVE else @gateway = [:gateway] [:gateway] end end end |