Closed nvandoorn closed 11 months ago
On order_recalculated, we report if the following conditions are met:
We should avoid making API calls to TaxJar when checking these conditions.
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
@Noah-Silvera @kchateau and I started on this here - https://github.com/SuperGoodSoft/solidus_taxjar/pull/246
@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
If an order's first sync to TaxJar fails, we may end up calling
replace_transaction
instead ofreport_transaction
which results in a no-op. We need a mechanism to retry syncing to TaxJar when the first sync fails.