fix(medusa-plugin-brightpearl): account for shipping prices being tax inclusive (#2536)

**What**
BP plugin was recording total shipping price based on the shipping_method.price; however, this value may be with or without taxes depending on the tax inclusivity setting. This change ensures that the shipping price is calculated correctly.
This commit is contained in:
Sebastian Rindom
2022-11-03 15:22:49 +00:00
committed by GitHub
parent 2e553ce42a
commit 61da5f3650
3 changed files with 10 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"medusa-plugin-brightpearl": patch
---
fix(medusa-plugin-brightpearl): account for shipping prices being tax inclusive
@@ -25,6 +25,7 @@ const order = {
{
name: "standard",
price: 12399,
subtotal: 12399,
},
],
payment_method: {
@@ -66,6 +67,7 @@ const krwOrder = {
{
name: "standard",
price: 12399,
subtotal: 12399,
},
],
payment_method: {
@@ -109,6 +111,7 @@ const roundingOrder = {
{
name: "standard",
price: 0,
subtotal: 0,
},
],
discounts: [
@@ -159,6 +162,7 @@ const TotalsService = {
getShippingMethodTotals: () => {
return {
price: 0,
subtotal: 0,
discount_total: 0,
tax_total: 0,
}
@@ -994,7 +994,7 @@ class BrightpearlService extends BaseService {
}
)
return {
price: accum.price + totals.price,
price: accum.price + totals.subtotal,
tax: accum.tax + totals.tax_total,
}
}, Promise.resolve({ price: 0, tax: 0 }))