fix(medusa): Incorrect swap difference due (#2086)
### What Creating a swap on an order with a discount leads to an incorrect difference due. **Scenario** - Create a store with minimum 2 products (Prod A, Prod B) - Create a discount that only works for Prod A - Create an order for Prod A with the discount applied - Create a swap between Prod A and Prod B **Expected outcome** We would expect the difference_due amount to come out to the sum of: - -1 * (price of prod a - discount applied to prod a) - price of prod b **Actual outcome** Instead the discount is applied across both products when calculating difference due. This results in a total that is instead the sum of: - -1 * (price of prod a - discount applied to prod a) - price of prod b - discount on prod b ignoring the condition ### How Adds `line_item.adjustments` to relations in cart retrieval prior to setting the difference_due to car total Fixes CORE-361
This commit is contained in:
@@ -30,6 +30,7 @@ describe("Order Totals", () => {
|
||||
medusaProcess = await setupServer({ cwd })
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
throw error
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user