SuperGoodSoft/solidus_taxjar

Report error message to user when transaction syncing fails

Closed this issue ยท 6 comments

Currently, if a user ships an order and reporting the transaction for the order fails, it will just silently fail in the background and be logged. We should report an error message in some way to the user (through a flash message or other means) so they are aware that the order was not reported to TaxJar and it doesn't get lost in the logs.

This one is kindof tricky as we run the taxjar reporting in a background job so a failure to report doesn't stop the order from being shipped

I'm thinking of adding some sort of status to the order to indicate whether it has been reported to taxjar

i.e. something like

Screen Shot 2022-08-12 at 13 02 56PDT
Screen Shot 2022-08-12 at 13 02 30PDT

If we used the SuperGood::SolidusTaxjar::TransactionSyncLog model to track the transaction reporting, we could pull the "processing", "failed", and "completed_at" from.

The user could then use the backfill feature to fix the failure, or manually report it to taxjar. The backfill feature would only work if the order has never been reported to taxjar, i.e. not an item cancellation.

I haven't gotten as far in thinking of how failures to replace transactions i.e. cancelling items from an order, would be displayed! But maybe we could just display a generic "Failed" for now regardless, and log them with the TransactionSyncLog, and let the user figure out how to re-sync them.

cc: @nvandoorn @forkata Just looking for thoughts/opinions before I dive into this potential solution!

If we used the SuperGood::SolidusTaxjar::TransactionSyncLog model to track the transaction reporting, we could pull the "processing", "failed", and "completed_at" from.

I like this approach because we have a field to record the error so we can potentially surface that in the admin in a tooltip of some sort next to the Failed text.

The user could then use the backfill feature to fix the failure, or manually report it to taxjar. The backfill feature would only work if the order has never been reported to taxjar, i.e. not an item cancellation.

Two options I can think of here

  1. We discussed adding search options to the batching interface, we could allow searching by order number and in those cases allow reporting of transactions that have already been reportd. We would have to know how to handle the already reported transaction - i.e. refund first etc. so this can get a bit complicated.

  2. We could add a "Retry" action or something like that for taxjar re-sync'ing on the order edit page, but really any failure would most likely require some manual intervention, so I am not sure how often this would be used. I imagine for any retry-able failures we could also rely on the ActiveJob/Sidekiq retry.

I am curious is this issue in scope for certification or is it mostly meant to improve the user experience?

It looks like magento shows a non-trivial UI with the sync status, so we should do the same

Let's try and take advantage of the transaction sync batch pages

Let's just ignore adding an ease of use "Retry" button and stuff for now