Class: Delivery232DeclarationWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/workers/delivery_232_declaration_worker.rb

Overview

Generates the Section 232 declaration (xlsm + PDF) for a delivery as soon as
the order reaches awaiting_deliveries, so operations can review it days
before pickup instead of discovering problems at the border. Line items are
immutable after that transition (any material change requires a CR HOLD,
which re-fires the transition and regenerates), so the declaration is final
when created here. DeliveryPostLabelWorker only backfills a missing one.

Instance Method Summary collapse

Instance Method Details

#perform(delivery_id) ⇒ Object

Runs the job.

Parameters:

  • delivery_id (Integer)

    the delivery id

Returns:

  • (Object)

    the result



18
19
20
21
22
23
# File 'app/workers/delivery_232_declaration_worker.rb', line 18

def perform(delivery_id)
  delivery = Delivery.find_by(id: delivery_id)
  return unless delivery

  delivery.generate_declaration_232_forms
end