Class: Invoice::TaxjarSubmissionHandler

Inherits:
ApplicationJob
  • Object
show all
Includes:
RailsEventStore::AsyncHandler
Defined in:
app/subscribers/invoice/taxjar_submission_handler.rb

Overview

RailsEventStore async subscriber that runs
Models::TaxjarSubmittable#evaluate_taxjar_submission on a freshly-
created Invoice, which decides whether to submit / mark exempt
based on shipping state and CI/marketplace flags.

Instance Method Summary collapse

Instance Method Details

#perform(event) ⇒ void

This method returns an undefined value.

Parameters:



13
14
15
16
17
18
19
20
21
# File 'app/subscribers/invoice/taxjar_submission_handler.rb', line 13

def perform(event)
  invoice = Invoice.find_by(id: event.data[:invoice_id])
  return unless invoice

  invoice.evaluate_taxjar_submission
rescue StandardError => e
  ErrorReporting.error(e)
  raise
end