Class: SuperGood::SolidusTaxjar::ReplaceTransactionJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/super_good/solidus_taxjar/replace_transaction_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(order) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/jobs/super_good/solidus_taxjar/replace_transaction_job.rb', line 8

def perform(order)
  order_transaction = SuperGood::SolidusTaxjar.reporting.refund_and_create_new_transaction(order)

  SuperGood::SolidusTaxjar::TransactionSyncLog.create!(
    order: order,
    order_transaction: order_transaction,
    status: :success
  )

rescue Taxjar::Error => exception
  SuperGood::SolidusTaxjar::TransactionSyncLog.create!(
    order: order,
    status: :error,
    error_message: exception.message
  )
end