### 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
Integration-tests
To be able to run the integration tests on your local machine, run the following commands (adapted to your machine)
cd [ROOT_OF_YOUR_REPO]
medusa-dev -p [YOUR_ABSOLUTE_PATH_TO_THE_REPO]
npm run bootstrap
cd integration-tests/api
medusa-dev -s
npm run build
cd - && npm run test:integration