Package.json file
{
"name": "medusa-starter-default",
"version": "0.0.5",
"description": "A starter for Medusa projects.",
"author": "Medusa (https://medusajs.com)",
"license": "MIT",
"keywords": [
"sqlite",
"postgres",
"typescript",
"ecommerce",
"headless",
"medusa"
],
"scripts": {
"build": "medusa build",
"predeploy": "medusa db:migrate",
"seed": "medusa exec ./src/scripts/seed.ts",
"start": "NODE_OPTIONS='-r newrelic' medusa start",
"dev": "medusa develop",
"test": "npm run test:unit && npm run test:integration",
"test:unit": "NODE_OPTIONS=--experimental-vm-modules jest --forceExit --detectOpenHandles ./tests/unit",
"test:integration": "NODE_OPTIONS=--experimental-vm-modules jest --forceExit --detectOpenHandles ./tests/integration",
"generate:openapi": "node scripts/generate-openapi.js"
},
"dependencies": {
"@amazonpay/amazon-pay-api-sdk-nodejs": "^2.3.1",
"@aws-sdk/client-sns": "^3.782.0",
"@medusajs/admin-sdk": "2.8.4",
"@medusajs/cli": "2.8.4",
"@medusajs/framework": "2.8.4",
"@medusajs/medusa": "2.8.4",
"@mikro-orm/core": "6.4.3",
"@mikro-orm/knex": "6.4.3",
"@mikro-orm/migrations": "6.4.3",
"@mikro-orm/postgresql": "6.4.3",
"@opentelemetry/auto-instrumentations-node": "^0.57.0",
"@opentelemetry/exporter-prometheus": "^0.200.0",
"@opentelemetry/instrumentation-pg": "^0.52.0",
"@opentelemetry/resources": "^2.0.0",
"@opentelemetry/sdk-node": "^0.200.0",
"@opentelemetry/sdk-trace-node": "^2.0.0",
"awilix": "^8.0.1",
"moment": "^2.30.1",
"newrelic": "^12.16.1",
"pg": "^8.13.0",
"prom-client": "^15.1.3",
"whatwg-fetch": "^3.6.20"
},
"devDependencies": {
"@medusajs/test-utils": "2.8.4",
"@mikro-orm/cli": "6.4.3",
"@openapitools/openapi-generator-cli": "2.16.3",
"@swc/core": "1.5.7",
"@swc/jest": "^0.2.37",
"@types/jest": "^29.5.14",
"@types/newrelic": "^9.14.8",
"@types/node": "^20.0.0",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.2.25",
"aws-sdk-client-mock": "^4.1.0",
"jest": "^29.7.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"redis": "^5.0.1",
"swagger-jsdoc": "^6.2.8",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"vite": "^5.2.11",
"yalc": "^1.0.0-pre.53"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-musl": "4.34.8"
},
"engines": {
"node": ">=20"
}
}
Node.js version
v22.14.0
Database and its version
PostgreSQL 16.6
Operating system name and version
MacOS 15.5
Browser name
No response
What happended?
I'm implementing a custom tax provider, but the tax amounts that are being calculated are not being rounded.
When I calculate the taxes on my cart, I'm ending up with the following values:
{
...
"total": 15.8295,
"original_total": 15.8295,
"tax_total": 0.8295,
"original_tax_total": 0.8295,
...
}
The following ItemTaxCalculationLine and ItemTaxLineDTO are used to get the above result:
ItemTaxCalculationLine:
{
"id": "cali_01JKB9YACQGF5N42NN4KESY2YY",
"product_id": "prod_01JEEHXXE2AE4CJPST6MMFEVG6",
"product_type_id": null,
"quantity": 1,
"unit_price": 15,
"currency_code": "usd"
}
ItemTaxLineDTO:
{
"rate_id": "dummy_rate_id",
"rate": 5.53,
"name": "Dummy Tax",
"code": "DUMMY",
"line_item_id": "cali_01JKB9YACQGF5N42NN4KESY2YY",
"provider_id": "my-provider"
}
Is it expected that the total amounts and tax amounts are not rounded? Ideally, we would be able to set the tax amount directly instead of a rate similar to the ITaxCalculationStrategy in version 1.x. We have a third party tax provider that calculates the tax amount. If we can only set the rate then that leads to a potential issue where the amount calculated by our tax provider does not match the amount calculated by Medusa. Is there a plan to provide similar functionality for version 2.x?
Expected behavior
Rather than set a tax rate that is used to calculate the tax for a line item each time a cart or order is retrieved, it would be ideal to set the actual tax amount for a line item.
Actual behavior
The tax amounts are calculated based on the set rate when a cart is retrieved. The amounts are not rounded and do match the tax amounts returned by our tax provider.
Link to reproduction repo
N/A
Package.json file
{ "name": "medusa-starter-default", "version": "0.0.5", "description": "A starter for Medusa projects.", "author": "Medusa (https://medusajs.com)", "license": "MIT", "keywords": [ "sqlite", "postgres", "typescript", "ecommerce", "headless", "medusa" ], "scripts": { "build": "medusa build", "predeploy": "medusa db:migrate", "seed": "medusa exec ./src/scripts/seed.ts", "start": "NODE_OPTIONS='-r newrelic' medusa start", "dev": "medusa develop", "test": "npm run test:unit && npm run test:integration", "test:unit": "NODE_OPTIONS=--experimental-vm-modules jest --forceExit --detectOpenHandles ./tests/unit", "test:integration": "NODE_OPTIONS=--experimental-vm-modules jest --forceExit --detectOpenHandles ./tests/integration", "generate:openapi": "node scripts/generate-openapi.js" }, "dependencies": { "@amazonpay/amazon-pay-api-sdk-nodejs": "^2.3.1", "@aws-sdk/client-sns": "^3.782.0", "@medusajs/admin-sdk": "2.8.4", "@medusajs/cli": "2.8.4", "@medusajs/framework": "2.8.4", "@medusajs/medusa": "2.8.4", "@mikro-orm/core": "6.4.3", "@mikro-orm/knex": "6.4.3", "@mikro-orm/migrations": "6.4.3", "@mikro-orm/postgresql": "6.4.3", "@opentelemetry/auto-instrumentations-node": "^0.57.0", "@opentelemetry/exporter-prometheus": "^0.200.0", "@opentelemetry/instrumentation-pg": "^0.52.0", "@opentelemetry/resources": "^2.0.0", "@opentelemetry/sdk-node": "^0.200.0", "@opentelemetry/sdk-trace-node": "^2.0.0", "awilix": "^8.0.1", "moment": "^2.30.1", "newrelic": "^12.16.1", "pg": "^8.13.0", "prom-client": "^15.1.3", "whatwg-fetch": "^3.6.20" }, "devDependencies": { "@medusajs/test-utils": "2.8.4", "@mikro-orm/cli": "6.4.3", "@openapitools/openapi-generator-cli": "2.16.3", "@swc/core": "1.5.7", "@swc/jest": "^0.2.37", "@types/jest": "^29.5.14", "@types/newrelic": "^9.14.8", "@types/node": "^20.0.0", "@types/react": "^18.3.2", "@types/react-dom": "^18.2.25", "aws-sdk-client-mock": "^4.1.0", "jest": "^29.7.0", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", "redis": "^5.0.1", "swagger-jsdoc": "^6.2.8", "ts-node": "^10.9.2", "typescript": "^5.6.2", "vite": "^5.2.11", "yalc": "^1.0.0-pre.53" }, "optionalDependencies": { "@rollup/rollup-linux-x64-musl": "4.34.8" }, "engines": { "node": ">=20" } }Node.js version
v22.14.0
Database and its version
PostgreSQL 16.6
Operating system name and version
MacOS 15.5
Browser name
No response
What happended?
I'm implementing a custom tax provider, but the tax amounts that are being calculated are not being rounded.
When I calculate the taxes on my cart, I'm ending up with the following values:
The following
ItemTaxCalculationLineandItemTaxLineDTOare used to get the above result:ItemTaxCalculationLine:
ItemTaxLineDTO:
Is it expected that the total amounts and tax amounts are not rounded? Ideally, we would be able to set the tax amount directly instead of a rate similar to the ITaxCalculationStrategy in version 1.x. We have a third party tax provider that calculates the tax amount. If we can only set the rate then that leads to a potential issue where the amount calculated by our tax provider does not match the amount calculated by Medusa. Is there a plan to provide similar functionality for version 2.x?
Expected behavior
Rather than set a tax rate that is used to calculate the tax for a line item each time a cart or order is retrieved, it would be ideal to set the actual tax amount for a line item.
Actual behavior
The tax amounts are calculated based on the set rate when a cart is retrieved. The amounts are not rounded and do match the tax amounts returned by our tax provider.
Link to reproduction repo
N/A