Skip to content

Commit

Permalink
Merge pull request #455 from vtex-apps/fix/tax-for-price-0
Browse files Browse the repository at this point in the history
Fix error when Price is null
  • Loading branch information
thalytafabrine authored Apr 24, 2023
2 parents 29b724a + 6796646 commit b6f7f4d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed
- Error with `taxPercentage` when Price is `null`.

## [1.65.0] - 2023-04-18

## [1.64.2] - 2023-03-16
Expand Down
4 changes: 4 additions & 0 deletions node/resolvers/search/offer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ export const resolvers = {
return spotPrice || sellingPrice
},
taxPercentage: (offer: CommertialOffer) => {
if (!offer.Price) {
return 0
}

return offer.Tax / offer.Price
}
},
Expand Down
2 changes: 1 addition & 1 deletion node/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4668,7 +4668,7 @@ static-extend@^0.1.1:
define-property "^0.2.5"
object-copy "^0.1.0"

"stats-lite@github:vtex/node-stats-lite#dist":
stats-lite@vtex/node-stats-lite#dist:
version "2.2.0"
resolved "https://codeload.github.com/vtex/node-stats-lite/tar.gz/1b0d39cc41ef7aaecfd541191f877887a2044797"
dependencies:
Expand Down

0 comments on commit b6f7f4d

Please sign in to comment.