Class: SpreeCmCommissioner::QueueDraftOrders::ProcessJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/spree_cm_commissioner/queue_draft_orders/process_job.rb

Overview

Thin trigger for QueueDraftOrders::Process — owns only the locale wrapping (so any user-facing message the create call surfaces renders in the request's original locale, not the job worker's default), not the order-creation/Firestore-publishing logic itself.

Instance Method Summary collapse

Methods included from ApplicationJobDecorator

handle_deserialization_error, prepended

Instance Method Details

#perform(document_path, create_type, creation_params, locale = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'app/jobs/spree_cm_commissioner/queue_draft_orders/process_job.rb', line 14

def perform(document_path, create_type, creation_params, locale = nil)
  I18n.with_locale(locale.presence || I18n.default_locale) do
    # Current doesn't cross into the job, so restore the load-test-bypass flag here — otherwise
    # ValidateLimits would reject a trusted load test.
    SpreeCmCommissioner::Current.set(load_test_bypass: creation_params.dig(:options, :load_test_bypass) || false) do
      SpreeCmCommissioner::QueueDraftOrders::Process.call(
        document_path: document_path, create_type: create_type, creation_params: creation_params
      )
    end
  end
end