fix(medusa-plugin-brightpearl): stacking reservations (#4383)

**What**
- Change the way we create reservations in brightpearl

Previously we would create reservations 1 to 1 from medusa to brightpearl. This causes issues due to brightpearl collapsing reservations causing occasional double reservations. 
i.e. this update would allocate 4 stock for the order row
```
{
	"products": [
		{
			"productId": "2713",
			"salesOrderRowId": "224688",
			"quantity": "2"
		},
		{
			"productId": "2713",
			"salesOrderRowId": "224688",
			"quantity": "2"
		}
	]
}
```

Instead what we do now is create the rows with reservation quantity based on total quantity reserved in medusa. This means that a reservation creation acts as a trigger to update the reservation in brightpearl, but not with any specific amount. Instead we calculate how much total is reserved and create that in brightpearl.
This commit is contained in:
Philip Korsholm
2023-07-19 07:38:29 +00:00
committed by GitHub
parent 3e6cee2846
commit 1304657133
2 changed files with 62 additions and 18 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"medusa-plugin-brightpearl": patch
---
fix(medusa-plugin-brightpearl): change the way reservations are handled