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:
@@ -633,4 +633,43 @@ export class Order {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* This method updates an order change. It sends a request to the
|
||||
* [Update Order Change](https://docs.medusajs.com/api/admin#order-changes_postorder-changesid)
|
||||
* API route.
|
||||
*
|
||||
* @param id - The order change's ID.
|
||||
* @param body - The update details.
|
||||
* @param query - Configure the fields to retrieve in the order change.
|
||||
* @param headers - Headers to pass in the request
|
||||
* @returns The order change's details.
|
||||
*
|
||||
* @example
|
||||
* sdk.admin.order.updateOrderChange(
|
||||
* "ordch_123",
|
||||
* {
|
||||
* carry_over_promotions: true
|
||||
* }
|
||||
* )
|
||||
* .then(({ order_change }) => {
|
||||
* console.log(order_change)
|
||||
* })
|
||||
*/
|
||||
async updateOrderChange(
|
||||
id: string,
|
||||
body: { carry_over_promotions: boolean },
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminOrderChangeResponse>(
|
||||
`/admin/order-changes/${id}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user