fix(orchestration): remote joiner alias conflict (#8844)

This commit is contained in:
Carlos R. L. Rodrigues
2024-08-28 11:34:22 -03:00
committed by GitHub
parent 68f3244de3
commit 6cfe9bd874
38 changed files with 998 additions and 998 deletions
@@ -11,7 +11,7 @@ export const addOrderTransactionStep = createStep(
async (data: CreateOrderTransactionDTO, { container }) => { async (data: CreateOrderTransactionDTO, { container }) => {
const service = container.resolve(ModuleRegistrationName.ORDER) const service = container.resolve(ModuleRegistrationName.ORDER)
const created = await service.addTransactions(data) const created = await service.addOrderTransactions(data)
return new StepResponse(created, created.id) return new StepResponse(created, created.id)
}, },
@@ -22,6 +22,6 @@ export const addOrderTransactionStep = createStep(
const service = container.resolve(ModuleRegistrationName.ORDER) const service = container.resolve(ModuleRegistrationName.ORDER)
await service.deleteTransactions(id) await service.deleteOrderTransactions(id)
} }
) )
@@ -16,7 +16,7 @@ export const createOrderLineItemsStep = createStep(
const orderModule = container.resolve(ModuleRegistrationName.ORDER) const orderModule = container.resolve(ModuleRegistrationName.ORDER)
const createdItems = input.items.length const createdItems = input.items.length
? await orderModule.createLineItems(input.items) ? await orderModule.createOrderLineItems(input.items)
: [] : []
return new StepResponse( return new StepResponse(
@@ -31,6 +31,6 @@ export const createOrderLineItemsStep = createStep(
const orderModule = container.resolve(ModuleRegistrationName.ORDER) const orderModule = container.resolve(ModuleRegistrationName.ORDER)
await orderModule.deleteLineItems(itemIds) await orderModule.deleteOrderLineItems(itemIds)
} }
) )
@@ -3,7 +3,7 @@ import {
IOrderModuleService, IOrderModuleService,
} from "@medusajs/types" } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/utils" import { ModuleRegistrationName } from "@medusajs/utils"
import { createStep, StepResponse } from "@medusajs/workflows-sdk" import { StepResponse, createStep } from "@medusajs/workflows-sdk"
export interface CreateOrderShippingMethodsStepInput { export interface CreateOrderShippingMethodsStepInput {
shipping_methods: CreateOrderShippingMethodDTO[] shipping_methods: CreateOrderShippingMethodDTO[]
@@ -19,7 +19,9 @@ export const createOrderShippingMethods = createStep(
ModuleRegistrationName.ORDER ModuleRegistrationName.ORDER
) )
const created = await service.createShippingMethods(input.shipping_methods) const created = await service.createOrderShippingMethods(
input.shipping_methods
)
return new StepResponse( return new StepResponse(
created, created,
@@ -35,6 +37,6 @@ export const createOrderShippingMethods = createStep(
ModuleRegistrationName.ORDER ModuleRegistrationName.ORDER
) )
await service.deleteShippingMethods(createdMethodIds) await service.deleteOrderShippingMethods(createdMethodIds)
} }
) )
@@ -16,7 +16,7 @@ export const deleteOrderLineItems = createStep(
ModuleRegistrationName.ORDER ModuleRegistrationName.ORDER
) )
const deleted = await service.softDeleteLineItems(input.ids) const deleted = await service.softDeleteOrderLineItems(input.ids)
return new StepResponse(deleted, input.ids) return new StepResponse(deleted, input.ids)
}, },
@@ -29,6 +29,6 @@ export const deleteOrderLineItems = createStep(
ModuleRegistrationName.ORDER ModuleRegistrationName.ORDER
) )
await service.restoreLineItems(ids) await service.restoreOrderLineItems(ids)
} }
) )
@@ -6,7 +6,6 @@ export interface DeleteOrderShippingMethodsStepInput {
ids: string[] ids: string[]
} }
/** /**
* This step deletes order shipping methods. * This step deletes order shipping methods.
*/ */
@@ -17,7 +16,7 @@ export const deleteOrderShippingMethods = createStep(
ModuleRegistrationName.ORDER ModuleRegistrationName.ORDER
) )
const deleted = await service.softDeleteShippingMethods(input.ids) const deleted = await service.softDeleteOrderShippingMethods(input.ids)
return new StepResponse(deleted, input.ids) return new StepResponse(deleted, input.ids)
}, },
@@ -30,6 +29,6 @@ export const deleteOrderShippingMethods = createStep(
ModuleRegistrationName.ORDER ModuleRegistrationName.ORDER
) )
await service.restoreShippingMethods(ids) await service.restoreOrderShippingMethods(ids)
} }
) )
@@ -28,23 +28,25 @@ export const setOrderTaxLinesForItemsStep = createStep(
) )
const getShippingTaxLinesPromise = const getShippingTaxLinesPromise =
await orderService.listShippingMethodTaxLines({ await orderService.listOrderShippingMethodTaxLines({
shipping_method_id: shipping_tax_lines.map((t) => t.shipping_line_id), shipping_method_id: shipping_tax_lines.map((t) => t.shipping_line_id),
}) })
const getItemTaxLinesPromise = await orderService.listLineItemTaxLines({ const getItemTaxLinesPromise = await orderService.listOrderLineItemTaxLines(
item_id: item_tax_lines.map((t) => t.line_item_id), {
}) item_id: item_tax_lines.map((t) => t.line_item_id),
}
)
const itemsTaxLinesData = normalizeItemTaxLinesForOrder(item_tax_lines) const itemsTaxLinesData = normalizeItemTaxLinesForOrder(item_tax_lines)
const setItemTaxLinesPromise = itemsTaxLinesData.length const setItemTaxLinesPromise = itemsTaxLinesData.length
? orderService.setLineItemTaxLines(order.id, itemsTaxLinesData) ? orderService.setOrderLineItemTaxLines(order.id, itemsTaxLinesData)
: void 0 : void 0
const shippingTaxLinesData = const shippingTaxLinesData =
normalizeShippingTaxLinesForOrder(shipping_tax_lines) normalizeShippingTaxLinesForOrder(shipping_tax_lines)
const setShippingTaxLinesPromise = shippingTaxLinesData.length const setShippingTaxLinesPromise = shippingTaxLinesData.length
? await orderService.setShippingMethodTaxLines( ? await orderService.setOrderShippingMethodTaxLines(
order.id, order.id,
shippingTaxLinesData shippingTaxLinesData
) )
@@ -77,7 +79,7 @@ export const setOrderTaxLinesForItemsStep = createStep(
) )
if (existingLineItemTaxLines) { if (existingLineItemTaxLines) {
await orderService.setLineItemTaxLines( await orderService.setOrderLineItemTaxLines(
order.id, order.id,
existingLineItemTaxLines.map((taxLine) => ({ existingLineItemTaxLines.map((taxLine) => ({
description: taxLine.description, description: taxLine.description,
@@ -90,7 +92,7 @@ export const setOrderTaxLinesForItemsStep = createStep(
) )
} }
await orderService.setShippingMethodTaxLines( await orderService.setOrderShippingMethodTaxLines(
order.id, order.id,
existingShippingMethodTaxLines.map((taxLine) => ({ existingShippingMethodTaxLines.map((taxLine) => ({
description: taxLine.description, description: taxLine.description,
@@ -22,12 +22,12 @@ export const updateOrderShippingMethodsStep = createStep(
const { selects, relations } = getSelectsAndRelationsFromObjectArray(data, { const { selects, relations } = getSelectsAndRelationsFromObjectArray(data, {
objectFields: ["metadata"], objectFields: ["metadata"],
}) })
const dataBeforeUpdate = await service.listShippingMethods( const dataBeforeUpdate = await service.listOrderShippingMethods(
{ id: data.map((d) => d.id) }, { id: data.map((d) => d.id) },
{ relations, select: selects } { relations, select: selects }
) )
const updated = await service.updateShippingMethods(data) const updated = await service.updateOrderShippingMethods(data)
return new StepResponse(updated, dataBeforeUpdate) return new StepResponse(updated, dataBeforeUpdate)
}, },
@@ -40,6 +40,6 @@ export const updateOrderShippingMethodsStep = createStep(
ModuleRegistrationName.ORDER ModuleRegistrationName.ORDER
) )
await service.updateShippingMethods(dataBeforeUpdate) await service.updateOrderShippingMethods(dataBeforeUpdate)
} }
) )
@@ -204,8 +204,8 @@ export class RemoteJoiner {
// self-reference // self-reference
for (const alias of service_.alias) { for (const alias of service_.alias) {
if (this.serviceConfigCache.has(`alias_${alias.name}}`)) { if (this.serviceConfigCache.has(`alias_${alias.name}`)) {
const defined = this.serviceConfigCache.get(`alias_${alias.name}}`) const defined = this.serviceConfigCache.get(`alias_${alias.name}`)
if (service_.serviceName === defined?.serviceName) { if (service_.serviceName === defined?.serviceName) {
continue continue
+1 -1
View File
@@ -32,8 +32,8 @@ import {
CreateShippingMethodForSingleCartDTO, CreateShippingMethodForSingleCartDTO,
CreateShippingMethodTaxLineDTO, CreateShippingMethodTaxLineDTO,
UpdateAddressDTO, UpdateAddressDTO,
UpdateCartDataDTO,
UpdateCartDTO, UpdateCartDTO,
UpdateCartDataDTO,
UpdateLineItemDTO, UpdateLineItemDTO,
UpdateLineItemTaxLineDTO, UpdateLineItemTaxLineDTO,
UpdateLineItemWithSelectorDTO, UpdateLineItemWithSelectorDTO,
File diff suppressed because it is too large Load Diff
@@ -21,7 +21,7 @@ const FulfillmentDeletedAtIndex = createPsqlIndexStatementHelper({
}) })
@Entity({ tableName: "fulfillment_address" }) @Entity({ tableName: "fulfillment_address" })
export default class Address { export default class FulfillmentAddress {
[OptionalProps]: OptionalAddressProps [OptionalProps]: OptionalAddressProps
@PrimaryKey({ columnType: "text" }) @PrimaryKey({ columnType: "text" })
@@ -20,7 +20,7 @@ import {
Property, Property,
Rel, Rel,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import Address from "./address" import FulfillmentAddress from "./address"
import FulfillmentItem from "./fulfillment-item" import FulfillmentItem from "./fulfillment-item"
import FulfillmentLabel from "./fulfillment-label" import FulfillmentLabel from "./fulfillment-label"
import FulfillmentProvider from "./fulfillment-provider" import FulfillmentProvider from "./fulfillment-provider"
@@ -127,13 +127,13 @@ export default class Fulfillment {
provider: Rel<FulfillmentProvider> provider: Rel<FulfillmentProvider>
@OneToOne({ @OneToOne({
entity: () => Address, entity: () => FulfillmentAddress,
owner: true, owner: true,
cascade: [Cascade.PERSIST, "soft-remove"] as any, cascade: [Cascade.PERSIST, "soft-remove"] as any,
nullable: true, nullable: true,
onDelete: "cascade", onDelete: "cascade",
}) })
delivery_address!: Rel<Address> delivery_address!: Rel<FulfillmentAddress>
@OneToMany(() => FulfillmentItem, (item) => item.fulfillment, { @OneToMany(() => FulfillmentItem, (item) => item.fulfillment, {
cascade: [Cascade.PERSIST, "soft-remove"] as any, cascade: [Cascade.PERSIST, "soft-remove"] as any,
@@ -1,4 +1,4 @@
export { default as Address } from "./address" export { default as FulfillmentAddress } from "./address"
export { default as Fulfillment } from "./fulfillment" export { default as Fulfillment } from "./fulfillment"
export { default as FulfillmentItem } from "./fulfillment-item" export { default as FulfillmentItem } from "./fulfillment-item"
export { default as FulfillmentLabel } from "./fulfillment-label" export { default as FulfillmentLabel } from "./fulfillment-label"
@@ -10,4 +10,3 @@ export { default as ShippingOption } from "./shipping-option"
export { default as ShippingOptionRule } from "./shipping-option-rule" export { default as ShippingOptionRule } from "./shipping-option-rule"
export { default as ShippingOptionType } from "./shipping-option-type" export { default as ShippingOptionType } from "./shipping-option-type"
export { default as ShippingProfile } from "./shipping-profile" export { default as ShippingProfile } from "./shipping-profile"
@@ -217,7 +217,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
}) })
) )
const refund = await service.addTransactions([ const refund = await service.addOrderTransactions([
{ {
order_id: created.id, order_id: created.id,
amount: -20, amount: -20,
@@ -242,7 +242,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
}) })
) )
await service.softDeleteTransactions([refund[0].id]) await service.softDeleteOrderTransactions([refund[0].id])
const serializedOrder2 = JSON.parse( const serializedOrder2 = JSON.parse(
JSON.stringify( JSON.stringify(
@@ -261,7 +261,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
}) })
) )
await service.addTransactions([ await service.addOrderTransactions([
{ {
order_id: created.id, order_id: created.id,
amount: -50, amount: -50,
@@ -286,7 +286,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
}) })
) )
await service.restoreTransactions([refund[0].id]) await service.restoreOrderTransactions([refund[0].id])
const serializedOrder4 = JSON.parse( const serializedOrder4 = JSON.parse(
JSON.stringify( JSON.stringify(
@@ -14,19 +14,19 @@ moduleIntegrationTestRunner<IOrderModuleService>({
expect(Object.keys(linkable)).toEqual([ expect(Object.keys(linkable)).toEqual([
"order", "order",
"address", "orderAddress",
"lineItem", "orderLineItem",
"lineItemAdjustment", "orderLineItemAdjustment",
"lineItemTaxLine", "orderLineItemTaxLine",
"shippingMethod", "orderShippingMethod",
"shippingMethodAdjustment", "orderShippingMethodAdjustment",
"shippingMethodTaxLine", "orderShippingMethodTaxLine",
"transaction", "orderTransaction",
"orderChange", "orderChange",
"orderChangeAction", "orderChangeAction",
"orderItem", "orderItem",
"orderSummary", "orderSummary",
"orderShippingMethod", "orderShipping",
"returnReason", "returnReason",
"return", "return",
"returnItem", "returnItem",
@@ -50,68 +50,68 @@ moduleIntegrationTestRunner<IOrderModuleService>({
field: "order", field: "order",
}, },
}, },
address: { orderAddress: {
id: { id: {
linkable: "address_id", linkable: "order_address_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "address", field: "orderAddress",
}, },
}, },
lineItem: { orderLineItem: {
id: { id: {
linkable: "line_item_id", linkable: "order_line_item_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "lineItem", field: "orderLineItem",
}, },
}, },
lineItemAdjustment: { orderLineItemAdjustment: {
id: { id: {
linkable: "line_item_adjustment_id", linkable: "order_line_item_adjustment_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "lineItemAdjustment", field: "orderLineItemAdjustment",
}, },
}, },
lineItemTaxLine: { orderLineItemTaxLine: {
id: { id: {
linkable: "line_item_tax_line_id", linkable: "order_line_item_tax_line_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "lineItemTaxLine", field: "orderLineItemTaxLine",
}, },
}, },
shippingMethod: { orderShippingMethod: {
id: { id: {
linkable: "shipping_method_id", linkable: "order_shipping_method_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "shippingMethod", field: "orderShippingMethod",
}, },
}, },
shippingMethodAdjustment: { orderShippingMethodAdjustment: {
id: { id: {
linkable: "shipping_method_adjustment_id", linkable: "order_shipping_method_adjustment_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "shippingMethodAdjustment", field: "orderShippingMethodAdjustment",
}, },
}, },
shippingMethodTaxLine: { orderShippingMethodTaxLine: {
id: { id: {
linkable: "shipping_method_tax_line_id", linkable: "order_shipping_method_tax_line_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "shippingMethodTaxLine", field: "orderShippingMethodTaxLine",
}, },
}, },
transaction: { orderTransaction: {
id: { id: {
linkable: "transaction_id", linkable: "order_transaction_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "transaction", field: "orderTransaction",
}, },
}, },
orderChange: { orderChange: {
@@ -146,12 +146,12 @@ moduleIntegrationTestRunner<IOrderModuleService>({
field: "orderSummary", field: "orderSummary",
}, },
}, },
orderShippingMethod: { orderShipping: {
id: { id: {
linkable: "order_shipping_method_id", linkable: "order_shipping_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "orderShippingMethod", field: "orderShipping",
}, },
}, },
returnReason: { returnReason: {
@@ -188,18 +188,18 @@ moduleIntegrationTestRunner<IOrderModuleService>({
}, },
orderClaimItem: { orderClaimItem: {
id: { id: {
field: "orderClaimItem",
linkable: "order_claim_item_id", linkable: "order_claim_item_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "orderClaimItem",
}, },
}, },
orderClaimItemImage: { orderClaimItemImage: {
id: { id: {
field: "orderClaimItemImage",
linkable: "order_claim_item_image_id", linkable: "order_claim_item_image_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "orderClaimItemImage",
}, },
}, },
orderExchange: { orderExchange: {
@@ -212,10 +212,10 @@ moduleIntegrationTestRunner<IOrderModuleService>({
}, },
orderExchangeItem: { orderExchangeItem: {
id: { id: {
field: "orderExchangeItem",
linkable: "order_exchange_item_id", linkable: "order_exchange_item_id",
primaryKey: "id", primaryKey: "id",
serviceName: "order", serviceName: "order",
field: "orderExchangeItem",
}, },
}, },
}) })
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -20,7 +20,7 @@ const CustomerIdIndex = createPsqlIndexStatementHelper({
}) })
@Entity({ tableName: "order_address" }) @Entity({ tableName: "order_address" })
export default class Address { export default class OrderAddress {
[OptionalProps]: OptionalAddressProps [OptionalProps]: OptionalAddressProps
@PrimaryKey({ columnType: "text" }) @PrimaryKey({ columnType: "text" })
@@ -21,7 +21,7 @@ import {
} from "@mikro-orm/core" } from "@mikro-orm/core"
import Claim from "./claim" import Claim from "./claim"
import OrderClaimItemImage from "./claim-item-image" import OrderClaimItemImage from "./claim-item-image"
import LineItem from "./line-item" import OrderLineItem from "./line-item"
type OptionalLineItemProps = DAL.ModelDateColumns type OptionalLineItemProps = DAL.ModelDateColumns
@@ -80,7 +80,7 @@ export default class OrderClaimItem {
claim: Rel<Claim> claim: Rel<Claim>
@ManyToOne({ @ManyToOne({
entity: () => LineItem, entity: () => OrderLineItem,
fieldName: "item_id", fieldName: "item_id",
mapToPk: true, mapToPk: true,
columnType: "text", columnType: "text",
@@ -88,10 +88,10 @@ export default class OrderClaimItem {
@ItemIdIndex.MikroORMIndex() @ItemIdIndex.MikroORMIndex()
item_id: string item_id: string
@ManyToOne(() => LineItem, { @ManyToOne(() => OrderLineItem, {
persist: false, persist: false,
}) })
item: Rel<LineItem> item: Rel<OrderLineItem>
@Property({ columnType: "boolean", default: false }) @Property({ columnType: "boolean", default: false })
is_additional_item: boolean = false is_additional_item: boolean = false
+9 -13
View File
@@ -25,9 +25,9 @@ import {
} from "@mikro-orm/core" } from "@mikro-orm/core"
import ClaimItem from "./claim-item" import ClaimItem from "./claim-item"
import Order from "./order" import Order from "./order"
import OrderShippingMethod from "./order-shipping-method" import OrderShipping from "./order-shipping-method"
import Return from "./return" import Return from "./return"
import Transaction from "./transaction" import OrderTransaction from "./transaction"
type OptionalOrderClaimProps = DAL.ModelDateColumns type OptionalOrderClaimProps = DAL.ModelDateColumns
@@ -123,19 +123,15 @@ export default class OrderClaim {
}) })
claim_items = new Collection<Rel<ClaimItem>>(this) claim_items = new Collection<Rel<ClaimItem>>(this)
@OneToMany( @OneToMany(() => OrderShipping, (shippingMethod) => shippingMethod.claim, {
() => OrderShippingMethod,
(shippingMethod) => shippingMethod.claim,
{
cascade: [Cascade.PERSIST],
}
)
shipping_methods = new Collection<Rel<OrderShippingMethod>>(this)
@OneToMany(() => Transaction, (transaction) => transaction.claim, {
cascade: [Cascade.PERSIST], cascade: [Cascade.PERSIST],
}) })
transactions = new Collection<Transaction>(this) shipping_methods = new Collection<Rel<OrderShipping>>(this)
@OneToMany(() => OrderTransaction, (transaction) => transaction.claim, {
cascade: [Cascade.PERSIST],
})
transactions = new Collection<OrderTransaction>(this)
@Property({ columnType: "text", nullable: true }) @Property({ columnType: "text", nullable: true })
created_by: string | null = null created_by: string | null = null
@@ -14,7 +14,7 @@ import {
Property, Property,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import Exchange from "./exchange" import Exchange from "./exchange"
import LineItem from "./line-item" import OrderLineItem from "./line-item"
type OptionalLineItemProps = DAL.ModelDateColumns type OptionalLineItemProps = DAL.ModelDateColumns
@@ -64,7 +64,7 @@ export default class OrderExchangeItem {
exchange: Exchange exchange: Exchange
@ManyToOne({ @ManyToOne({
entity: () => LineItem, entity: () => OrderLineItem,
fieldName: "item_id", fieldName: "item_id",
mapToPk: true, mapToPk: true,
columnType: "text", columnType: "text",
@@ -72,10 +72,10 @@ export default class OrderExchangeItem {
@ItemIdIndex.MikroORMIndex() @ItemIdIndex.MikroORMIndex()
item_id: string item_id: string
@ManyToOne(() => LineItem, { @ManyToOne(() => OrderLineItem, {
persist: false, persist: false,
}) })
item: LineItem item: OrderLineItem
@Property({ columnType: "text", nullable: true }) @Property({ columnType: "text", nullable: true })
note: string note: string
+9 -13
View File
@@ -21,9 +21,9 @@ import {
Property, Property,
Rel, Rel,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import { OrderExchangeItem, Transaction } from "@models" import { OrderExchangeItem, OrderTransaction } from "@models"
import Order from "./order" import Order from "./order"
import OrderShippingMethod from "./order-shipping-method" import OrderShipping from "./order-shipping-method"
import Return from "./return" import Return from "./return"
type OptionalOrderExchangeProps = DAL.ModelDateColumns type OptionalOrderExchangeProps = DAL.ModelDateColumns
@@ -115,19 +115,15 @@ export default class OrderExchange {
}) })
additional_items = new Collection<Rel<OrderExchangeItem>>(this) additional_items = new Collection<Rel<OrderExchangeItem>>(this)
@OneToMany( @OneToMany(() => OrderShipping, (shippingMethod) => shippingMethod.exchange, {
() => OrderShippingMethod,
(shippingMethod) => shippingMethod.exchange,
{
cascade: [Cascade.PERSIST],
}
)
shipping_methods = new Collection<Rel<OrderShippingMethod>>(this)
@OneToMany(() => Transaction, (transaction) => transaction.exchange, {
cascade: [Cascade.PERSIST], cascade: [Cascade.PERSIST],
}) })
transactions = new Collection<Transaction>(this) shipping_methods = new Collection<Rel<OrderShipping>>(this)
@OneToMany(() => OrderTransaction, (transaction) => transaction.exchange, {
cascade: [Cascade.PERSIST],
})
transactions = new Collection<OrderTransaction>(this)
@Property({ columnType: "text", nullable: true }) @Property({ columnType: "text", nullable: true })
created_by: string | null = null created_by: string | null = null
+9 -9
View File
@@ -1,22 +1,22 @@
export { default as Address } from "./address" export { default as OrderAddress } from "./address"
export { default as OrderClaim } from "./claim" export { default as OrderClaim } from "./claim"
export { default as OrderClaimItem } from "./claim-item" export { default as OrderClaimItem } from "./claim-item"
export { default as OrderClaimItemImage } from "./claim-item-image" export { default as OrderClaimItemImage } from "./claim-item-image"
export { default as OrderExchange } from "./exchange" export { default as OrderExchange } from "./exchange"
export { default as OrderExchangeItem } from "./exchange-item" export { default as OrderExchangeItem } from "./exchange-item"
export { default as LineItem } from "./line-item" export { default as OrderLineItem } from "./line-item"
export { default as LineItemAdjustment } from "./line-item-adjustment" export { default as OrderLineItemAdjustment } from "./line-item-adjustment"
export { default as LineItemTaxLine } from "./line-item-tax-line" export { default as OrderLineItemTaxLine } from "./line-item-tax-line"
export { default as Order } from "./order" export { default as Order } from "./order"
export { default as OrderChange } from "./order-change" export { default as OrderChange } from "./order-change"
export { default as OrderChangeAction } from "./order-change-action" export { default as OrderChangeAction } from "./order-change-action"
export { default as OrderItem } from "./order-item" export { default as OrderItem } from "./order-item"
export { default as OrderShippingMethod } from "./order-shipping-method" export { default as OrderShipping } from "./order-shipping-method"
export { default as OrderSummary } from "./order-summary" export { default as OrderSummary } from "./order-summary"
export { default as Return } from "./return" export { default as Return } from "./return"
export { default as ReturnItem } from "./return-item" export { default as ReturnItem } from "./return-item"
export { default as ReturnReason } from "./return-reason" export { default as ReturnReason } from "./return-reason"
export { default as ShippingMethod } from "./shipping-method" export { default as OrderShippingMethod } from "./shipping-method"
export { default as ShippingMethodAdjustment } from "./shipping-method-adjustment" export { default as OrderShippingMethodAdjustment } from "./shipping-method-adjustment"
export { default as ShippingMethodTaxLine } from "./shipping-method-tax-line" export { default as OrderShippingMethodTaxLine } from "./shipping-method-tax-line"
export { default as Transaction } from "./transaction" export { default as OrderTransaction } from "./transaction"
@@ -4,7 +4,7 @@ import {
} from "@medusajs/utils" } from "@medusajs/utils"
import { BeforeCreate, Entity, ManyToOne, OnInit, Rel } from "@mikro-orm/core" import { BeforeCreate, Entity, ManyToOne, OnInit, Rel } from "@mikro-orm/core"
import AdjustmentLine from "./adjustment-line" import AdjustmentLine from "./adjustment-line"
import LineItem from "./line-item" import OrderLineItem from "./line-item"
const ItemIdIndex = createPsqlIndexStatementHelper({ const ItemIdIndex = createPsqlIndexStatementHelper({
tableName: "order_line_item_adjustment", tableName: "order_line_item_adjustment",
@@ -12,14 +12,14 @@ const ItemIdIndex = createPsqlIndexStatementHelper({
}) })
@Entity({ tableName: "order_line_item_adjustment" }) @Entity({ tableName: "order_line_item_adjustment" })
export default class LineItemAdjustment extends AdjustmentLine { export default class OrderLineItemAdjustment extends AdjustmentLine {
@ManyToOne(() => LineItem, { @ManyToOne(() => OrderLineItem, {
persist: false, persist: false,
}) })
item: Rel<LineItem> item: Rel<OrderLineItem>
@ManyToOne({ @ManyToOne({
entity: () => LineItem, entity: () => OrderLineItem,
columnType: "text", columnType: "text",
fieldName: "item_id", fieldName: "item_id",
onDelete: "cascade", onDelete: "cascade",
@@ -10,7 +10,7 @@ import {
OnInit, OnInit,
Rel, Rel,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import LineItem from "./line-item" import OrderLineItem from "./line-item"
import TaxLine from "./tax-line" import TaxLine from "./tax-line"
const ItemIdIndex = createPsqlIndexStatementHelper({ const ItemIdIndex = createPsqlIndexStatementHelper({
@@ -19,15 +19,15 @@ const ItemIdIndex = createPsqlIndexStatementHelper({
}) })
@Entity({ tableName: "order_line_item_tax_line" }) @Entity({ tableName: "order_line_item_tax_line" })
export default class LineItemTaxLine extends TaxLine { export default class OrderLineItemTaxLine extends TaxLine {
@ManyToOne(() => LineItem, { @ManyToOne(() => OrderLineItem, {
fieldName: "item_id", fieldName: "item_id",
persist: false, persist: false,
}) })
item: Rel<LineItem> item: Rel<OrderLineItem>
@ManyToOne({ @ManyToOne({
entity: () => LineItem, entity: () => OrderLineItem,
columnType: "text", columnType: "text",
fieldName: "item_id", fieldName: "item_id",
cascade: [Cascade.PERSIST, Cascade.REMOVE], cascade: [Cascade.PERSIST, Cascade.REMOVE],
@@ -19,8 +19,8 @@ import {
Property, Property,
Rel, Rel,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import LineItemAdjustment from "./line-item-adjustment" import OrderLineItemAdjustment from "./line-item-adjustment"
import LineItemTaxLine from "./line-item-tax-line" import OrderLineItemTaxLine from "./line-item-tax-line"
type OptionalLineItemProps = DAL.ModelDateColumns type OptionalLineItemProps = DAL.ModelDateColumns
@@ -44,7 +44,7 @@ const VariantIdIndex = createPsqlIndexStatementHelper({
@Entity({ tableName: "order_line_item" }) @Entity({ tableName: "order_line_item" })
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions) @Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
export default class LineItem { export default class OrderLineItem {
[OptionalProps]?: OptionalLineItemProps [OptionalProps]?: OptionalLineItemProps
@PrimaryKey({ columnType: "text" }) @PrimaryKey({ columnType: "text" })
@@ -128,15 +128,15 @@ export default class LineItem {
@Property({ columnType: "jsonb" }) @Property({ columnType: "jsonb" })
raw_unit_price: BigNumberRawValue raw_unit_price: BigNumberRawValue
@OneToMany(() => LineItemTaxLine, (taxLine) => taxLine.item, { @OneToMany(() => OrderLineItemTaxLine, (taxLine) => taxLine.item, {
cascade: [Cascade.PERSIST, "soft-remove" as Cascade], cascade: [Cascade.PERSIST, "soft-remove" as Cascade],
}) })
tax_lines = new Collection<Rel<LineItemTaxLine>>(this) tax_lines = new Collection<Rel<OrderLineItemTaxLine>>(this)
@OneToMany(() => LineItemAdjustment, (adjustment) => adjustment.item, { @OneToMany(() => OrderLineItemAdjustment, (adjustment) => adjustment.item, {
cascade: [Cascade.PERSIST, "soft-remove" as Cascade], cascade: [Cascade.PERSIST, "soft-remove" as Cascade],
}) })
adjustments = new Collection<Rel<LineItemAdjustment>>(this) adjustments = new Collection<Rel<OrderLineItemAdjustment>>(this)
@Property({ columnType: "jsonb", nullable: true }) @Property({ columnType: "jsonb", nullable: true })
metadata: Record<string, unknown> | null = null metadata: Record<string, unknown> | null = null
@@ -15,7 +15,7 @@ import {
Property, Property,
Rel, Rel,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import LineItem from "./line-item" import OrderLineItem from "./line-item"
import Order from "./order" import Order from "./order"
type OptionalLineItemProps = DAL.ModelDateColumns type OptionalLineItemProps = DAL.ModelDateColumns
@@ -71,7 +71,7 @@ export default class OrderItem {
version: number version: number
@ManyToOne({ @ManyToOne({
entity: () => LineItem, entity: () => OrderLineItem,
fieldName: "item_id", fieldName: "item_id",
mapToPk: true, mapToPk: true,
columnType: "text", columnType: "text",
@@ -79,10 +79,10 @@ export default class OrderItem {
@ItemIdIndex.MikroORMIndex() @ItemIdIndex.MikroORMIndex()
item_id: string item_id: string
@ManyToOne(() => LineItem, { @ManyToOne(() => OrderLineItem, {
persist: false, persist: false,
}) })
item: Rel<LineItem> item: Rel<OrderLineItem>
@MikroOrmBigNumberProperty() @MikroOrmBigNumberProperty()
quantity: BigNumber | number quantity: BigNumber | number
@@ -17,7 +17,7 @@ import Claim from "./claim"
import Exchange from "./exchange" import Exchange from "./exchange"
import Order from "./order" import Order from "./order"
import Return from "./return" import Return from "./return"
import ShippingMethod from "./shipping-method" import OrderShippingMethod from "./shipping-method"
type OptionalShippingMethodProps = DAL.ModelDateColumns type OptionalShippingMethodProps = DAL.ModelDateColumns
@@ -65,7 +65,7 @@ const DeletedAtIndex = createPsqlIndexStatementHelper({
}) })
@Entity({ tableName }) @Entity({ tableName })
export default class OrderShippingMethod { export default class OrderShipping {
[OptionalProps]?: OptionalShippingMethodProps [OptionalProps]?: OptionalShippingMethodProps
@PrimaryKey({ columnType: "text" }) @PrimaryKey({ columnType: "text" })
@@ -138,7 +138,7 @@ export default class OrderShippingMethod {
version: number version: number
@ManyToOne({ @ManyToOne({
entity: () => ShippingMethod, entity: () => OrderShippingMethod,
fieldName: "shipping_method_id", fieldName: "shipping_method_id",
mapToPk: true, mapToPk: true,
columnType: "text", columnType: "text",
@@ -146,10 +146,10 @@ export default class OrderShippingMethod {
@ItemIdIndex.MikroORMIndex() @ItemIdIndex.MikroORMIndex()
shipping_method_id: string shipping_method_id: string
@ManyToOne(() => ShippingMethod, { @ManyToOne(() => OrderShippingMethod, {
persist: false, persist: false,
}) })
shipping_method: Rel<ShippingMethod> shipping_method: Rel<OrderShippingMethod>
@Property({ @Property({
onCreate: () => new Date(), onCreate: () => new Date(),
+14 -18
View File
@@ -18,11 +18,11 @@ import {
Property, Property,
Rel, Rel,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import Address from "./address" import OrderAddress from "./address"
import OrderItem from "./order-item" import OrderItem from "./order-item"
import OrderShippingMethod from "./order-shipping-method" import OrderShipping from "./order-shipping-method"
import OrderSummary from "./order-summary" import OrderSummary from "./order-summary"
import Transaction from "./transaction" import OrderTransaction from "./transaction"
type OptionalOrderProps = type OptionalOrderProps =
| "shipping_address" | "shipping_address"
@@ -142,24 +142,24 @@ export default class Order {
shipping_address_id?: string | null shipping_address_id?: string | null
@ManyToOne({ @ManyToOne({
entity: () => Address, entity: () => OrderAddress,
fieldName: "shipping_address_id", fieldName: "shipping_address_id",
nullable: true, nullable: true,
cascade: [Cascade.PERSIST], cascade: [Cascade.PERSIST],
}) })
shipping_address?: Rel<Address> | null shipping_address?: Rel<OrderAddress> | null
@Property({ columnType: "text", nullable: true }) @Property({ columnType: "text", nullable: true })
@BillingAddressIdIndex.MikroORMIndex() @BillingAddressIdIndex.MikroORMIndex()
billing_address_id?: string | null billing_address_id?: string | null
@ManyToOne({ @ManyToOne({
entity: () => Address, entity: () => OrderAddress,
fieldName: "billing_address_id", fieldName: "billing_address_id",
nullable: true, nullable: true,
cascade: [Cascade.PERSIST], cascade: [Cascade.PERSIST],
}) })
billing_address?: Rel<Address> | null billing_address?: Rel<OrderAddress> | null
@Property({ columnType: "boolean", nullable: true }) @Property({ columnType: "boolean", nullable: true })
no_notification: boolean | null = null no_notification: boolean | null = null
@@ -177,19 +177,15 @@ export default class Order {
}) })
items = new Collection<Rel<OrderItem>>(this) items = new Collection<Rel<OrderItem>>(this)
@OneToMany( @OneToMany(() => OrderShipping, (shippingMethod) => shippingMethod.order, {
() => OrderShippingMethod,
(shippingMethod) => shippingMethod.order,
{
cascade: [Cascade.PERSIST],
}
)
shipping_methods = new Collection<Rel<OrderShippingMethod>>(this)
@OneToMany(() => Transaction, (transaction) => transaction.order, {
cascade: [Cascade.PERSIST], cascade: [Cascade.PERSIST],
}) })
transactions = new Collection<Rel<Transaction>>(this) shipping_methods = new Collection<Rel<OrderShipping>>(this)
@OneToMany(() => OrderTransaction, (transaction) => transaction.order, {
cascade: [Cascade.PERSIST],
})
transactions = new Collection<Rel<OrderTransaction>>(this)
@Property({ @Property({
onCreate: () => new Date(), onCreate: () => new Date(),
@@ -13,7 +13,7 @@ import {
PrimaryKey, PrimaryKey,
Property, Property,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import LineItem from "./line-item" import OrderLineItem from "./line-item"
import Return from "./return" import Return from "./return"
import ReturnReason from "./return-reason" import ReturnReason from "./return-reason"
@@ -98,7 +98,7 @@ export default class ReturnItem {
return: Return return: Return
@ManyToOne({ @ManyToOne({
entity: () => LineItem, entity: () => OrderLineItem,
fieldName: "item_id", fieldName: "item_id",
mapToPk: true, mapToPk: true,
columnType: "text", columnType: "text",
@@ -106,10 +106,10 @@ export default class ReturnItem {
@ItemIdIndex.MikroORMIndex() @ItemIdIndex.MikroORMIndex()
item_id: string item_id: string
@ManyToOne(() => LineItem, { @ManyToOne(() => OrderLineItem, {
persist: false, persist: false,
}) })
item: LineItem item: OrderLineItem
@Property({ columnType: "text", nullable: true }) @Property({ columnType: "text", nullable: true })
note: string note: string
+9 -13
View File
@@ -23,11 +23,11 @@ import {
Property, Property,
Rel, Rel,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import { ReturnItem, Transaction } from "@models" import { OrderTransaction, ReturnItem } from "@models"
import Claim from "./claim" import Claim from "./claim"
import Exchange from "./exchange" import Exchange from "./exchange"
import Order from "./order" import Order from "./order"
import OrderShippingMethod from "./order-shipping-method" import OrderShipping from "./order-shipping-method"
type OptionalReturnProps = DAL.ModelDateColumns type OptionalReturnProps = DAL.ModelDateColumns
@@ -136,19 +136,15 @@ export default class Return {
}) })
items = new Collection<Rel<ReturnItem>>(this) items = new Collection<Rel<ReturnItem>>(this)
@OneToMany( @OneToMany(() => OrderShipping, (shippingMethod) => shippingMethod.return, {
() => OrderShippingMethod,
(shippingMethod) => shippingMethod.return,
{
cascade: [Cascade.PERSIST],
}
)
shipping_methods = new Collection<OrderShippingMethod>(this)
@OneToMany(() => Transaction, (transaction) => transaction.return, {
cascade: [Cascade.PERSIST], cascade: [Cascade.PERSIST],
}) })
transactions = new Collection<Transaction>(this) shipping_methods = new Collection<OrderShipping>(this)
@OneToMany(() => OrderTransaction, (transaction) => transaction.return, {
cascade: [Cascade.PERSIST],
})
transactions = new Collection<OrderTransaction>(this)
@Property({ columnType: "text", nullable: true }) @Property({ columnType: "text", nullable: true })
created_by: string | null = null created_by: string | null = null
@@ -4,7 +4,7 @@ import {
} from "@medusajs/utils" } from "@medusajs/utils"
import { BeforeCreate, Entity, ManyToOne, OnInit, Rel } from "@mikro-orm/core" import { BeforeCreate, Entity, ManyToOne, OnInit, Rel } from "@mikro-orm/core"
import AdjustmentLine from "./adjustment-line" import AdjustmentLine from "./adjustment-line"
import ShippingMethod from "./shipping-method" import OrderShippingMethod from "./shipping-method"
const ShippingMethodIdIdIndex = createPsqlIndexStatementHelper({ const ShippingMethodIdIdIndex = createPsqlIndexStatementHelper({
tableName: "order_shipping_method_adjustment", tableName: "order_shipping_method_adjustment",
@@ -12,14 +12,14 @@ const ShippingMethodIdIdIndex = createPsqlIndexStatementHelper({
}) })
@Entity({ tableName: "order_shipping_method_adjustment" }) @Entity({ tableName: "order_shipping_method_adjustment" })
export default class ShippingMethodAdjustment extends AdjustmentLine { export default class OrderShippingMethodAdjustment extends AdjustmentLine {
@ManyToOne(() => ShippingMethod, { @ManyToOne(() => OrderShippingMethod, {
persist: false, persist: false,
}) })
shipping_method: Rel<ShippingMethod> shipping_method: Rel<OrderShippingMethod>
@ManyToOne({ @ManyToOne({
entity: () => ShippingMethod, entity: () => OrderShippingMethod,
columnType: "text", columnType: "text",
fieldName: "shipping_method_id", fieldName: "shipping_method_id",
mapToPk: true, mapToPk: true,
@@ -3,7 +3,7 @@ import {
generateEntityId, generateEntityId,
} from "@medusajs/utils" } from "@medusajs/utils"
import { BeforeCreate, Entity, ManyToOne, OnInit, Rel } from "@mikro-orm/core" import { BeforeCreate, Entity, ManyToOne, OnInit, Rel } from "@mikro-orm/core"
import ShippingMethod from "./shipping-method" import OrderShippingMethod from "./shipping-method"
import TaxLine from "./tax-line" import TaxLine from "./tax-line"
const ShippingMethodIdIdIndex = createPsqlIndexStatementHelper({ const ShippingMethodIdIdIndex = createPsqlIndexStatementHelper({
@@ -12,14 +12,14 @@ const ShippingMethodIdIdIndex = createPsqlIndexStatementHelper({
}) })
@Entity({ tableName: "order_shipping_method_tax_line" }) @Entity({ tableName: "order_shipping_method_tax_line" })
export default class ShippingMethodTaxLine extends TaxLine { export default class OrderShippingMethodTaxLine extends TaxLine {
@ManyToOne(() => ShippingMethod, { @ManyToOne(() => OrderShippingMethod, {
persist: false, persist: false,
}) })
shipping_method: Rel<ShippingMethod> shipping_method: Rel<OrderShippingMethod>
@ManyToOne({ @ManyToOne({
entity: () => ShippingMethod, entity: () => OrderShippingMethod,
fieldName: "shipping_method_id", fieldName: "shipping_method_id",
columnType: "text", columnType: "text",
mapToPk: true, mapToPk: true,
@@ -18,8 +18,8 @@ import {
Property, Property,
Rel, Rel,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import ShippingMethodAdjustment from "./shipping-method-adjustment" import OrderShippingMethodAdjustment from "./shipping-method-adjustment"
import ShippingMethodTaxLine from "./shipping-method-tax-line" import OrderShippingMethodTaxLine from "./shipping-method-tax-line"
const DeletedAtIndex = createPsqlIndexStatementHelper({ const DeletedAtIndex = createPsqlIndexStatementHelper({
tableName: "order_shipping_method", tableName: "order_shipping_method",
@@ -35,7 +35,7 @@ const ShippingOptionIdIndex = createPsqlIndexStatementHelper({
@Entity({ tableName: "order_shipping_method" }) @Entity({ tableName: "order_shipping_method" })
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions) @Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
export default class ShippingMethod { export default class OrderShippingMethod {
@PrimaryKey({ columnType: "text" }) @PrimaryKey({ columnType: "text" })
id: string id: string
@@ -68,22 +68,22 @@ export default class ShippingMethod {
metadata: Record<string, unknown> | null = null metadata: Record<string, unknown> | null = null
@OneToMany( @OneToMany(
() => ShippingMethodTaxLine, () => OrderShippingMethodTaxLine,
(taxLine) => taxLine.shipping_method, (taxLine) => taxLine.shipping_method,
{ {
cascade: [Cascade.PERSIST, "soft-remove" as Cascade], cascade: [Cascade.PERSIST, "soft-remove" as Cascade],
} }
) )
tax_lines = new Collection<Rel<ShippingMethodTaxLine>>(this) tax_lines = new Collection<Rel<OrderShippingMethodTaxLine>>(this)
@OneToMany( @OneToMany(
() => ShippingMethodAdjustment, () => OrderShippingMethodAdjustment,
(adjustment) => adjustment.shipping_method, (adjustment) => adjustment.shipping_method,
{ {
cascade: [Cascade.PERSIST, "soft-remove" as Cascade], cascade: [Cascade.PERSIST, "soft-remove" as Cascade],
} }
) )
adjustments = new Collection<Rel<ShippingMethodAdjustment>>(this) adjustments = new Collection<Rel<OrderShippingMethodAdjustment>>(this)
@Property({ @Property({
onCreate: () => new Date(), onCreate: () => new Date(),
@@ -77,7 +77,7 @@ const OrderIdVersionIndex = createPsqlIndexStatementHelper({
@Entity({ tableName }) @Entity({ tableName })
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions) @Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
@OrderIdVersionIndex.MikroORMIndex() @OrderIdVersionIndex.MikroORMIndex()
export default class Transaction { export default class OrderTransaction {
[OptionalProps]?: OptionalLineItemProps [OptionalProps]?: OptionalLineItemProps
@PrimaryKey({ columnType: "text" }) @PrimaryKey({ columnType: "text" })
@@ -154,7 +154,7 @@ async function processAdditionalItems(
} }
}) })
const createItems = await service.lineItemService_.create( const createItems = await service.orderLineItemService_.create(
itemsToAdd, itemsToAdd,
sharedContext sharedContext
) )
@@ -192,7 +192,7 @@ async function processShippingMethods(
let shippingMethodId let shippingMethodId
if (!isString(shippingMethod)) { if (!isString(shippingMethod)) {
const methods = await service.createShippingMethods( const methods = await service.createOrderShippingMethods(
[ [
{ {
...shippingMethod, ...shippingMethod,
@@ -207,7 +207,7 @@ async function processShippingMethods(
shippingMethodId = shippingMethod shippingMethodId = shippingMethod
} }
const method = await service.retrieveShippingMethod( const method = await service.retrieveOrderShippingMethod(
shippingMethodId, shippingMethodId,
{ relations: ["tax_lines", "adjustments"] }, { relations: ["tax_lines", "adjustments"] },
sharedContext sharedContext
@@ -243,7 +243,7 @@ async function processReturnShipping(
let returnShippingMethodId let returnShippingMethodId
if (!isString(data.return_shipping)) { if (!isString(data.return_shipping)) {
const methods = await service.createShippingMethods( const methods = await service.createOrderShippingMethods(
[ [
{ {
...data.return_shipping, ...data.return_shipping,
@@ -259,7 +259,7 @@ async function processReturnShipping(
returnShippingMethodId = data.return_shipping returnShippingMethodId = data.return_shipping
} }
const method = await service.retrieveShippingMethod( const method = await service.retrieveOrderShippingMethod(
returnShippingMethodId, returnShippingMethodId,
{ relations: ["tax_lines", "adjustments"] }, { relations: ["tax_lines", "adjustments"] },
sharedContext sharedContext
@@ -121,7 +121,7 @@ async function processAdditionalItems(
} }
}) })
const createItems = await service.lineItemService_.create( const createItems = await service.orderLineItemService_.create(
itemsToAdd, itemsToAdd,
sharedContext sharedContext
) )
@@ -161,7 +161,7 @@ async function processShippingMethods(
let shippingMethodId let shippingMethodId
if (!isString(shippingMethod)) { if (!isString(shippingMethod)) {
const methods = await service.createShippingMethods( const methods = await service.createOrderShippingMethods(
[ [
{ {
...shippingMethod, ...shippingMethod,
@@ -176,7 +176,7 @@ async function processShippingMethods(
shippingMethodId = shippingMethod shippingMethodId = shippingMethod
} }
const method = await service.retrieveShippingMethod( const method = await service.retrieveOrderShippingMethod(
shippingMethodId, shippingMethodId,
{ relations: ["tax_lines", "adjustments"] }, { relations: ["tax_lines", "adjustments"] },
sharedContext sharedContext
@@ -207,7 +207,7 @@ async function processReturnShipping(
let returnShippingMethodId let returnShippingMethodId
if (!isString(data.return_shipping)) { if (!isString(data.return_shipping)) {
const methods = await service.createShippingMethods( const methods = await service.createOrderShippingMethods(
[ [
{ {
...data.return_shipping, ...data.return_shipping,
@@ -223,7 +223,7 @@ async function processReturnShipping(
returnShippingMethodId = data.return_shipping returnShippingMethodId = data.return_shipping
} }
const method = await service.retrieveShippingMethod( const method = await service.retrieveOrderShippingMethod(
returnShippingMethodId, returnShippingMethodId,
{ relations: ["tax_lines", "adjustments"] }, { relations: ["tax_lines", "adjustments"] },
sharedContext sharedContext
@@ -64,7 +64,7 @@ async function processShippingMethod(
} }
if (!isString(data.shipping_method)) { if (!isString(data.shipping_method)) {
const methods = await service.createShippingMethods( const methods = await service.createOrderShippingMethods(
[ [
{ {
...data.shipping_method, ...data.shipping_method,
@@ -79,7 +79,7 @@ async function processShippingMethod(
shippingMethodId = data.shipping_method shippingMethodId = data.shipping_method
} }
const method = await service.retrieveShippingMethod( const method = await service.retrieveOrderShippingMethod(
shippingMethodId, shippingMethodId,
{ relations: ["tax_lines", "adjustments"] }, { relations: ["tax_lines", "adjustments"] },
sharedContext sharedContext
File diff suppressed because it is too large Load Diff