Sha256: 1221e6dac7c23674a433455bbfa45f2e424612fcd8ca648d9eab6bf2a7910e52

Contents?: true

Size: 889 Bytes

Versions: 11

Compression:

Stored size: 889 Bytes

Contents

module ErpTxnsAndAccts
	module DelayedJobs
		class PaymentGatewayJob
		  def self.start(financial_txn, gateway, gateway_action, gateway_options, credit_card)
			job_object = ErpTxnsAndAccts::DelayedJobs::PaymentGatewayJob.new(financial_txn.id, gateway.name.to_s, gateway_action, gateway_options, credit_card)
			Delayed::Job.enqueue(job_object, 50, 1.seconds.from_now)
		  end

		  def initialize(financial_txn_id, gateway_klass, gateway_action, gateway_options, credit_card)
			@financial_txn_id = financial_txn_id
			@gateway_klass    = gateway_klass
			@gateway_action   = gateway_action
			@gateway_options  = gateway_options
			@credit_card      = credit_card
		  end

		  def perform
			gateway = @gateway_klass.constantize
			financial_txn = FinancialTxn.find(@financial_txn_id)
			financial_txn.send(@gateway_action, @credit_card, gateway, @gateway_options)
		  end
		end
	end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
erp_txns_and_accts-4.2.0 lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
erp_txns_and_accts-4.0.0 lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
erp_txns_and_accts-3.1.1 lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
erp_txns_and_accts-3.0.6 lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
erp_txns_and_accts-3.1.0 lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
erp_txns_and_accts-3.0.5 lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
erp_txns_and_accts-3.0.4 lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
erp_txns_and_accts-3.0.3 lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
erp_txns_and_accts-3.0.2 lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
erp_txns_and_accts-3.0.1 lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
erp_txns_and_accts-3.0.0 lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb