feat: Completely revamp the pricing module (#7852)
* feat: Completely revamp the pricing module * chore: Update all places to the new pricing interfaces * fix: Remove unnecessary join to itself * chore: Add data migration for existing users * fix: Apply the correct index to price rule
This commit is contained in:
@@ -92,22 +92,6 @@ medusaIntegrationTestRunner({
|
||||
adminHeaders
|
||||
)
|
||||
).data.price_list
|
||||
|
||||
// BREAKING: You need to register rule types before you can use them
|
||||
await api.post(
|
||||
"/admin/pricing/rule-types",
|
||||
{ name: "Region ID", rule_attribute: "region_id", default_priority: 0 },
|
||||
adminHeaders
|
||||
)
|
||||
await api.post(
|
||||
"/admin/pricing/rule-types",
|
||||
{
|
||||
name: "Customer Group ID",
|
||||
rule_attribute: "customer_group_id",
|
||||
default_priority: 0,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
})
|
||||
|
||||
describe("/admin/price-lists", () => {
|
||||
|
||||
@@ -808,12 +808,6 @@ medusaIntegrationTestRunner({
|
||||
// },
|
||||
// async () => {
|
||||
// const variantId = baseProduct.variants[0].id
|
||||
// await pricingService.createRuleTypes([
|
||||
// {
|
||||
// name: "Region ID",
|
||||
// rule_attribute: "region_id",
|
||||
// },
|
||||
// ])
|
||||
// const priceSet = await createVariantPriceSet({
|
||||
// container,
|
||||
// variantId,
|
||||
@@ -1228,16 +1222,6 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
|
||||
it("creates a product variant with price rules", async () => {
|
||||
await api.post(
|
||||
`/admin/pricing/rule-types`,
|
||||
{
|
||||
name: "Region",
|
||||
rule_attribute: "region_id",
|
||||
default_priority: 1,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const response = await api.post(
|
||||
"/admin/products",
|
||||
{
|
||||
|
||||
@@ -96,12 +96,6 @@ medusaIntegrationTestRunner({
|
||||
|
||||
describe("updates a variant's default prices (ignores prices associated with a Price List)", () => {
|
||||
it("successfully updates a variant's default prices by changing an existing price (currency_code)", async () => {
|
||||
await api.post(
|
||||
`/admin/pricing/rule-types`,
|
||||
{ name: "Region", rule_attribute: "region_id", default_priority: 1 },
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const data = {
|
||||
prices: [
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
createAdminUser,
|
||||
} from "../../../../helpers/create-admin-user"
|
||||
import { getProductFixture } from "../../../../helpers/fixtures"
|
||||
import { createDefaultRuleTypes } from "../../../../modules/helpers/create-default-rule-types"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
@@ -83,7 +82,6 @@ medusaIntegrationTestRunner({
|
||||
beforeEach(async () => {
|
||||
appContainer = getContainer()
|
||||
await createAdminUser(dbConnection, adminHeaders, appContainer)
|
||||
await createDefaultRuleTypes(appContainer)
|
||||
|
||||
const storeModule: IStoreModuleService = appContainer.resolve(
|
||||
ModuleRegistrationName.STORE
|
||||
|
||||
Reference in New Issue
Block a user