Method: AuthorizeNet::SIM::Transaction#initialize
- Defined in:
- lib/authorize_net/sim/transaction.rb
#initialize(api_login_id, api_transaction_key, amount, options = {}) ⇒ Transaction
Constructs a SIM transaction. You can use the new SIM transaction object to build the hidden field payload needed to process a SIM transaction with the gateway. In particular, this class handles generating the MD5 fingerprint used to authenticate transactions at the gateway. Since the fingerprint includes the amount to charge, you should not construct this object until you know EXACTLY how much you want to charge (or authorize).
api_login_id-
Your API login ID, as a string.
api_transaction_key-
Your API transaction key, as a string.
amount-
The amount of the transaction, as a string, Float or BigDecimal.
options-
A hash of options. See below for values.
Options
sequence-
The sequence number of the transaction as a string or Fixnum. This is usually something like an invoice number. If none is provided, the SDK generates one at random.
timestamp-
The time the transaction was initiated as a string or Fixnum. This needs to be within 15 minutes of when the gateway receives the transaction. If no value is provided, the SDK defaults it to Time.now().
test-
A boolean indicating if the transaction should be run in test mode or not (defaults to false).
hosted_payment_form-
A boolean indicating if the transaction should use a hosted payment form (defaults to false).
relay_response-
A boolean indicating if the transaction should use the relay response feature to return a receipt to the customer (defaults to true). Direct Post Method requires using a relay response.
relay_url-
A string of the URL that the gateway should hit to get the relay response (defaults to nil).
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.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/authorize_net/sim/transaction.rb', line 44 def initialize(api_login_id, api_transaction_key, amount, = {}) super() @api_transaction_key = api_transaction_key @api_login_id = api_login_id @amount = decimal_to_value(amount) = @@option_defaults.merge() @sequence = [:sequence] @timestamp = [:timestamp] @test_mode = [:test] @hosted_payment_form = [:hosted_payment_form] @relay_url = [:relay_url] @type = [:transaction_type] unless @relay_url.nil? @relay_response = true else @relay_response = !![:relay_response] end @delim_data = !@relay_response end |