Class: Payments::CollectWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/workers/payments/collect_worker.rb

Instance Method Summary collapse

Instance Method Details

#perform(collection_id) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/workers/payments/collect_worker.rb', line 7

def perform(collection_id)
  collection = Collection.find(collection_id)

  response = RestClient.post "#{Terminal.config.host}/collections",
    :terminal => Terminal.config.keyword,
    :collection => {
      :banknotes => collection.banknotes,
      :collected_at => collection.created_at,
      :session_ids => collection.payment_ids
    }

  collection.update_attribute(:reported_at, DateTime.now)
end