Class: GimmeGimme::FakeCimServer::CaptureOnlyTransaction

Inherits:
Transaction
  • Object
show all
Defined in:
lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb

Instance Attribute Summary collapse

Attributes inherited from Transaction

#amount, #customer_payment_profile, #customer_profile, #customer_profile_id, #transactions

Instance Method Summary collapse

Methods inherited from Transaction

#card_number, create

Methods included from RequestParser

#at

Constructor Details

#initialize(customer_profiles, customer_payment_profiles, document, transactions) ⇒ CaptureOnlyTransaction

Returns a new instance of CaptureOnlyTransaction.



289
290
291
292
293
294
295
296
297
298
299
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 289

def initialize(customer_profiles, customer_payment_profiles, document, transactions)
  super
  @transaction_id = Sequencer.next_id
  @document = document
  @authorize_transaction =
    transactions.detect do |transaction|
      transaction.customer_payment_profile == customer_payment_profile &&
        transaction.amount == amount &&
        transaction.authorization_code.to_s == authorization_code.to_s
    end
end

Instance Attribute Details

#transaction_idObject

Returns the value of attribute transaction_id.



287
288
289
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 287

def transaction_id
  @transaction_id
end

Instance Method Details

#authorization_codeObject



313
314
315
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 313

def authorization_code
  at("approvalCode")
end

#extra_response_optsObject



301
302
303
304
305
306
307
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 301

def extra_response_opts
  success = success? ? 1 : 0
  {
    :directResponse => "#{success},,,,,,#{@transaction_id},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
  }
  #{:direct_response => { :transaction_id => @transaction_id} }
end

#success?Boolean

Returns:

  • (Boolean)


309
310
311
# File 'lib/generators/gimme_gimme/test_support/templates/testing/fake_cim_server.rb', line 309

def success?
  super && !@authorize_transaction.nil?
end