feat: Add exchange return shipping (#8108)

* wip

* finalize tests

* feat: Add exchange return shipping

* add shipping to preview

* test input

* move utils and ignore already inserted shipping method

* use custom price

---------

Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com>
This commit is contained in:
Oli Juhl
2024-07-15 22:04:20 +02:00
committed by GitHub
parent b38c0488be
commit ffd4b195ee
25 changed files with 511 additions and 165 deletions

View File

@@ -6,13 +6,13 @@ import {
import {
ChangeActionType,
ClaimType,
OrderChangeType,
ReturnStatus,
getShippingMethodsTotals,
isString,
promiseAll,
} from "@medusajs/utils"
import { ClaimItem, OrderClaim, Return, ReturnItem } from "@models"
import { OrderChangeType } from "@types"
function createClaimAndReturnEntities(em, data, order) {
const claimReference = em.create(OrderClaim, {

View File

@@ -5,13 +5,13 @@ import {
} from "@medusajs/types"
import {
ChangeActionType,
OrderChangeType,
ReturnStatus,
getShippingMethodsTotals,
isString,
promiseAll,
} from "@medusajs/utils"
import { ExchangeItem, OrderExchange, Return, ReturnItem } from "@models"
import { OrderChangeType } from "@types"
function createExchangeAndReturnEntities(em, data, order) {
const exchangeReference = em.create(OrderExchange, {

View File

@@ -5,6 +5,7 @@ import {
} from "@medusajs/types"
import {
ChangeActionType,
OrderChangeType,
ReturnStatus,
getShippingMethodsTotals,
isDefined,
@@ -12,7 +13,6 @@ import {
promiseAll,
} from "@medusajs/utils"
import { Return, ReturnItem } from "@models"
import { OrderChangeType } from "@types"
function createReturnReference(em, data, order) {
return em.create(Return, {

View File

@@ -2,10 +2,10 @@ import { Context, OrderTypes } from "@medusajs/types"
import {
ChangeActionType,
MathBN,
OrderChangeType,
ReturnStatus,
promiseAll,
} from "@medusajs/utils"
import { OrderChangeType } from "@types"
function createReturnItems(data) {
return data.items.map((item) => ({