feat(core-flows,dashboard,js-sdk,medusa,types): support Fulfillment Options (#10622)

**What**
- add a list point for fetching fulfillment options for a provider
- add FO support on SO create & update on dashboard
- pass `cart` and `stockLocation` to `validateFufillmentData` context

---

CLOSES CMRC-789
CLOSES CMRC-790
This commit is contained in:
Frane Polić
2024-12-18 10:16:26 +01:00
committed by GitHub
parent f3eca7734e
commit bde4b82194
20 changed files with 1850 additions and 487 deletions

View File

@@ -0,0 +1,27 @@
import {
AdminFulfillmentProviderOption,
HttpTypes,
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/framework/http"
export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.AdminFulfillmentProviderOptionsListResponse>
) => {
const fulfillmentProviderService = req.scope.resolve(Modules.FULFILLMENT)
const fulfillmentOptions =
await fulfillmentProviderService.retrieveFulfillmentOptions(req.params.id)
res.json({
fulfillment_options:
fulfillmentOptions as unknown as AdminFulfillmentProviderOption[],
count: fulfillmentOptions.length,
limit: fulfillmentOptions.length,
offset: 0,
})
}

View File

@@ -20,4 +20,9 @@ export const adminFulfillmentProvidersRoutesMiddlewares: MiddlewareRoute[] = [
}),
],
},
{
method: ["GET"],
matcher: "/admin/fulfillment-providers/:id/options",
middlewares: [],
},
]