Method: AuthorizeNet::AIM::Transaction#initialize

Defined in:
lib/authorize_net/aim/transaction.rb

#initialize(api_login_id, api_transaction_key, options = {}) ⇒ Transaction

Constructs an AIM transaction. You can use the new AIM transaction object to issue a request to the payment gateway and parse the response into a new AuthorizeNet::AIM::Response object.

api_login_id

Your API login ID, as a string.

api_transaction_key

Your API transaction key, as a string.

options

A hash of options. See below for values.

Options

transaction_type

The type of transaction to perform. Defaults to AuthorizeNet::Type::AUTHORIZE_AND_CAPTURE. This value is only used if run is called directly.

gateway

The gateway to submit the transaction to. Can be a URL string, an AuthorizeNet::AIM::Transaction::Gateway constant, or one of the convenience symbols :sandbox, :test, :card_present_test, :card_present_live, :card_present_sandbox, :card_present_production, :production, or :live (:test is an alias for :sandbox, :card_present_test is an alias for :card_present_sandbox, :card_present_production is an alias for :card_present_live, and :live is an alias for :production).

test

A boolean indicating if the transaction should be run in test mode or not (defaults to false).

allow_split

A boolean indicating if split transactions should be allowed (defaults to false).

delimiter

A single character (as a string) that will be used to delimit the response from the gateway. Defaults to ‘,’.

encapsulation_character

A single character (as a string) that will be used to encapsulate each field in the response from the gateway. Defaults to nil.

verify_ssl

A boolean indicating if the SSL certificate of the gateway should be verified. Defaults to false.

device_type

A constant from DeviceType indicating the type of POS device used in a card present transaction. Defaults to DeviceType::UNKNOWN.

market_type

A constant from MarketType indicating your industry. Used for card present transactions. Defaults to MarketType::RETAIL.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/authorize_net/aim/transaction.rb', line 45

def initialize(, api_transaction_key, options = {})
  super()
  options = @@option_defaults.merge(options)
   = 
  @api_transaction_key = api_transaction_key
  @test_mode = options[:test]
  @response ||= nil
  @delimiter = options[:delimiter]
  @type = options[:transaction_type]
  @cp_version = nil
  case options[:gateway]
  when :sandbox, :test
    @gateway = Gateway::TEST
  when :production, :live
    @gateway = Gateway::LIVE
  when :card_present_live, :card_present_production
    @gateway = Gateway::CARD_PRESENT_LIVE
    @cp_version = '1.0'
  when :card_present_test, :card_present_sandbox
    @gateway = Gateway::CARD_PRESENT_TEST
    @cp_version = '1.0'
  else
    @gateway = options[:gateway]
  end
  @allow_split_transaction = options[:allow_split]
  @encapsulation_character = options[:encapsulation_character]
  @verify_ssl = options[:verify_ssl]
  @market_type = options[:market_type]
  @device_type = options[:device_type]
end