Class: Launchpad::IEO::SaleCancelWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/workers/launchpad/ieo/sale_cancel_worker.rb

Instance Method Summary collapse

Instance Method Details

#perform(sgid) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'app/workers/launchpad/ieo/sale_cancel_worker.rb', line 7

def perform(sgid)
  sale = GlobalID::Locator.locate_signed(sgid, for: 'sale_cancel')

  sale.cancel!
  Rails.logger.info { "Start #{sale.id} sale cancelling" }
rescue AASM::InvalidTransition => e
  # TODO: Improve logging using Tagged Logger.
  Rails.logger.error sale_id: sale.id,
                    message: 'Failed to cancel',
                    error: e.message
end