Skip to content

Commit

Permalink
fix: adds amount total resilience
Browse files Browse the repository at this point in the history
  • Loading branch information
JoFont committed Nov 30, 2023
1 parent f3faff9 commit 979cf90
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,12 @@ export const computeAggregatedAndPriceTotals = (priceItems: PriceItemsDto): Pric
{
...compositePriceItemToAppend,
...itemBreakdown,
amount_subtotal_decimal: d(itemBreakdown!.amount_subtotal!).toUnit().toString(),
amount_total_decimal: d(itemBreakdown!.amount_total!).toUnit().toString(),
...(itemBreakdown?.amount_subtotal && {
amount_subtotal_decimal: d(itemBreakdown.amount_subtotal).toUnit().toString(),
}),
...(itemBreakdown?.amount_total && {
amount_total_decimal: d(itemBreakdown.amount_total).toUnit().toString(),
}),
item_components: convertPriceComponentsPrecision(compositePriceItemToAppend.item_components!, 2),
},
],
Expand Down

0 comments on commit 979cf90

Please sign in to comment.