diff --git a/CHANGELOG.md b/CHANGELOG.md index cd371a3..c1413d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Add `tax` attribute to `Item` type +- Add `tax` attribute to `DeliveryOption` type and compute it by summing up all shipment taxes + ## [0.67.0] - 2024-02-27 ### Added diff --git a/graphql/types/Item.graphql b/graphql/types/Item.graphql index 4ee8ba5..893bc7d 100644 --- a/graphql/types/Item.graphql +++ b/graphql/types/Item.graphql @@ -44,6 +44,7 @@ type Item { sellingPriceWithAssemblies: Float skuName: String @translatableV2 skuSpecifications: [SKUSpecification!]! + tax: Float uniqueId: String! unitMultiplier: Float priceTags: [PriceTag!]! diff --git a/graphql/types/Shipping.graphql b/graphql/types/Shipping.graphql index 0c7e089..9cb74d6 100644 --- a/graphql/types/Shipping.graphql +++ b/graphql/types/Shipping.graphql @@ -11,6 +11,7 @@ type DeliveryOption { id: String! deliveryChannel: String! price: Int! + tax: Int estimate: String! isSelected: Boolean! } diff --git a/node/utils/delivery-options.ts b/node/utils/delivery-options.ts index d4147a6..5bace24 100644 --- a/node/utils/delivery-options.ts +++ b/node/utils/delivery-options.ts @@ -6,6 +6,7 @@ export function getFormattedDeliveryOptions( ) { return deliveryOptions.map(sla => { let price = 0 + let tax = 0 const isSelected = logisticsInfo?.some(li => li.selectedSla === sla.id) ?? false @@ -15,6 +16,7 @@ export function getFormattedDeliveryOptions( if (currentSla) { price += currentSla.price + tax += currentSla.tax } }) @@ -23,6 +25,7 @@ export function getFormattedDeliveryOptions( id: sla.id, isSelected, price, + tax, deliveryChannel: sla.deliveryChannel, sla, ...(sla.deliveryChannel === PICKUP_IN_POINT