SuperGoodSoft / solidus_taxjar

Support for using TaxJar to handle tax calculations in Solidus
BSD 3-Clause "New" or "Revised" License
12 stars 12 forks source link

Orders will not be re-synced to TaxJar if first sync fails #223

Closed nvandoorn closed 11 months ago

nvandoorn commented 1 year ago

If an order's first sync to TaxJar fails, we may end up calling replace_transaction instead of report_transaction which results in a no-op. We need a mechanism to retry syncing to TaxJar when the first sync fails.

nvandoorn commented 1 year ago

On order_recalculated, we report if the following conditions are met:

We should avoid making API calls to TaxJar when checking these conditions.

Noah-Silvera commented 1 year ago

This PR #244 resolves part of this problem!

But we also need to include the logic @benjaminwil introduced here in the order_recalculated event of the subscriber. This will allow orders to automatically be correctly reported if their first report failed and the order get's recalculated, instead of replace_transaction being called as described in this ticket.

cc: @forkata @nvandoorn

forkata commented 1 year ago

@Noah-Silvera @kchateau and I started on this here - https://github.com/SuperGoodSoft/solidus_taxjar/pull/246

forkata commented 1 year ago

@kchateau and I did some more work on trying to address the issue with replacing transactions for orders that failed to be reported initially, but hit a bit of a snag. Because on shipment.ship! the order is recalculated we get both events( shipment_shipped and order_recalculated). Our initial attempt to fix this was unsuccessful. We may need to check for sync errors and only then allow the transaction to be reported during an order_recalculated event as part of the ReplaceTransactionJob. We have updated the PR with the work so far and a failing test for the issue we hit - https://github.com/SuperGoodSoft/solidus_taxjar/pull/246