feat: carry over promotions toggle on exchanges (#14128)
* feat: carry over promotions toggle on exchanges * fix: inital flag value, return the flag on preview * fix: validation of allocation type * fix: revert client changes * fix: invert condition * feat: recompute adjustments when outbound item is updated * fix: condition again * fix: display more accurate inbound/outbound totals for exchanges * fix: make exchanges specs green * feat: more testing cases * wip: pr feedback * fix: use plural for the flag on Admin * fix: schema test, route refactor * feat: tooltip * feat: refactor to use update workflow * feat: display applied promotion per item on order details, show copy sku on hover * feat: refactor edits and exchanges to have common flag toggle flow * fix: delete empty file * fix: exchange_id param query
This commit is contained in:
@@ -1297,6 +1297,16 @@ medusaIntegrationTestRunner({
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
// allow carry over promotions flag on the edit
|
||||
const orderChangeId = result.data.order_change.id
|
||||
await api.post(
|
||||
`/admin/order-changes/${orderChangeId}`,
|
||||
{
|
||||
carry_over_promotions: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const orderId = result.data.order_change.order_id
|
||||
|
||||
result = (await api.get(`/admin/orders/${orderId}`, adminHeaders)).data
|
||||
@@ -1375,6 +1385,16 @@ medusaIntegrationTestRunner({
|
||||
|
||||
const orderId = result.data.order_change.order_id
|
||||
|
||||
// allow carry over promotions flag on the edit
|
||||
const orderChangeId = result.data.order_change.id
|
||||
await api.post(
|
||||
`/admin/order-changes/${orderChangeId}`,
|
||||
{
|
||||
carry_over_promotions: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const item = order.items[0]
|
||||
|
||||
result = (await api.get(`/admin/orders/${orderId}`, adminHeaders)).data
|
||||
@@ -1451,6 +1471,16 @@ medusaIntegrationTestRunner({
|
||||
|
||||
const orderId = result.data.order_change.order_id
|
||||
|
||||
// allow carry over promotions flag on the edit
|
||||
const orderChangeId = result.data.order_change.id
|
||||
await api.post(
|
||||
`/admin/order-changes/${orderChangeId}`,
|
||||
{
|
||||
carry_over_promotions: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const item = order.items[0]
|
||||
|
||||
result = (await api.get(`/admin/orders/${orderId}`, adminHeaders)).data
|
||||
@@ -1559,6 +1589,16 @@ medusaIntegrationTestRunner({
|
||||
)
|
||||
const orderChange1 = response.data.order_change
|
||||
|
||||
// allow carry over promotions flag on the edit
|
||||
const orderChangeId = response.data.order_change.id
|
||||
await api.post(
|
||||
`/admin/order-changes/${orderChangeId}`,
|
||||
{
|
||||
carry_over_promotions: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
// 2. Add a new item in the first edit
|
||||
response = await api.post(
|
||||
`/admin/order-edits/${orderChange1.order_id}/items`,
|
||||
@@ -1648,6 +1688,13 @@ medusaIntegrationTestRunner({
|
||||
adminHeaders
|
||||
)
|
||||
const orderChange2 = response.data.order_change
|
||||
await api.post(
|
||||
`/admin/order-changes/${orderChange2.id}`,
|
||||
{
|
||||
carry_over_promotions: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
// 5. Add another productExtra item
|
||||
response = await api.post(
|
||||
@@ -1943,6 +1990,17 @@ medusaIntegrationTestRunner({
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
// allow carry over promotions flag on the edit
|
||||
const orderChangeId = editRes.data.order_change.id
|
||||
await api.post(
|
||||
`/admin/order-changes/${orderChangeId}`,
|
||||
{
|
||||
carry_over_promotions: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const editOrderId = editRes.data.order_change.order_id
|
||||
const extraVariantId = productExtra.variants[0].id
|
||||
|
||||
@@ -2038,6 +2096,16 @@ medusaIntegrationTestRunner({
|
||||
const orderId = result.data.order_change.order_id
|
||||
const originalItem = order.items[0]
|
||||
|
||||
// allow carry over promotions flag on the edit
|
||||
const orderChangeId = result.data.order_change.id
|
||||
await api.post(
|
||||
`/admin/order-changes/${orderChangeId}`,
|
||||
{
|
||||
carry_over_promotions: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
// Add a new item
|
||||
result = (
|
||||
await api.post(
|
||||
@@ -2154,6 +2222,16 @@ medusaIntegrationTestRunner({
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
// allow carry over promotions flag on the edit
|
||||
const orderChangeId = result.data.order_change.id
|
||||
await api.post(
|
||||
`/admin/order-changes/${orderChangeId}`,
|
||||
{
|
||||
carry_over_promotions: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const orderId = result.data.order_change.order_id
|
||||
|
||||
result = (await api.get(`/admin/orders/${orderId}`, adminHeaders)).data
|
||||
@@ -2332,6 +2410,16 @@ medusaIntegrationTestRunner({
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
// allow carry over promotions flag on the edit
|
||||
const orderChangeId = result.data.order_change.id
|
||||
await api.post(
|
||||
`/admin/order-changes/${orderChangeId}`,
|
||||
{
|
||||
carry_over_promotions: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const orderId = result.data.order_change.order_id
|
||||
|
||||
result = (await api.get(`/admin/orders/${orderId}`, adminHeaders)).data
|
||||
|
||||
Reference in New Issue
Block a user