feat: Create cart with line items (#6449)

**What**
- Add support for creating a cart with items
- Add endpoint `POST /store/carts/:id/line-items`
- Add `CreateCartWorkflow`
- Add `AddToCartWorkflow`
- Add steps for both workflows

**Testing**
- Endpoints
- Workflows

I would still call this a first iteration, as we are missing a few pieces of the full flow, such as payment sessions, discounts, and taxes.

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
Oli Juhl
2024-02-26 14:32:16 +01:00
committed by GitHub
parent ac86362e81
commit 7ebe885ec9
26 changed files with 1100 additions and 157 deletions

View File

@@ -2,10 +2,10 @@ import { useApi } from "../../../environment-helpers/use-api"
import { initDb, useDb } from "../../../environment-helpers/use-db"
import {
StepResponse,
WorkflowData,
createStep,
createWorkflow,
StepResponse,
WorkflowData,
} from "@medusajs/workflows-sdk"
import { AxiosInstance } from "axios"
import path from "path"
@@ -200,9 +200,9 @@ export const workflowEngineTestSuite = (env, extraParams = {}) => {
data: expect.objectContaining({
invoke: {
"my-step": {
__type: "WorkflowWorkflowData",
__type: "Symbol(WorkflowWorkflowData)",
output: {
__type: "WorkflowStepResponse",
__type: "Symbol(WorkflowStepResponse)",
output: {
result: "abc",
},
@@ -248,7 +248,7 @@ export const workflowEngineTestSuite = (env, extraParams = {}) => {
data: expect.objectContaining({
invoke: expect.objectContaining({
"my-step-async": {
__type: "WorkflowStepResponse",
__type: "Symbol(WorkflowStepResponse)",
output: {
all: "good",
},