-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle document not found error in avatax during cancel (#1573)
* handle document not found error in avatax during cancel * use error parser * Add tests * return response to client
- Loading branch information
1 parent
badd1f5
commit 5f61e62
Showing
4 changed files
with
91 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"app-avatax": patch | ||
--- | ||
|
||
Add handling for error occurred due to missing document in AvaTax during cancel (voiding) |
27 changes: 27 additions & 0 deletions
27
apps/avatax/src/modules/avatax/order-cancelled/avatax-order-cancelled-adapter.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { describe, expect, it } from "vitest"; | ||
|
||
import { AvataxConfigMockGenerator } from "@/modules/avatax/avatax-config-mock-generator"; | ||
import { AvataxOrderCancelledAdapter } from "@/modules/avatax/order-cancelled/avatax-order-cancelled-adapter"; | ||
import { AvataxOrderCancelledPayloadTransformer } from "@/modules/avatax/order-cancelled/avatax-order-cancelled-payload-transformer"; | ||
|
||
describe("AvataxOrderCancelledAdapter", () => { | ||
it("Throws DocumentNotFoundError if Avatax returns DocumentNotFoundError from the response of transaction void", async () => { | ||
const adapter = new AvataxOrderCancelledAdapter( | ||
{ | ||
async voidTransaction() { | ||
throw { | ||
code: "EntityNotFoundError", | ||
details: [{}], | ||
}; | ||
}, | ||
}, | ||
new AvataxOrderCancelledPayloadTransformer(), | ||
); | ||
|
||
try { | ||
await adapter.send({ avataxId: "1" }, new AvataxConfigMockGenerator().generateAvataxConfig()); | ||
} catch (e) { | ||
return expect(e).toBeInstanceOf(AvataxOrderCancelledAdapter.DocumentNotFoundError); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters