### 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
**What**
Naive fix to allow carts with 100% discount to be completed.
**Why**
Discount total is wrongly calculated if `items` and `items.adjustments` is not included in relations upon retrieving the cart.
**Thought**
This is yet another example of why we need to rethink and refactor totals computation to not depend on what is provided by the user.
**What**
Simplify the transaction base service.
**How**
In fact, it does not need to be template and reduce the extensibility as the type is internally enforce. Now, the type is deduced by this which can be any derived class.
* feat(medusa): Migrate the idempotency key service to ts + fix
* feat(medusa): Finalise idempotency migration
* Create late-owls-pump.md
* feat(medusa): Polish
* feat(medusa): Add case to the error handler
* feat(medusa): Add case to the error handler
Co-authored-by: olivermrbl <oliver@mrbltech.com>
**What**
Wrap all actions that require the usage of an atomic phase into a transaction from the handler
**Info**
The following end points have been removed since that they rely on non existing stuff and can't be used and are not used
admin - create-order
admin - delete order metadata
admin - set region metadata
admin - remove region metadata
Fixes CORE-358
* feat(medusa): Migrate and fix order service
* fix(medusa): Order service pass Payment instead of the session:
* fix(medusa): Remove unnecessary method in the client library
* test(medusa): Fix unit tests
* test(medusa): Fix unit tests
* fix(medusa): Typo
* test(meduas): fix unit test
* feat(medusa): Update base service used and missing transaction
* test(meduas): fix unit test
* fix(medusa): cleanup and missing transaction
* fix(medusa): missing withTransaction on some mocks
* feat(medusa): Update order service method visibility
* include feedback
* feat(medusa); revert order payment status"
* test(medusa): fix unit
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
* feat(medusa): Allow to create/update object sales channels assignment
* feat(medusa): cleanup
* feat(medusa): Update oas
* feat(medusa): Only add relation if required
* feat(medusa): Add feature flag decorators
* style(medusa): PR feedback
* feat(medusa): Remove circular by moving sales channel product existence check to the repo layer
* feat(medusa): Reduce selected column as they are not necessary
* feat(medusa): Refactor repository and usage
* feat(medusa): Improve entity name formatting
* feat(medusa): Add feature flag to the service
* fix(medusa): typo
* test(medusa): fix unit tests
* feat(medusa): include feedback
* feat(medusa): Adds validator pipe for Sales Channel existence (#1930)
* feat(medusa): Allow to create/update object sales channels assignment
* feat(medusa): cleanup
* feat(medusa): Update oas
* feat(medusa): Only add relation if required
* feat(medusa): Add feature flag decorators
* style(medusa): PR feedback
* feat(medusa): Remove circular by moving sales channel product existence check to the repo layer
* feat(medusa): Reduce selected column as they are not necessary
* feat(medusa): Refactor repository and usage
* feat(medusa): Improve entity name formatting
* feat(medusa): Add feature flag to the service
* fix(medusa): typo
* test(medusa): fix unit tests
* feat(medusa): Adds validator pipe for Sales Channel existence
* feat: Move product payload classes to types file
* fix unit tests
* fix integration test
Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
* feat(medusa): Revert base repository and related
* feat(medusa): cleanup
* remove base repo export
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
* wip: validate line item SC
* fix: repository type, remove relation, use sc id, check if cart has associated sc
* feat: setup tests and seeder, change entity retrieval in cart service method
* feat: remove repo usage and method, use Adrien's method from product service to check sc association, add test cases, add seeder entities, accept flag for validating sc on the endpoint
* feat: add a unit test to ensure validation method is called if flag is passed
* feat: allow `validate_sales_channels` flag in other relevant endpoints
* fix: typo
* fix: flag rename
* fix: correct FF in test suites
* fix: address PR feedback
* fix: change error message
* feat: remove query params, guard with FF, refactor
* feat: guard validation in the service
* refactor: rename validation method
* refactor: reorganise tests
* wip: cleanup test file
* wip: revert cart seeder changes use factories
* fix: remove seeder, update mocks
* fix: method name
* fix: units, validate by default
* git: resolve merge conflicts
* refactor: separate line item sales chanel units
Co-authored-by: fPolic <frane@medusajs.com>