Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core-flows, dashboard, link-modules,medusa, types, utils): fulfillment shipping changes #10902

Merged
merged 54 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
22a4633
feat: product <> shipping profile link, add sp to create product flow
fPolic Jan 8, 2025
53f60aa
feat: product details sidebar, refactor sidebar link
fPolic Jan 9, 2025
97d4231
feat: edit form, wip update workflow + API
fPolic Jan 9, 2025
e0c4791
feat: update SP with product update
fPolic Jan 9, 2025
6e20cce
feat: require SP in the product create form
fPolic Jan 9, 2025
5216101
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 10, 2025
79bdc47
fix: optional param
fPolic Jan 10, 2025
27f2572
feat: initial script version
fPolic Jan 10, 2025
6ab1f6f
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 13, 2025
739e8de
fix: update i18n
fPolic Jan 13, 2025
ae2274c
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 13, 2025
f3ac8a5
chore: move script
fPolic Jan 15, 2025
60e63c4
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 15, 2025
4b5a10b
feat(dashboard, core-flows, medusa, types): select Shipping Option wh…
fPolic Jan 15, 2025
da68ead
fix: update schema
fPolic Jan 15, 2025
098181d
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 15, 2025
3251f0b
Merge branch 'develop' into feat/product-shipping-profile-link
olivermrbl Jan 15, 2025
6166a04
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 16, 2025
4bc995e
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 17, 2025
fd15a1d
fix: schema conflict
fPolic Jan 17, 2025
e429c75
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 17, 2025
80caa04
fix: script default profile
fPolic Jan 18, 2025
fc99be9
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 18, 2025
9ac8fc3
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 20, 2025
53e580d
chore: rm todo
fPolic Jan 20, 2025
d64fa18
feat: require shipping profile, wip fix specs
fPolic Jan 20, 2025
6dd0616
wip: more specs
fPolic Jan 20, 2025
ea24df4
wip: more specs
fPolic Jan 20, 2025
518d868
fix: finish spec updates
fPolic Jan 20, 2025
32c0c0d
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 20, 2025
a6d2901
fix: schema conflict
fPolic Jan 20, 2025
d52b1b6
fix: module cart tests
fPolic Jan 21, 2025
8448720
fix: rest of module tests
fPolic Jan 21, 2025
532d14a
fix: move migration script to a workflow
fPolic Jan 21, 2025
962a5ce
Merge branch 'develop' into feat/product-shipping-profile-link
olivermrbl Jan 21, 2025
a44e216
fix: create product sp validation
fPolic Jan 21, 2025
81d8a61
fix: rm filter
fPolic Jan 21, 2025
8f48596
fix: batch product spec
fPolic Jan 21, 2025
2a21040
feat: validate that SP exists in the DB
fPolic Jan 21, 2025
a72c048
feat: handle shipping profile in product import
fPolic Jan 21, 2025
1e5de78
fix: export fixtures
fPolic Jan 21, 2025
dd72332
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 22, 2025
843c0cf
feat: validate shipping profile delete
fPolic Jan 22, 2025
2822c57
fix: test case after merge
fPolic Jan 22, 2025
37b996b
fix: revert hiding so and location if not requires shipping
fPolic Jan 22, 2025
bc5fb99
feat: validate shipping profile in the create fulfillment workflow
fPolic Jan 22, 2025
e8ae6ce
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 22, 2025
24c72db
fix: schema
fPolic Jan 22, 2025
4476cf7
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 22, 2025
2c9e7cd
fix: modules spec updates, product check
fPolic Jan 22, 2025
0f5da06
fix: seeder update
fPolic Jan 22, 2025
51b68d5
fix: include sm id
fPolic Jan 22, 2025
c2f581c
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 24, 2025
c41a8c4
Merge branch 'develop' into feat/product-shipping-profile-link
fPolic Jan 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions integration-tests/http/__tests__/cart/store/cart.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ medusaIntegrationTestRunner({
salesChannel,
cart,
customer,
promotion
promotion,
shippingProfile

beforeAll(async () => {
appContainer = getContainer()
Expand All @@ -68,6 +69,14 @@ medusaIntegrationTestRunner({
},
}

shippingProfile = (
await api.post(
`/admin/shipping-profiles`,
{ name: "default", type: "default" },
adminHeaders
)
).data.shipping_profile

await setupTaxStructure(appContainer.resolve(Modules.TAX))

region = (
Expand All @@ -87,7 +96,7 @@ medusaIntegrationTestRunner({
).data.region

product = (
await api.post("/admin/products", medusaTshirtProduct, adminHeaders)
await api.post("/admin/products", { ...medusaTshirtProduct, shipping_profile_id: shippingProfile.id }, adminHeaders)
).data.product

salesChannel = (
Expand Down
24 changes: 13 additions & 11 deletions integration-tests/http/__tests__/claims/claims.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ medusaIntegrationTestRunner({
const container = getContainer()
await createAdminUser(dbConnection, adminHeaders, container)

shippingProfile = (
await api.post(
`/admin/shipping-profiles`,
{
name: "Test",
type: "default",
},
adminHeaders
)
).data.shipping_profile

const region = (
await api.post(
"/admin/regions",
Expand Down Expand Up @@ -72,6 +83,7 @@ medusaIntegrationTestRunner({
{
title: "Test product",
options: [{ title: "size", values: ["large", "small"] }],
shipping_profile_id: shippingProfile.id,
variants: [
{
title: "Test variant",
Expand All @@ -96,6 +108,7 @@ medusaIntegrationTestRunner({
{
title: "Extra product",
options: [{ title: "size", values: ["large", "small"] }],
shipping_profile_id: shippingProfile.id,
variants: [
{
title: "my variant",
Expand Down Expand Up @@ -213,17 +226,6 @@ medusaIntegrationTestRunner({
customer_id: customer.id,
})

shippingProfile = (
await api.post(
`/admin/shipping-profiles`,
{
name: "Test",
type: "default",
},
adminHeaders
)
).data.shipping_profile

location = (
await api.post(
`/admin/stock-locations`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ medusaIntegrationTestRunner({
let baseProduct
let baseProduct1

let shippingProfile

beforeEach(async () => {
const container = getContainer()
await createAdminUser(dbConnection, adminHeaders, container)
Expand Down Expand Up @@ -44,12 +46,21 @@ medusaIntegrationTestRunner({
)
).data.collection

shippingProfile = (
await api.post(
`/admin/shipping-profiles`,
{ name: "Test", type: "default" },
adminHeaders
)
).data.shipping_profile

baseProduct = (
await api.post(
"/admin/products",
{
title: "test-product",
options: [{ title: "size", values: ["x", "l"] }],
shipping_profile_id: shippingProfile.id,
},
adminHeaders
)
Expand All @@ -61,6 +72,7 @@ medusaIntegrationTestRunner({
{
title: "test-product1",
options: [{ title: "size", values: ["x", "l"] }],
shipping_profile_id: shippingProfile.id,
},
adminHeaders
)
Expand Down
24 changes: 13 additions & 11 deletions integration-tests/http/__tests__/exchanges/exchanges.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ medusaIntegrationTestRunner({
)
).data.region

shippingProfile = (
await api.post(
`/admin/shipping-profiles`,
{
name: "Test",
type: "default",
},
adminHeaders
)
).data.shipping_profile

const customer = (
await api.post(
"/admin/customers",
Expand All @@ -67,6 +78,7 @@ medusaIntegrationTestRunner({
"/admin/products",
{
title: "Test product",
shipping_profile_id: shippingProfile.id,
options: [{ title: "size", values: ["large", "small"] }],
variants: [
{
Expand All @@ -91,6 +103,7 @@ medusaIntegrationTestRunner({
"/admin/products",
{
title: "Extra product",
shipping_profile_id: shippingProfile.id,
options: [{ title: "size", values: ["large", "small"] }],
variants: [
{
Expand Down Expand Up @@ -203,17 +216,6 @@ medusaIntegrationTestRunner({
customer_id: customer.id,
})

shippingProfile = (
await api.post(
`/admin/shipping-profiles`,
{
name: "Test",
type: "default",
},
adminHeaders
)
).data.shipping_profile

location = (
await api.post(
`/admin/stock-locations`,
Expand Down
30 changes: 23 additions & 7 deletions integration-tests/http/__tests__/fixtures/order.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
AdminInventoryItem,
AdminProduct,
AdminShippingProfile,
AdminStockLocation,
MedusaContainer,
} from "@medusajs/types"
Expand All @@ -18,6 +19,8 @@ export async function createOrderSeeder({
additionalProducts,
stockChannelOverride,
inventoryItemOverride,
shippingProfileOverride,
withoutShipping,
}: {
api: any
container: MedusaContainer
Expand All @@ -26,6 +29,8 @@ export async function createOrderSeeder({
stockChannelOverride?: AdminStockLocation
additionalProducts?: { variant_id: string; quantity: number }[]
inventoryItemOverride?: AdminInventoryItem
shippingProfileOverride?: AdminShippingProfile
withoutShipping?: boolean
}) {
const publishableKey = await generatePublishableKey(container)

Expand Down Expand Up @@ -86,13 +91,15 @@ export async function createOrderSeeder({
adminHeaders
)

const shippingProfile = (
await api.post(
`/admin/shipping-profiles`,
{ name: `test-${stockLocation.id}`, type: "default" },
adminHeaders
)
).data.shipping_profile
const shippingProfile =
shippingProfileOverride ??
(
await api.post(
`/admin/shipping-profiles`,
{ name: `test-${stockLocation.id}`, type: "default" },
adminHeaders
)
).data.shipping_profile

const product =
productOverride ??
Expand All @@ -101,6 +108,7 @@ export async function createOrderSeeder({
"/admin/products",
{
title: `Test fixture ${shippingProfile.id}`,
shipping_profile_id: shippingProfile.id,
options: [
{ title: "size", values: ["large", "small"] },
{ title: "color", values: ["green"] },
Expand Down Expand Up @@ -217,6 +225,14 @@ export async function createOrderSeeder({
)
).data.cart

if (!withoutShipping) {
await api.post(
`/store/carts/${cart.id}/shipping-methods`,
{ option_id: shippingOption.id },
storeHeaders
)
}

const paymentCollection = (
await api.post(
`/store/payment-collections`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@ medusaIntegrationTestRunner({
let stockLocation1
let stockLocation2
let stockLocation3

let shippingProfile
beforeEach(async () => {
await createAdminUser(dbConnection, adminHeaders, getContainer())

shippingProfile = (
await api.post(
`/admin/shipping-profiles`,
{ name: "Test", type: "default" },
adminHeaders
)
).data.shipping_profile

stockLocation1 = (
await api.post(`/admin/stock-locations`, { name: "loc1" }, adminHeaders)
).data.stock_location
Expand Down Expand Up @@ -990,6 +1000,7 @@ medusaIntegrationTestRunner({
{
title: "product 1",
options: [{ title: "size", values: ["large"] }],
shipping_profile_id: shippingProfile.id,
variants: [
{
title: "variant 1",
Expand Down
24 changes: 13 additions & 11 deletions integration-tests/http/__tests__/order-edits/order-edits.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,24 @@ medusaIntegrationTestRunner({
)
).data.sales_channel

shippingProfile = (
await api.post(
`/admin/shipping-profiles`,
{
name: "Test",
type: "default",
},
adminHeaders
)
).data.shipping_profile

const product = (
await api.post(
"/admin/products",
{
title: "Test product",
options: [{ title: "size", values: ["large", "small"] }],
shipping_profile_id: shippingProfile.id,
variants: [
{
title: "Test variant",
Expand All @@ -115,6 +127,7 @@ medusaIntegrationTestRunner({
{
title: "Extra product",
options: [{ title: "size", values: ["large", "small"] }],
shipping_profile_id: shippingProfile.id,
variants: [
{
title: "my variant",
Expand Down Expand Up @@ -174,17 +187,6 @@ medusaIntegrationTestRunner({
customer_id: customer.id,
})

shippingProfile = (
await api.post(
`/admin/shipping-profiles`,
{
name: "Test",
type: "default",
},
adminHeaders
)
).data.shipping_profile

location = (
await api.post(
`/admin/stock-locations`,
Expand Down
Loading
Loading