avadev/AvaTax-REST-V2-JS-SDK

`voidTransaction` always throws when deleting a transaction even though it successfully deletes it

BioSurienDG opened this issue · 1 comments

When I try to delete an uncommitted transaction this code always throws an error (even though the transaction gets successfully deleted). The error that is thrown indicates that no transaction was found. This probably is because it tries to return the transaction that no longer exists. The correct behaviour based on the typescript definitions should be to return what the transaction looked like before it was deleted (if you don't intend to do that then this should at least return void (when deleting) otherwise it is hard to differentiate between actual errors and ones caused by this bug).

   await avatax.voidTransaction({
             transactionCode: invoice.code,
             model: {
                  // For descriptions of the codes see:
                  // https://developer.avalara.com/erp-integration-guide/sales-tax-badge/transactions/voiding-documents/
                  code: VoidReasonCode.DocDeleted,
   },
  })

@BioSurienDG I am able to replicate the behavior. This is not an SDK issue so to speak, I think its an issue with the API itself throwing an error when really it should either be successful and return the transaction, or completely error out and not delete any document. Could you create an Avatax support issue with this question instead of under the SDK and someone will be able to assist you?