feat: line item adjustments (#1319)
* add: crud services + model + totals * fix: enforce unique constraint on line item adjustment model and update service (#1241) * add: unique constraint on model + fix service * fix: unique constraint * fix: add cascade on delete + fix discount relation * fix: remove optional unique prop * add: tests for ensuring line item adjustment db constraints (#1279) * add: tests for ensuring db constraints * fix: use given when then * feat: adjust cart to include line item adjustments (#1242) * fix: cart service + cart tests * fix: remaining tests * fix: swap tests * fix: add relationship + fix oas * refactor: applyDiscount * fix: refactor applyDiscount and fix + add unit tests * fix: plugins tests * feat: line item adjustments draft orders (#1243) * fix: draft order tests * fix: constraint * fix: wrong variable name * fix: unique constraint * progress: add tests * fix: add cascade on delete + fix discount relation * fix: remove optional unique prop * fix: cart removeLineItem + tests * fix: cart unit tests * fix: update snapshot * remove: verbose option * rename arg Co-authored-by: Sebastian Rindom <skrindom@gmail.com> * add: create adjustments for swap additional_items * add: create adjustments for return lines * fix: unit test for creating adjustment for additional_items * fix: create adjustments only for non return items + no deletion when item is a return item * add: integration tests * refactor: use refreshAdjustments method * refactor test Co-authored-by: Sebastian Rindom <skrindom@gmail.com> Co-authored-by: Sebastian Rindom <skrindom@gmail.com> Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
This commit is contained in:
@@ -297,6 +297,62 @@ describe("/admin/draft-orders", () => {
|
||||
)
|
||||
})
|
||||
|
||||
it("creates a draft order with discount and line item", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const payload = {
|
||||
email: "oli@test.dk",
|
||||
shipping_address: "oli-shipping",
|
||||
discounts: [{ code: "TEST" }],
|
||||
items: [
|
||||
{
|
||||
variant_id: "test-variant",
|
||||
quantity: 2,
|
||||
metadata: {},
|
||||
},
|
||||
],
|
||||
region_id: "test-region",
|
||||
customer_id: "oli-test",
|
||||
shipping_methods: [
|
||||
{
|
||||
option_id: "test-option",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const response = await api
|
||||
.post("/admin/draft-orders", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
const draftOrder = response.data.draft_order
|
||||
const lineItemId = draftOrder.cart.items[0].id
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(draftOrder.cart.items).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
variant_id: "test-variant",
|
||||
unit_price: 8000,
|
||||
quantity: 2,
|
||||
adjustments: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
item_id: lineItemId,
|
||||
amount: 1600,
|
||||
description: "discount",
|
||||
discount_id: "test-discount",
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
])
|
||||
)
|
||||
})
|
||||
|
||||
it("creates a draft order with created shipping address", async () => {
|
||||
const api = useApi()
|
||||
|
||||
|
||||
@@ -1555,6 +1555,116 @@ describe("/admin/orders", () => {
|
||||
expect(response.status).toEqual(200)
|
||||
})
|
||||
|
||||
describe("Given an existing discount order", () => {
|
||||
describe("When a store operator attemps to create a swap form the discount order", () => {
|
||||
it("Then should successfully create the swap", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api.post(
|
||||
"/admin/orders/test-order/swaps",
|
||||
{
|
||||
return_items: [
|
||||
{
|
||||
item_id: "test-item",
|
||||
quantity: 1,
|
||||
},
|
||||
],
|
||||
additional_items: [{ variant_id: "test-variant-2", quantity: 1 }],
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
const swapCartId = response.data.order.swaps[0].cart_id
|
||||
|
||||
const swapCartRes = await api.get(`/store/carts/${swapCartId}`, {
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
})
|
||||
const cart = swapCartRes.data.cart
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(cart.items.length).toEqual(2)
|
||||
expect(cart.items).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
unit_price: -8000,
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: -800,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
expect.objectContaining({
|
||||
unit_price: 8000,
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: 800,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
)
|
||||
expect(cart.total).toEqual(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe("And given a swap cart", () => {
|
||||
describe("When a line item is added to the swap cart", () => {
|
||||
it("Then should not delete existing return line item adjustments", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const createSwapRes = await api.post(
|
||||
"/admin/orders/test-order/swaps",
|
||||
{
|
||||
return_items: [
|
||||
{
|
||||
item_id: "test-item",
|
||||
quantity: 1,
|
||||
},
|
||||
],
|
||||
additional_items: [{ variant_id: "test-variant", quantity: 1 }],
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
const swapCartId = createSwapRes.data.order.swaps[0].cart_id
|
||||
|
||||
const response = await api.post(
|
||||
`/store/carts/${swapCartId}/line-items`,
|
||||
{
|
||||
variant_id: "test-variant-2",
|
||||
quantity: 1,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
const cart = response.data.cart
|
||||
const items = cart.items
|
||||
const [returnItem] = items.filter((i) => i.is_return)
|
||||
expect(returnItem.adjustments).toEqual([
|
||||
expect.objectContaining({
|
||||
amount: -800,
|
||||
}),
|
||||
])
|
||||
expect(cart.total).toBe(7200)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it("creates a swap with custom shipping options", async () => {
|
||||
const api = useApi()
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ exports[`Claims creates a replace claim 1`] = `
|
||||
Object {
|
||||
"additional_items": Array [
|
||||
Object {
|
||||
"adjustments": Array [],
|
||||
"allow_discounts": true,
|
||||
"cart_id": null,
|
||||
"claim_order_id": StringMatching /\\^claim_\\*/,
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
const path = require("path")
|
||||
const { LineItemAdjustment } = require("@medusajs/medusa")
|
||||
const setupServer = require("../../../helpers/setup-server")
|
||||
const { useApi } = require("../../../helpers/use-api")
|
||||
const { initDb, useDb } = require("../../../helpers/use-db")
|
||||
const cartSeeder = require("../../helpers/cart-seeder")
|
||||
const { simpleCartFactory, simpleLineItemFactory } = require("../../factories")
|
||||
const {
|
||||
simpleDiscountFactory,
|
||||
} = require("../../factories/simple-discount-factory")
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
describe("Line Item Adjustments", () => {
|
||||
let dbConnection
|
||||
let medusaProcess
|
||||
|
||||
const doAfterEach = async () => {
|
||||
const db = useDb()
|
||||
return await db.teardown()
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||
try {
|
||||
dbConnection = await initDb({ cwd })
|
||||
medusaProcess = await setupServer({ cwd })
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
const db = useDb()
|
||||
await db.shutdown()
|
||||
medusaProcess.kill()
|
||||
})
|
||||
|
||||
describe("Tests database constraints", () => {
|
||||
let cart,
|
||||
discount,
|
||||
lineItemId = "line-test"
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await cartSeeder(dbConnection)
|
||||
discount = await simpleDiscountFactory(dbConnection, {
|
||||
code: "MEDUSATEST",
|
||||
id: "discount-test",
|
||||
rule: {
|
||||
value: 100,
|
||||
type: "fixed",
|
||||
allocation: "total",
|
||||
},
|
||||
regions: ["test-region"],
|
||||
})
|
||||
cart = await simpleCartFactory(
|
||||
dbConnection,
|
||||
{
|
||||
customer: "test-customer",
|
||||
id: "cart-test",
|
||||
line_items: [
|
||||
{
|
||||
id: lineItemId,
|
||||
variant_id: "test-variant",
|
||||
cart_id: "cart-test",
|
||||
unit_price: 1000,
|
||||
quantity: 1,
|
||||
adjustments: [
|
||||
{
|
||||
amount: 10,
|
||||
discount_id: discount.id,
|
||||
description: "discount",
|
||||
item_id: lineItemId,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
region: "test-region",
|
||||
shipping_address: {
|
||||
address_1: "test",
|
||||
country_code: "us",
|
||||
first_name: "chris",
|
||||
last_name: "rock",
|
||||
postal_code: "101",
|
||||
},
|
||||
shipping_methods: [
|
||||
{
|
||||
shipping_option: "test-option",
|
||||
},
|
||||
],
|
||||
},
|
||||
100
|
||||
)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await doAfterEach()
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await doAfterEach()
|
||||
})
|
||||
|
||||
describe("Given an existing line item, a discount, and a line item adjustment for both", () => {
|
||||
describe("When creating an adjustment for another line item w. same discount", () => {
|
||||
test("Then should create an adjustment", async () => {
|
||||
const createLineItemWithAdjustment = async () => {
|
||||
return await simpleLineItemFactory(dbConnection, {
|
||||
id: "line-test-2",
|
||||
variant_id: "test-variant-quantity",
|
||||
cart_id: "test-cart",
|
||||
unit_price: 1000,
|
||||
quantity: 1,
|
||||
adjustments: [
|
||||
{
|
||||
amount: 10,
|
||||
discount_id: discount.id,
|
||||
description: "discount",
|
||||
item_id: "line-test-2",
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
expect(createLineItemWithAdjustment()).resolves.toEqual(
|
||||
expect.anything()
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("When creating an adjustment for another line item w. null discount", () => {
|
||||
test("Then should create an adjustment", async () => {
|
||||
const createAdjustmentNullDiscount = async () => {
|
||||
return await dbConnection.manager.insert(LineItemAdjustment, {
|
||||
id: "lia-1",
|
||||
item_id: lineItemId,
|
||||
amount: 35,
|
||||
description: "custom discount",
|
||||
discount_id: null,
|
||||
})
|
||||
}
|
||||
|
||||
expect(createAdjustmentNullDiscount()).resolves.toEqual(
|
||||
expect.anything()
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("When creating multiple adjustments w. a null discount_id", () => {
|
||||
test("Then should create multiple adjustments", async () => {
|
||||
const createAdjustmentsNullDiscount = async () => {
|
||||
await dbConnection.manager.insert(LineItemAdjustment, {
|
||||
id: "lia-1",
|
||||
item_id: lineItemId,
|
||||
amount: 35,
|
||||
description: "custom discount",
|
||||
discount_id: null,
|
||||
})
|
||||
return await dbConnection.manager.insert(LineItemAdjustment, {
|
||||
id: "lia-2",
|
||||
item_id: lineItemId,
|
||||
amount: 100,
|
||||
description: "custom discount",
|
||||
discount_id: null,
|
||||
})
|
||||
}
|
||||
expect(createAdjustmentsNullDiscount()).resolves.toEqual(
|
||||
expect.anything()
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("When creating an adjustment w. for same line item and different discount", () => {
|
||||
test("Then should create an adjustment", async () => {
|
||||
const createAdjustment = async () => {
|
||||
await simpleDiscountFactory(dbConnection, {
|
||||
code: "ANOTHER",
|
||||
id: "discount-2",
|
||||
rule: {
|
||||
value: 10,
|
||||
type: "percentage",
|
||||
allocation: "item",
|
||||
},
|
||||
regions: ["test-region"],
|
||||
})
|
||||
|
||||
return await dbConnection.manager.insert(LineItemAdjustment, {
|
||||
id: "lia-1",
|
||||
item_id: lineItemId,
|
||||
amount: 10,
|
||||
description: "discount",
|
||||
discount_id: "discount-2",
|
||||
})
|
||||
}
|
||||
|
||||
expect(createAdjustment()).resolves.toEqual(expect.anything())
|
||||
})
|
||||
})
|
||||
|
||||
describe("When creating an adjustment w. existing line item and discount pair", () => {
|
||||
test("Then should throw a duplicate error", async () => {
|
||||
const createDuplicateAdjustment = async () =>
|
||||
await dbConnection.manager.insert(LineItemAdjustment, {
|
||||
id: "lia-1",
|
||||
item_id: lineItemId,
|
||||
amount: 20,
|
||||
description: "discount",
|
||||
discount_id: discount.id,
|
||||
})
|
||||
|
||||
expect(createDuplicateAdjustment()).rejects.toEqual(
|
||||
expect.objectContaining({ code: "23505" })
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -259,6 +259,14 @@ const createReturnableOrder = async (dbConnection, options) => {
|
||||
variant_id: "test-variant",
|
||||
quantity: 2,
|
||||
unit_price: 1000,
|
||||
adjustments: [
|
||||
{
|
||||
amount: 200,
|
||||
discount_code: "TESTCODE",
|
||||
description: "discount",
|
||||
item_id: "test-item",
|
||||
},
|
||||
],
|
||||
tax_lines: [
|
||||
{
|
||||
name: "default",
|
||||
|
||||
@@ -16,7 +16,7 @@ const { initDb, useDb } = require("../../../helpers/use-db")
|
||||
const cartSeeder = require("../../helpers/cart-seeder")
|
||||
const productSeeder = require("../../helpers/product-seeder")
|
||||
const swapSeeder = require("../../helpers/swap-seeder")
|
||||
const { simpleCartFactory } = require("../../factories")
|
||||
const { simpleCartFactory, simpleLineItemFactory } = require("../../factories")
|
||||
const {
|
||||
simpleDiscountFactory,
|
||||
} = require("../../factories/simple-discount-factory")
|
||||
@@ -235,6 +235,131 @@ describe("/store/carts", () => {
|
||||
unit_price: 1000,
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 1,
|
||||
adjustments: [],
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("adds line item to cart containing a total fixed discount", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/test-cart-w-total-fixed-discount/line-items",
|
||||
{
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 2,
|
||||
},
|
||||
{ withCredentials: true }
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items).toEqual([
|
||||
expect.objectContaining({
|
||||
cart_id: "test-cart-w-total-fixed-discount",
|
||||
unit_price: 1000,
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 2,
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: 100,
|
||||
discount_id: "total-fixed-100",
|
||||
description: "discount",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("adds line item to cart containing a total percentage discount", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/test-cart-w-total-percentage-discount/line-items",
|
||||
{
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 2,
|
||||
},
|
||||
{ withCredentials: true }
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items).toEqual([
|
||||
expect.objectContaining({
|
||||
cart_id: "test-cart-w-total-percentage-discount",
|
||||
unit_price: 1000,
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 2,
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: 200,
|
||||
discount_id: "10Percent",
|
||||
description: "discount",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("adds line item to cart containing an item fixed discount", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/test-cart-w-item-fixed-discount/line-items",
|
||||
{
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 2,
|
||||
},
|
||||
{ withCredentials: true }
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items).toEqual([
|
||||
expect.objectContaining({
|
||||
cart_id: "test-cart-w-item-fixed-discount",
|
||||
unit_price: 1000,
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 2,
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: 400,
|
||||
discount_id: "item-fixed-200",
|
||||
description: "discount",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("adds line item to cart containing an item percentage discount", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/test-cart-w-item-percentage-discount/line-items",
|
||||
{
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 2,
|
||||
},
|
||||
{ withCredentials: true }
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items).toEqual([
|
||||
expect.objectContaining({
|
||||
cart_id: "test-cart-w-item-percentage-discount",
|
||||
unit_price: 1000,
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 2,
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: 300,
|
||||
discount_id: "item-percentage-15",
|
||||
description: "discount",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
})
|
||||
@@ -242,7 +367,6 @@ describe("/store/carts", () => {
|
||||
it("adds line item to cart time limited sale", async () => {
|
||||
const api = useApi()
|
||||
|
||||
// Add standard line item to cart
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/test-cart/line-items",
|
||||
@@ -305,7 +429,6 @@ describe("/store/carts", () => {
|
||||
it("adds line item with quantity to cart with quantity discount", async () => {
|
||||
const api = useApi()
|
||||
|
||||
// Add standard line item to cart
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/test-cart/line-items",
|
||||
@@ -330,7 +453,6 @@ describe("/store/carts", () => {
|
||||
it("adds line item with quantity to cart with quantity discount no ceiling", async () => {
|
||||
const api = useApi()
|
||||
|
||||
// Add standard line item to cart
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/test-cart/line-items",
|
||||
@@ -351,6 +473,421 @@ describe("/store/carts", () => {
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
describe("ensures correct line item adjustment generation", () => {
|
||||
const discountData = {
|
||||
code: "MEDUSA185DKK",
|
||||
id: "medusa-185",
|
||||
rule: {
|
||||
allocation: "total",
|
||||
type: "fixed",
|
||||
value: 185,
|
||||
},
|
||||
regions: ["test-region"],
|
||||
}
|
||||
|
||||
let discountCart, discount
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
discount = await simpleDiscountFactory(
|
||||
dbConnection,
|
||||
discountData,
|
||||
100
|
||||
)
|
||||
discountCart = await simpleCartFactory(
|
||||
dbConnection,
|
||||
{
|
||||
id: "discount-cart",
|
||||
customer: "test-customer",
|
||||
region: "test-region",
|
||||
shipping_address: {
|
||||
address_1: "next door",
|
||||
first_name: "lebron",
|
||||
last_name: "james",
|
||||
country_code: "dk",
|
||||
postal_code: "100",
|
||||
},
|
||||
line_items: [
|
||||
{
|
||||
id: "test-li",
|
||||
variant_id: "test-variant",
|
||||
quantity: 1,
|
||||
unit_price: 100,
|
||||
adjustments: [
|
||||
{
|
||||
amount: 185,
|
||||
description: "discount",
|
||||
discount_id: "medusa-185",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
shipping_methods: [
|
||||
{
|
||||
shipping_option: "test-option",
|
||||
price: 1000,
|
||||
},
|
||||
],
|
||||
},
|
||||
100
|
||||
)
|
||||
await dbConnection.manager
|
||||
.createQueryBuilder()
|
||||
.relation(Cart, "discounts")
|
||||
.of(discountCart)
|
||||
.add(discount)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await doAfterEach()
|
||||
})
|
||||
|
||||
it("updates an old line item adjustment when a new line item is added to a discount cart", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/discount-cart/line-items",
|
||||
{
|
||||
quantity: 1,
|
||||
variant_id: "test-variant-quantity",
|
||||
},
|
||||
{
|
||||
withCredentials: true,
|
||||
}
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items.length).toEqual(2)
|
||||
expect(response.data.cart.items).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
item_id: "test-li",
|
||||
amount: 17,
|
||||
discount_id: "medusa-185",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
expect.objectContaining({
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: 168,
|
||||
discount_id: "medusa-185",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
)
|
||||
})
|
||||
|
||||
it("updates an existing item adjustment when a line item is updated", async () => {
|
||||
const api = useApi()
|
||||
|
||||
await simpleLineItemFactory(
|
||||
dbConnection,
|
||||
{
|
||||
id: "line-item-2",
|
||||
cart_id: discountCart.id,
|
||||
variant_id: "test-variant-quantity",
|
||||
unit_price: 950,
|
||||
quantity: 1,
|
||||
adjustments: [
|
||||
{
|
||||
id: "lia-2",
|
||||
amount: 92,
|
||||
description: "discount",
|
||||
discount_id: "medusa-185",
|
||||
},
|
||||
],
|
||||
},
|
||||
100
|
||||
)
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/discount-cart/line-items/line-item-2",
|
||||
{
|
||||
quantity: 2,
|
||||
},
|
||||
{
|
||||
withCredentials: true,
|
||||
}
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items.length).toEqual(2)
|
||||
expect(response.data.cart.items).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
item_id: "test-li",
|
||||
discount_id: "medusa-185",
|
||||
amount: 9,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
expect.objectContaining({
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
item_id: "line-item-2",
|
||||
amount: 176,
|
||||
discount_id: "medusa-185",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
)
|
||||
})
|
||||
|
||||
it("updates an existing item adjustment when a line item is deleted from a discount cart", async () => {
|
||||
const api = useApi()
|
||||
|
||||
await simpleLineItemFactory(
|
||||
dbConnection,
|
||||
{
|
||||
id: "line-item-2",
|
||||
cart_id: discountCart.id,
|
||||
variant_id: "test-variant-quantity",
|
||||
unit_price: 1000,
|
||||
quantity: 1,
|
||||
adjustments: [
|
||||
{
|
||||
id: "lia-2",
|
||||
amount: 93,
|
||||
description: "discount",
|
||||
discount_id: "medusa-185",
|
||||
},
|
||||
],
|
||||
},
|
||||
100
|
||||
)
|
||||
|
||||
const response = await api
|
||||
.delete("/store/carts/discount-cart/line-items/test-li", {
|
||||
withCredentials: true,
|
||||
})
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items.length).toEqual(1)
|
||||
expect(response.data.cart.items).toEqual([
|
||||
expect.objectContaining({
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
item_id: "line-item-2",
|
||||
amount: 185,
|
||||
discount_id: "medusa-185",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("POST /store/carts/:id/line-items/:line_id", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await cartSeeder(dbConnection)
|
||||
await swapSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await doAfterEach()
|
||||
})
|
||||
|
||||
it("updates line item of cart", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/test-cart-3/line-items/test-item3/",
|
||||
{
|
||||
quantity: 3,
|
||||
},
|
||||
{ withCredentials: true }
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items).toEqual([
|
||||
expect.objectContaining({
|
||||
cart_id: "test-cart-3",
|
||||
unit_price: 8000,
|
||||
variant_id: "test-variant-sale-cg",
|
||||
quantity: 3,
|
||||
adjustments: [],
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("updates line item of a cart containing a total fixed discount", async () => {
|
||||
const api = useApi()
|
||||
await simpleLineItemFactory(dbConnection, {
|
||||
id: "test-li-disc",
|
||||
allow_discounts: true,
|
||||
title: "Line Item Disc",
|
||||
thumbnail: "https://test.js/1234",
|
||||
unit_price: 1000,
|
||||
quantity: 1,
|
||||
variant_id: "test-variant-quantity",
|
||||
cart_id: "test-cart-w-total-fixed-discount",
|
||||
})
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
`store/carts/test-cart-w-total-fixed-discount/line-items/test-li-disc`,
|
||||
{
|
||||
quantity: 3,
|
||||
},
|
||||
{ withCredentials: true }
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items).toEqual([
|
||||
expect.objectContaining({
|
||||
cart_id: "test-cart-w-total-fixed-discount",
|
||||
unit_price: 1000,
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 3,
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: 100,
|
||||
discount_id: "total-fixed-100",
|
||||
description: "discount",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("updates line item of a cart containing a total percentage discount", async () => {
|
||||
const api = useApi()
|
||||
await simpleLineItemFactory(dbConnection, {
|
||||
id: "test-li-disc",
|
||||
allow_discounts: true,
|
||||
title: "Line Item Disc",
|
||||
thumbnail: "https://test.js/1234",
|
||||
unit_price: 1000,
|
||||
quantity: 1,
|
||||
variant_id: "test-variant-quantity",
|
||||
cart_id: "test-cart-w-total-percentage-discount",
|
||||
})
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/test-cart-w-total-percentage-discount/line-items/test-li-disc",
|
||||
{
|
||||
quantity: 10,
|
||||
},
|
||||
{ withCredentials: true }
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items).toEqual([
|
||||
expect.objectContaining({
|
||||
cart_id: "test-cart-w-total-percentage-discount",
|
||||
unit_price: 1000,
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 10,
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: 1000,
|
||||
discount_id: "10Percent",
|
||||
description: "discount",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("updates line item of a cart containing an item fixed discount", async () => {
|
||||
const api = useApi()
|
||||
await simpleLineItemFactory(dbConnection, {
|
||||
id: "test-li-disc",
|
||||
allow_discounts: true,
|
||||
title: "Line Item Disc",
|
||||
thumbnail: "https://test.js/1234",
|
||||
unit_price: 1000,
|
||||
quantity: 1,
|
||||
variant_id: "test-variant-quantity",
|
||||
cart_id: "test-cart-w-item-fixed-discount",
|
||||
})
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/test-cart-w-item-fixed-discount/line-items/test-li-disc",
|
||||
{
|
||||
quantity: 4,
|
||||
},
|
||||
{ withCredentials: true }
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items).toEqual([
|
||||
expect.objectContaining({
|
||||
cart_id: "test-cart-w-item-fixed-discount",
|
||||
unit_price: 1000,
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 4,
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: 800,
|
||||
discount_id: "item-fixed-200",
|
||||
description: "discount",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("updates line item of a cart containing an item percentage discount", async () => {
|
||||
const api = useApi()
|
||||
await simpleLineItemFactory(dbConnection, {
|
||||
id: "test-li-disc",
|
||||
allow_discounts: true,
|
||||
title: "Line Item Disc",
|
||||
thumbnail: "https://test.js/1234",
|
||||
unit_price: 1000,
|
||||
quantity: 1,
|
||||
variant_id: "test-variant-quantity",
|
||||
cart_id: "test-cart-w-item-percentage-discount",
|
||||
})
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/store/carts/test-cart-w-item-percentage-discount/line-items/test-li-disc",
|
||||
{
|
||||
quantity: 3,
|
||||
},
|
||||
{ withCredentials: true }
|
||||
)
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.data.cart.items).toEqual([
|
||||
expect.objectContaining({
|
||||
cart_id: "test-cart-w-item-percentage-discount",
|
||||
unit_price: 1000,
|
||||
variant_id: "test-variant-quantity",
|
||||
quantity: 3,
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
amount: 450,
|
||||
discount_id: "item-percentage-15",
|
||||
description: "discount",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe("POST /store/carts/:id", () => {
|
||||
@@ -1202,6 +1739,22 @@ describe("/store/carts", () => {
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
// Ensure that the discount is only applied to the standard item
|
||||
const itemId = cartWithGiftcard.data.cart.items[0].id
|
||||
expect(cartWithGiftcard.data.cart.items).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
variant_id: "test-variant",
|
||||
quantity: 1,
|
||||
adjustments: [
|
||||
expect.objectContaining({
|
||||
discount_id: "10Percent",
|
||||
amount: 100,
|
||||
item_id: itemId,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
])
|
||||
)
|
||||
expect(cartWithGiftcard.data.cart.total).toBe(1900) // 1000 (giftcard) + 900 (standard item with 10% discount)
|
||||
expect(cartWithGiftcard.data.cart.discount_total).toBe(100)
|
||||
expect(cartWithGiftcard.status).toEqual(200)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Connection } from "typeorm"
|
||||
import faker from "faker"
|
||||
import { LineItem, LineItemTaxLine } from "@medusajs/medusa"
|
||||
import { LineItem, LineItemAdjustment, LineItemTaxLine } from "@medusajs/medusa"
|
||||
|
||||
type TaxLineFactoryData = {
|
||||
rate: number
|
||||
@@ -8,6 +8,11 @@ type TaxLineFactoryData = {
|
||||
name: string
|
||||
}
|
||||
|
||||
type LineItemAdjustmentFactoryData = Omit<LineItemAdjustment, "discount_id"> & {
|
||||
discount_id: string
|
||||
discount_code: string
|
||||
}
|
||||
|
||||
export type LineItemFactoryData = {
|
||||
id?: string
|
||||
cart_id?: string
|
||||
@@ -24,6 +29,7 @@ export type LineItemFactoryData = {
|
||||
shipped_quantity?: boolean
|
||||
returned_quantity?: boolean
|
||||
tax_lines?: TaxLineFactoryData[]
|
||||
adjustments: LineItemAdjustmentFactoryData[]
|
||||
}
|
||||
|
||||
export const simpleLineItemFactory = async (
|
||||
@@ -63,6 +69,7 @@ export const simpleLineItemFactory = async (
|
||||
fulfilled_quantity: data.fulfilled_quantity || null,
|
||||
shipped_quantity: data.shipped_quantity || null,
|
||||
returned_quantity: data.returned_quantity || null,
|
||||
adjustments: data.adjustments,
|
||||
})
|
||||
|
||||
const line = await manager.save(toSave)
|
||||
|
||||
@@ -101,7 +101,17 @@ export const simpleOrderFactory = async (
|
||||
await simpleShippingMethodFactory(connection, { ...sm, order_id: order.id })
|
||||
}
|
||||
|
||||
const items = data.line_items
|
||||
const items = data.line_items.map((item) => {
|
||||
let adjustments = item?.adjustments || []
|
||||
return {
|
||||
...item,
|
||||
adjustments: adjustments.map((adj) => ({
|
||||
...adj,
|
||||
discount_id: discounts.find((d) => d.code === adj?.discount_code),
|
||||
})),
|
||||
}
|
||||
})
|
||||
|
||||
for (const item of items) {
|
||||
await simpleLineItemFactory(connection, { ...item, order_id: id })
|
||||
}
|
||||
|
||||
@@ -144,6 +144,69 @@ module.exports = async (connection, data = {}) => {
|
||||
tenPercent.rule = tenPercentRule
|
||||
await manager.save(tenPercent)
|
||||
|
||||
const totalFixed100Rule = manager.create(DiscountRule, {
|
||||
id: "total-fixed-100-rule",
|
||||
description: "Fixed 100 total",
|
||||
type: "fixed",
|
||||
value: 100,
|
||||
allocation: "total",
|
||||
})
|
||||
|
||||
const totalFixed100 = manager.create(Discount, {
|
||||
id: "total-fixed-100",
|
||||
code: "FIXED100",
|
||||
is_dynamic: false,
|
||||
is_disabled: false,
|
||||
starts_at: tenDaysAgo,
|
||||
ends_at: tenDaysFromToday,
|
||||
})
|
||||
|
||||
totalFixed100.regions = [r]
|
||||
totalFixed100.rule = totalFixed100Rule
|
||||
await manager.save(totalFixed100)
|
||||
|
||||
const itemFixed200Rule = manager.create(DiscountRule, {
|
||||
id: "item-fixed-200-rule",
|
||||
description: "Item 200 fixed",
|
||||
type: "fixed",
|
||||
value: 200,
|
||||
allocation: "item",
|
||||
})
|
||||
|
||||
const itemFixed200 = manager.create(Discount, {
|
||||
id: "item-fixed-200",
|
||||
code: "FIXED200",
|
||||
is_dynamic: false,
|
||||
is_disabled: false,
|
||||
starts_at: tenDaysAgo,
|
||||
ends_at: tenDaysFromToday,
|
||||
})
|
||||
|
||||
itemFixed200.regions = [r]
|
||||
itemFixed200.rule = itemFixed200Rule
|
||||
await manager.save(itemFixed200)
|
||||
|
||||
const itemPerc15Rule = manager.create(DiscountRule, {
|
||||
id: "item-percentage-15-rule",
|
||||
description: "Item 15 percentage",
|
||||
type: "percentage",
|
||||
value: 15,
|
||||
allocation: "item",
|
||||
})
|
||||
|
||||
const itemPerc15 = manager.create(Discount, {
|
||||
id: "item-percentage-15",
|
||||
code: "15PERCENT",
|
||||
is_dynamic: false,
|
||||
is_disabled: false,
|
||||
starts_at: tenDaysAgo,
|
||||
ends_at: tenDaysFromToday,
|
||||
})
|
||||
|
||||
itemPerc15.regions = [r]
|
||||
itemPerc15.rule = itemPerc15Rule
|
||||
await manager.save(itemPerc15)
|
||||
|
||||
const dUsageLimit = await manager.create(Discount, {
|
||||
id: "test-discount-usage-limit",
|
||||
code: "SPENT",
|
||||
@@ -570,6 +633,74 @@ module.exports = async (connection, data = {}) => {
|
||||
|
||||
await manager.save(cart)
|
||||
|
||||
const cartWithTotalFixedDiscount = manager.create(Cart, {
|
||||
id: "test-cart-w-total-fixed-discount",
|
||||
customer_id: "some-customer",
|
||||
email: "some-customer@email.com",
|
||||
discounts: [totalFixed100],
|
||||
shipping_address: {
|
||||
id: "test-shipping-address",
|
||||
first_name: "lebron",
|
||||
country_code: "us",
|
||||
},
|
||||
region_id: "test-region",
|
||||
currency_code: "usd",
|
||||
items: [],
|
||||
})
|
||||
|
||||
await manager.save(cartWithTotalFixedDiscount)
|
||||
|
||||
const cartWithItemFixedDiscount = manager.create(Cart, {
|
||||
id: "test-cart-w-item-fixed-discount",
|
||||
customer_id: "some-customer",
|
||||
email: "some-customer@email.com",
|
||||
discounts: [itemFixed200],
|
||||
shipping_address: {
|
||||
id: "test-shipping-address",
|
||||
first_name: "lebron",
|
||||
country_code: "us",
|
||||
},
|
||||
region_id: "test-region",
|
||||
currency_code: "usd",
|
||||
items: [],
|
||||
})
|
||||
|
||||
await manager.save(cartWithItemFixedDiscount)
|
||||
|
||||
const cartWithTotalPercDiscount = manager.create(Cart, {
|
||||
id: "test-cart-w-total-percentage-discount",
|
||||
customer_id: "some-customer",
|
||||
email: "some-customer@email.com",
|
||||
discounts: [tenPercent],
|
||||
shipping_address: {
|
||||
id: "test-shipping-address",
|
||||
first_name: "lebron",
|
||||
country_code: "us",
|
||||
},
|
||||
region_id: "test-region",
|
||||
currency_code: "usd",
|
||||
items: [],
|
||||
})
|
||||
|
||||
await manager.save(cartWithTotalPercDiscount)
|
||||
|
||||
const cartWithItemPercDiscount = manager.create(Cart, {
|
||||
id: "test-cart-w-item-percentage-discount",
|
||||
customer_id: "some-customer",
|
||||
email: "some-customer@email.com",
|
||||
discounts: [itemPerc15],
|
||||
shipping_address: {
|
||||
id: "test-shipping-address",
|
||||
first_name: "lebron",
|
||||
country_code: "us",
|
||||
},
|
||||
region_id: "test-region",
|
||||
currency_code: "usd",
|
||||
items: [],
|
||||
})
|
||||
|
||||
await manager.save(cartWithItemPercDiscount)
|
||||
|
||||
const cart2 = manager.create(Cart, {
|
||||
id: "test-cart-2",
|
||||
customer_id: "some-customer",
|
||||
|
||||
@@ -173,6 +173,14 @@ module.exports = async (connection, data = {}) => {
|
||||
quantity: 1,
|
||||
variant_id: "test-variant",
|
||||
order_id: "test-order",
|
||||
adjustments: [
|
||||
{
|
||||
amount: 800,
|
||||
discount_id: "test-discount",
|
||||
description: "discount",
|
||||
item_id: "test-item",
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
await manager.save(li)
|
||||
|
||||
@@ -349,7 +349,7 @@ const createSwap = async (options, manager) => {
|
||||
is_disabled: false,
|
||||
rule: dRule,
|
||||
})
|
||||
await manager.save(discount)
|
||||
let discountDb = await manager.save(discount)
|
||||
|
||||
const cart = manager.create(Cart, {
|
||||
id: `${swapId}-cart`,
|
||||
@@ -396,6 +396,14 @@ const createSwap = async (options, manager) => {
|
||||
thumbnail: "https://test.js/1234",
|
||||
unit_price: 8000,
|
||||
quantity: 1,
|
||||
adjustments: [
|
||||
{
|
||||
amount: -800,
|
||||
description: "discount",
|
||||
discount_id: discountDb.id,
|
||||
item_id: `${swapId}-return-item-1`,
|
||||
},
|
||||
],
|
||||
variant_id: "test-variant",
|
||||
order_id: "order-with-swap",
|
||||
cart_id: cart.id,
|
||||
@@ -419,6 +427,7 @@ const createSwap = async (options, manager) => {
|
||||
|
||||
const return_item1 = manager.create(LineItem, {
|
||||
...li,
|
||||
is_return: true,
|
||||
unit_price: -1 * li.unit_price,
|
||||
})
|
||||
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
"build": "babel src -d dist --extensions \".ts,.js\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@medusajs/medusa": "1.2.1-dev-1648026403166",
|
||||
"@medusajs/medusa": "1.2.1-dev-1649181615374",
|
||||
"faker": "^5.5.3",
|
||||
"medusa-interfaces": "1.2.1-dev-1648026403166",
|
||||
"medusa-interfaces": "1.2.1-dev-1649181615374",
|
||||
"typeorm": "^0.2.31"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.12.10",
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/node": "^7.12.10",
|
||||
"babel-preset-medusa-package": "1.1.19-dev-1648026403166",
|
||||
"babel-preset-medusa-package": "1.1.19-dev-1649181615374",
|
||||
"jest": "^26.6.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1301,10 +1301,10 @@
|
||||
"@jridgewell/resolve-uri" "^3.0.3"
|
||||
"@jridgewell/sourcemap-codec" "^1.4.10"
|
||||
|
||||
"@medusajs/medusa-cli@1.2.1-dev-1648026403166":
|
||||
version "1.2.1-dev-1648026403166"
|
||||
resolved "http://localhost:4873/@medusajs%2fmedusa-cli/-/medusa-cli-1.2.1-dev-1648026403166.tgz#1dc2ad62ba11421d43357596c61eb0b76d3bc69e"
|
||||
integrity sha512-TScUnBuxI5V5cB6gAAGeGOZU8lXYHIhozpelDcYibZqaHEIwMNs1ekzRYhfMjYowSFCMLlzCsHFUh+gqU/6WSw==
|
||||
"@medusajs/medusa-cli@1.2.1-dev-1649181615374":
|
||||
version "1.2.1-dev-1649181615374"
|
||||
resolved "http://localhost:4873/@medusajs%2fmedusa-cli/-/medusa-cli-1.2.1-dev-1649181615374.tgz#1ea9014e3ec9813a52457b0d6e2fc6bb64d3bfd6"
|
||||
integrity sha512-8m6Z1ZZqstZKaAaKoFS3v3IzI7BFhcBgpF+iCSRuJoXltQgzVQOAxXuPjkRoi+m1ZZ+Yi/YYEzKmNQ99vmXisQ==
|
||||
dependencies:
|
||||
"@babel/polyfill" "^7.8.7"
|
||||
"@babel/runtime" "^7.9.6"
|
||||
@@ -1322,8 +1322,8 @@
|
||||
is-valid-path "^0.1.1"
|
||||
joi-objectid "^3.0.1"
|
||||
meant "^1.0.1"
|
||||
medusa-core-utils "1.1.31-dev-1648026403166"
|
||||
medusa-telemetry "0.0.11-dev-1648026403166"
|
||||
medusa-core-utils "1.1.31-dev-1649181615374"
|
||||
medusa-telemetry "0.0.11-dev-1649181615374"
|
||||
netrc-parser "^3.1.6"
|
||||
open "^8.0.6"
|
||||
ora "^5.4.1"
|
||||
@@ -1337,13 +1337,13 @@
|
||||
winston "^3.3.3"
|
||||
yargs "^15.3.1"
|
||||
|
||||
"@medusajs/medusa@1.2.1-dev-1648026403166":
|
||||
version "1.2.1-dev-1648026403166"
|
||||
resolved "http://localhost:4873/@medusajs%2fmedusa/-/medusa-1.2.1-dev-1648026403166.tgz#f6e8fab09ac73b38ed79e15d2080e7ecad80fd99"
|
||||
integrity sha512-ufYVgcKo+bsAzSnZA3FVLmxseDwnSKkSbIdktQUSZGMJTRvN/+Wcqnjdf59oH11jqqBApJ8T77Nvd/ABasjTWw==
|
||||
"@medusajs/medusa@1.2.1-dev-1649181615374":
|
||||
version "1.2.1-dev-1649181615374"
|
||||
resolved "http://localhost:4873/@medusajs%2fmedusa/-/medusa-1.2.1-dev-1649181615374.tgz#6a62f8628b84b47a8717e9e0c276f3a9c2e376ce"
|
||||
integrity sha512-eiCGE6JqYuP7GCzTBGg5LI9U0uQ0wlsR+NuMZVEwldj+xc7qwMjBJwUA7gc58gBv6JesfMYj3VZmJComN4+7Bg==
|
||||
dependencies:
|
||||
"@hapi/joi" "^16.1.8"
|
||||
"@medusajs/medusa-cli" "1.2.1-dev-1648026403166"
|
||||
"@medusajs/medusa-cli" "1.2.1-dev-1649181615374"
|
||||
"@types/lodash" "^4.14.168"
|
||||
awilix "^4.2.3"
|
||||
body-parser "^1.19.0"
|
||||
@@ -1367,8 +1367,8 @@
|
||||
joi "^17.3.0"
|
||||
joi-objectid "^3.0.1"
|
||||
jsonwebtoken "^8.5.1"
|
||||
medusa-core-utils "1.1.31-dev-1648026403166"
|
||||
medusa-test-utils "1.1.37-dev-1648026403166"
|
||||
medusa-core-utils "1.1.31-dev-1649181615374"
|
||||
medusa-test-utils "1.1.37-dev-1649181615374"
|
||||
morgan "^1.9.1"
|
||||
multer "^1.4.2"
|
||||
passport "^0.4.0"
|
||||
@@ -2010,10 +2010,10 @@ babel-preset-jest@^26.6.2:
|
||||
babel-plugin-jest-hoist "^26.6.2"
|
||||
babel-preset-current-node-syntax "^1.0.0"
|
||||
|
||||
babel-preset-medusa-package@1.1.19-dev-1648026403166:
|
||||
version "1.1.19-dev-1648026403166"
|
||||
resolved "http://localhost:4873/babel-preset-medusa-package/-/babel-preset-medusa-package-1.1.19-dev-1648026403166.tgz#e834a06c2283d5b8709d45de1e4ff559dfd23944"
|
||||
integrity sha512-HjbSvyeLU9ez0dgBv4+SDX2/nXaskN5Bip7nF36F/fnufw/5FtJ28Lyw30VWz6i5Ci991Zmadfq6TNUZnKgNHw==
|
||||
babel-preset-medusa-package@1.1.19-dev-1649181615374:
|
||||
version "1.1.19-dev-1649181615374"
|
||||
resolved "http://localhost:4873/babel-preset-medusa-package/-/babel-preset-medusa-package-1.1.19-dev-1649181615374.tgz#2f13d52fedd336ad4b4c0602b3bf4696d2d08db7"
|
||||
integrity sha512-N4XL7rTmNM2W+iRR92xvU4bKadP25lY5QR3vndxTxsLNSgcR5tLjKLO/4j7AqiFvcthbE8cF1TcdECH5aJfSuA==
|
||||
dependencies:
|
||||
"@babel/plugin-proposal-class-properties" "^7.12.1"
|
||||
"@babel/plugin-proposal-decorators" "^7.12.1"
|
||||
@@ -5156,25 +5156,25 @@ media-typer@0.3.0:
|
||||
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
|
||||
integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=
|
||||
|
||||
medusa-core-utils@1.1.31-dev-1648026403166:
|
||||
version "1.1.31-dev-1648026403166"
|
||||
resolved "http://localhost:4873/medusa-core-utils/-/medusa-core-utils-1.1.31-dev-1648026403166.tgz#0f3bde6fc0a77d3027d80a4ca5e1a1ce2426ad21"
|
||||
integrity sha512-B5eFj3dH8g/HgNd8p8ChwR4bpydl0dqyBJllyvqS1AnFpjW7BcXpO0ZPkdYrIHflQL9e2OiIq3A2Lm6ZsYCI1A==
|
||||
medusa-core-utils@1.1.31-dev-1649181615374:
|
||||
version "1.1.31-dev-1649181615374"
|
||||
resolved "http://localhost:4873/medusa-core-utils/-/medusa-core-utils-1.1.31-dev-1649181615374.tgz#60416bba53eaba607d77ca36789aa23756b8db0f"
|
||||
integrity sha512-w5nusocZweIrAFJ6sl4hD/mN+UtNjz39IIfXukekyJByg3wpv4P+vsW3XdrFTX5OLvKVxuzjl3B2zeZUmdgSKg==
|
||||
dependencies:
|
||||
joi "^17.3.0"
|
||||
joi-objectid "^3.0.1"
|
||||
|
||||
medusa-interfaces@1.2.1-dev-1648026403166:
|
||||
version "1.2.1-dev-1648026403166"
|
||||
resolved "http://localhost:4873/medusa-interfaces/-/medusa-interfaces-1.2.1-dev-1648026403166.tgz#29742128c852c967a94df1e00f0c8dacccff6b86"
|
||||
integrity sha512-VRnFIFqPeOd0TcPMlng1kIzjhT7AtJzNqIDmKDxeJeE1MqU89g6YME/yQfCPzTXKNMdwN+8Xx+E5gANNn5i1QA==
|
||||
medusa-interfaces@1.2.1-dev-1649181615374:
|
||||
version "1.2.1-dev-1649181615374"
|
||||
resolved "http://localhost:4873/medusa-interfaces/-/medusa-interfaces-1.2.1-dev-1649181615374.tgz#0b664f4e3e8e61b67108a41c8f0f9dd58a947075"
|
||||
integrity sha512-JRD773nZnxjn/2oNrgb/zXn+scBoNHpW97YQYW7+LFX1JBYafzyGQW3vWTFX4X+q08ehz4dc21CgoMeYco8yvQ==
|
||||
dependencies:
|
||||
medusa-core-utils "1.1.31-dev-1648026403166"
|
||||
medusa-core-utils "1.1.31-dev-1649181615374"
|
||||
|
||||
medusa-telemetry@0.0.11-dev-1648026403166:
|
||||
version "0.0.11-dev-1648026403166"
|
||||
resolved "http://localhost:4873/medusa-telemetry/-/medusa-telemetry-0.0.11-dev-1648026403166.tgz#dd66a411a214b953f8b6673f59c0b02dd78ec99f"
|
||||
integrity sha512-SH07C6rOQyx7bHH4/2TzmBgzgMY8fLiE7PH7dk6BGwY8bjx9w6DvF9CvhdwxFnFnzDTed/cjkE/cHNkQFkjSrQ==
|
||||
medusa-telemetry@0.0.11-dev-1649181615374:
|
||||
version "0.0.11-dev-1649181615374"
|
||||
resolved "http://localhost:4873/medusa-telemetry/-/medusa-telemetry-0.0.11-dev-1649181615374.tgz#3f4c366ea8d0d0fdde9b289f7e771bb27adae56d"
|
||||
integrity sha512-RMJR3/qlTb1nV05RnBnX1bNOvYyeuXf4owxLlfbWzKAZirWQ5LAC2GikEGGbHGbw7UgiLgQtu4Rnmg2Uye+VcA==
|
||||
dependencies:
|
||||
axios "^0.21.1"
|
||||
axios-retry "^3.1.9"
|
||||
@@ -5186,13 +5186,13 @@ medusa-telemetry@0.0.11-dev-1648026403166:
|
||||
remove-trailing-slash "^0.1.1"
|
||||
uuid "^8.3.2"
|
||||
|
||||
medusa-test-utils@1.1.37-dev-1648026403166:
|
||||
version "1.1.37-dev-1648026403166"
|
||||
resolved "http://localhost:4873/medusa-test-utils/-/medusa-test-utils-1.1.37-dev-1648026403166.tgz#f32f0a04d7d38f6a84e58a2937bd026767ea5d1f"
|
||||
integrity sha512-VQCuRal14tl/ZLsN6Ueh+z3FBgQEXgsLLSJxfpsrmABKTgoHONhkoe7UyXxxUozXwPWWqqtHhy80zfCIlfHF+w==
|
||||
medusa-test-utils@1.1.37-dev-1649181615374:
|
||||
version "1.1.37-dev-1649181615374"
|
||||
resolved "http://localhost:4873/medusa-test-utils/-/medusa-test-utils-1.1.37-dev-1649181615374.tgz#079c16a791d47c52072c6f0837d0a827208bc9cc"
|
||||
integrity sha512-hj3iNZsIA01l7qAZrOgt+kT8PDkXKoW4CEL3bhVfIUEwsdv9jID7FGdTIN/7G3diioTypvrVcqRrp0uiWdgp+Q==
|
||||
dependencies:
|
||||
"@babel/plugin-transform-classes" "^7.9.5"
|
||||
medusa-core-utils "1.1.31-dev-1648026403166"
|
||||
medusa-core-utils "1.1.31-dev-1649181615374"
|
||||
randomatic "^3.1.1"
|
||||
|
||||
merge-descriptors@1.0.1:
|
||||
|
||||
Reference in New Issue
Block a user