fix: ensures no duplicate tax lines when completing cart (#1262)

* fix: ensures that no duplicate tax lines are created when completing cart
This commit is contained in:
Sebastian Rindom authored and GitHub committed 2022-04-05 21:25:48 +02:00
1 parent 497e9b3f7d
commit 607a382b4e
9 files changed
+269 -16

No files matched your search

+13 -3
View File
@@ -158,12 +158,18 @@ class BaseService {
* @param {string} isolation - the isolation level to be used for the work.
* @return {any} the result of the transactional work
*/
async atomicPhase_(work, isolationOrErrorHandler, maybeErrorHandler) {
let errorHandler = maybeErrorHandler
async atomicPhase_(
work,
isolationOrErrorHandler,
maybeErrorHandlerOrDontFail
) {
let errorHandler = maybeErrorHandlerOrDontFail
let isolation = isolationOrErrorHandler
let dontFail = false
if (typeof isolationOrErrorHandler === "function") {
isolation = null
errorHandler = isolationOrErrorHandler
dontFail = !!maybeErrorHandlerOrDontFail
}
if (this.transactionManager_) {
@@ -226,8 +232,12 @@ class BaseService {
return result
} catch (error) {
if (errorHandler) {
await errorHandler(error)
const result = await errorHandler(error)
if (dontFail) {
return result
}
}
throw error
}
}