Skip to content

Commit

Permalink
use isDefined
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p committed Oct 21, 2022
1 parent d8452c9 commit aa9c540
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/medusa/src/services/totals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ class TotalsService extends TransactionBaseService {
/*
* New tax system uses the tax lines registerd on the line items
*/
if (typeof lineItem.tax_lines === "undefined") {
if (!isDefined(lineItem.tax_lines)) {
throw new MedusaError(
MedusaError.Types.UNEXPECTED_STATE,
"Tax calculation did not receive tax_lines"
Expand Down Expand Up @@ -834,7 +834,7 @@ class TotalsService extends TransactionBaseService {
* items we have to get the line items from the tax provider.
*/
if (options.use_tax_lines || isOrder(cartOrOrder)) {
if (typeof lineItem.tax_lines === "undefined") {
if (!isDefined(lineItem.tax_lines)) {
throw new MedusaError(
MedusaError.Types.UNEXPECTED_STATE,
"Tax Lines must be joined on items to calculate taxes"
Expand All @@ -844,7 +844,7 @@ class TotalsService extends TransactionBaseService {
taxLines = lineItem.tax_lines
} else {
if (lineItem.is_return) {
if (typeof lineItem.tax_lines === "undefined") {
if (!isDefined(lineItem.tax_lines)) {
throw new MedusaError(
MedusaError.Types.UNEXPECTED_STATE,
"Return Line Items must join tax lines"
Expand Down

0 comments on commit aa9c540

Please sign in to comment.