Fix/adjust reservations correctly (#3474)

**What**
- Adjust reservations correctly according to the following heuristic: 

adjustment by addition:  (i.e. positive quantity adjustment passed to the adjustment method)
- if a reservation for the line-item in the location exists add quantity to that
- if not create a new reservation

adjustment by subtraction: 
- if a reservation with the exact quantity exists, delete it and return
- if a reservation with a greater quantity exists, subtract from it and return 
- otherwise delete from reservations until a reservation with greater quantity than the remaining is found and adjust that with the remaining quantity OR there are no more reservations

Fixes CORE-1247
This commit is contained in:
Philip Korsholm
2023-03-16 10:47:54 +01:00
committed by GitHub
parent 38c8d49f46
commit 02c77d7059
9 changed files with 392 additions and 102 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa-js": patch
---
Fix(medusa): Adjust reservations correctly