fix: enforce 1 shipping method per profile (#322)

prevents the scenario where multiple concurrent calls to insert a shipping method may lead to an inconsistent cart state with more than 1 shipping method per profile.
This commit is contained in:
Zakaria El Asri
2021-07-23 11:26:20 +01:00
committed by GitHub
parent 8c26a5fd88
commit b378a4f8bc
3 changed files with 71 additions and 1 deletions

View File

@@ -100,6 +100,17 @@ module.exports = async (connection, data = {}) => {
data: {},
});
await manager.insert(ShippingOption, {
id: "test-option-2",
name: "test-option-2",
provider_id: "test-ful",
region_id: "test-region",
profile_id: defaultProfile.id,
price_type: "flat_rate",
amount: 500,
data: {},
});
const cart = manager.create(Cart, {
id: "test-cart",
customer_id: "some-customer",