From bf135c252a42c25e20cbe887a319fd3fda05fa53 Mon Sep 17 00:00:00 2001 From: Philip Korsholm Date: Fri, 15 Dec 2023 07:49:02 +0100 Subject: [PATCH 1/5] add price_type to update shipping option --- .../api/__tests__/admin/shipping-options.js | 172 +++++++++--------- .../settings/taxes/edit-tax-rate-details.tsx | 6 +- .../create-shipping-option.ts | 29 ++- .../update-shipping-option.ts | 16 +- .../src/models/shipping-option-requirement.ts | 2 +- .../medusa/src/services/shipping-option.ts | 22 ++- packages/medusa/src/types/shipping-options.ts | 15 +- 7 files changed, 143 insertions(+), 119 deletions(-) diff --git a/integration-tests/api/__tests__/admin/shipping-options.js b/integration-tests/api/__tests__/admin/shipping-options.js index ed94fd54da930..390723fd04313 100644 --- a/integration-tests/api/__tests__/admin/shipping-options.js +++ b/integration-tests/api/__tests__/admin/shipping-options.js @@ -48,7 +48,7 @@ describe("/admin/shipping-options", () => { await db.teardown() }) - it("updates a shipping option with no existing requirements", async () => { + it("should update a shipping option with no existing requirements", async () => { const api = useApi() const payload = { @@ -66,11 +66,11 @@ describe("/admin/shipping-options", () => { ], } - const res = await api.post(`/admin/shipping-options/test-out`, payload, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + const res = await api.post( + `/admin/shipping-options/test-out`, + payload, + adminReqConfig + ) const requirements = res.data.shipping_option.requirements @@ -92,7 +92,27 @@ describe("/admin/shipping-options", () => { ) }) - it("fails to add a a requirement with an id if it does not exists", async () => { + it("should update a shipping option with price_type", async () => { + const api = useApi() + + const payload = { + price_type: "calculated", + requirements: [], + } + + const res = await api + .post(`/admin/shipping-options/test-out`, payload, adminReqConfig) + .catch(console.log) + + expect(res.status).toEqual(200) + expect(res.data.shipping_option).toEqual( + expect.objectContaining({ + price_type: "calculated", + }) + ) + }) + + it("should fail to add a a requirement with an id if it does not exists", async () => { const api = useApi() const payload = { @@ -113,11 +133,7 @@ describe("/admin/shipping-options", () => { } const res = await api - .post(`/admin/shipping-options/test-out`, payload, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + .post(`/admin/shipping-options/test-out`, payload, adminReqConfig) .catch((err) => { return err.response }) @@ -128,7 +144,7 @@ describe("/admin/shipping-options", () => { ) }) - it("it successfully updates a set of existing requirements", async () => { + it("should successfully updates a set of existing requirements", async () => { const api = useApi() const payload = { @@ -148,11 +164,11 @@ describe("/admin/shipping-options", () => { } const res = await api - .post(`/admin/shipping-options/test-option-req`, payload, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + .post( + `/admin/shipping-options/test-option-req`, + payload, + adminReqConfig + ) .catch((err) => { console.log(err.response.data.message) }) @@ -160,7 +176,7 @@ describe("/admin/shipping-options", () => { expect(res.status).toEqual(200) }) - it("it successfully updates a set of existing requirements by updating one and deleting the other", async () => { + it("should successfully updates a set of existing requirements by updating one and deleting the other", async () => { const api = useApi() const payload = { @@ -174,11 +190,11 @@ describe("/admin/shipping-options", () => { } const res = await api - .post(`/admin/shipping-options/test-option-req`, payload, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + .post( + `/admin/shipping-options/test-option-req`, + payload, + adminReqConfig + ) .catch((err) => { console.log(err.response.data.message) }) @@ -186,7 +202,7 @@ describe("/admin/shipping-options", () => { expect(res.status).toEqual(200) }) - it("successfully updates a set of requirements because max. subtotal >= min. subtotal", async () => { + it("should successfully updates a set of requirements because max. subtotal >= min. subtotal", async () => { const api = useApi() const payload = { @@ -205,11 +221,11 @@ describe("/admin/shipping-options", () => { } const res = await api - .post(`/admin/shipping-options/test-option-req`, payload, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + .post( + `/admin/shipping-options/test-option-req`, + payload, + adminReqConfig + ) .catch((err) => { console.log(err.response.data.message) }) @@ -219,7 +235,7 @@ describe("/admin/shipping-options", () => { expect(res.data.shipping_option.requirements[1].amount).toEqual(200) }) - it("fails to updates a set of requirements because max. subtotal <= min. subtotal", async () => { + it("should fail to updates a set of requirements because max. subtotal <= min. subtotal", async () => { const api = useApi() const payload = { @@ -238,11 +254,11 @@ describe("/admin/shipping-options", () => { } const res = await api - .post(`/admin/shipping-options/test-option-req`, payload, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + .post( + `/admin/shipping-options/test-option-req`, + payload, + adminReqConfig + ) .catch((err) => { return err.response }) @@ -267,11 +283,7 @@ describe("/admin/shipping-options", () => { { fulfillment_providers: ["test-ful"], }, - { - headers: { - "x-medusa-access-token": "test_token", - }, - } + adminReqConfig ) const manager = dbConnection.manager @@ -297,7 +309,7 @@ describe("/admin/shipping-options", () => { await db.teardown() }) - it("creates a shipping option with requirements", async () => { + it("should create a shipping option with requirements", async () => { const api = useApi() payload.requirements = [ { @@ -310,29 +322,29 @@ describe("/admin/shipping-options", () => { }, ] - const res = await api.post(`/admin/shipping-options`, payload, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + const res = await api.post( + `/admin/shipping-options`, + payload, + adminReqConfig + ) expect(res.status).toEqual(200) expect(res.data.shipping_option.requirements.length).toEqual(2) }) - it("creates a shipping option with no requirements", async () => { + it("should create a shipping option with no requirements", async () => { const api = useApi() - const res = await api.post(`/admin/shipping-options`, payload, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + const res = await api.post( + `/admin/shipping-options`, + payload, + adminReqConfig + ) expect(res.status).toEqual(200) expect(res.data.shipping_option.requirements.length).toEqual(0) }) - it("fails on same requirement types", async () => { + it("should fail on same requirement types", async () => { const api = useApi() payload.requirements = [ { @@ -346,11 +358,7 @@ describe("/admin/shipping-options", () => { ] try { - await api.post(`/admin/shipping-options`, payload, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + await api.post(`/admin/shipping-options`, payload, adminReqConfig) } catch (error) { expect(error.response.data.message).toEqual( "Only one requirement of each type is allowed" @@ -358,7 +366,7 @@ describe("/admin/shipping-options", () => { } }) - it("fails when min_subtotal > max_subtotal", async () => { + it("should fail when min_subtotal > max_subtotal", async () => { const api = useApi() payload.requirements = [ { @@ -372,11 +380,7 @@ describe("/admin/shipping-options", () => { ] try { - await api.post(`/admin/shipping-options`, payload, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + await api.post(`/admin/shipping-options`, payload, adminReqConfig) } catch (error) { expect(error.response.data.message).toEqual( "Max. subtotal must be greater than Min. subtotal" @@ -395,24 +399,19 @@ describe("/admin/shipping-options", () => { await db.teardown() }) - it("lists shipping options", async () => { + it("should list shipping options", async () => { const api = useApi() - const res = await api.get(`/admin/shipping-options`, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + const res = await api.get(`/admin/shipping-options`, adminReqConfig) expect(res.status).toEqual(200) }) - it("lists admin only shipping options", async () => { + it("should list admin only shipping options", async () => { const api = useApi() - const res = await api.get(`/admin/shipping-options?admin_only=true`, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + const res = await api.get( + `/admin/shipping-options?admin_only=true`, + adminReqConfig + ) expect(res.status).toEqual(200) expect(res.data.shipping_options).toEqual( @@ -425,13 +424,12 @@ describe("/admin/shipping-options", () => { ) }) - it("lists return shipping options", async () => { + it("should list return shipping options", async () => { const api = useApi() - const res = await api.get(`/admin/shipping-options?is_return=true`, { - headers: { - "x-medusa-access-token": "test_token", - }, - }) + const res = await api.get( + `/admin/shipping-options?is_return=true`, + adminReqConfig + ) expect(res.status).toEqual(200) expect(res.data.shipping_options).toEqual( @@ -444,15 +442,11 @@ describe("/admin/shipping-options", () => { ) }) - it("lists shipping options without return and admin options", async () => { + it("should list shipping options without return and admin options", async () => { const api = useApi() const res = await api.get( `/admin/shipping-options?is_return=false&admin_only=true`, - { - headers: { - "x-medusa-access-token": "test_token", - }, - } + adminReqConfig ) expect(res.status).toEqual(200) diff --git a/packages/admin-ui/ui/src/domain/settings/taxes/edit-tax-rate-details.tsx b/packages/admin-ui/ui/src/domain/settings/taxes/edit-tax-rate-details.tsx index d8a7c66fd4030..4c917270fd4bc 100644 --- a/packages/admin-ui/ui/src/domain/settings/taxes/edit-tax-rate-details.tsx +++ b/packages/admin-ui/ui/src/domain/settings/taxes/edit-tax-rate-details.tsx @@ -1,8 +1,8 @@ -import { useTranslation } from "react-i18next" -import LockIcon from "../../../components/fundamentals/icons/lock-icon" -import Input from "../../../components/molecules/input" import FormValidator from "../../../utils/form-validator" +import Input from "../../../components/molecules/input" +import LockIcon from "../../../components/fundamentals/icons/lock-icon" import { NestedForm } from "../../../utils/nested-form" +import { useTranslation } from "react-i18next" export type EditTaxRateFormType = { name: string diff --git a/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts b/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts index cfceed2a65e52..1810f1a5485f7 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts @@ -1,18 +1,21 @@ import { IsArray, IsBoolean, + IsEnum, IsNumber, IsObject, IsOptional, IsString, ValidateNested, } from "class-validator" +import { RequirementType, ShippingOptionPriceType } from "../../../../models" import { defaultFields, defaultRelations } from "." -import { Type } from "class-transformer" import { EntityManager } from "typeorm" -import TaxInclusivePricingFeatureFlag from "../../../../loaders/feature-flags/tax-inclusive-pricing" import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators" +import { ShippingOptionService } from "../../../../services" +import TaxInclusivePricingFeatureFlag from "../../../../loaders/feature-flags/tax-inclusive-pricing" +import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" /** @@ -88,7 +91,9 @@ import { validator } from "../../../../utils/validator" export default async (req, res) => { const validated = await validator(AdminPostShippingOptionsReq, req.body) - const optionService = req.scope.resolve("shippingOptionService") + const optionService: ShippingOptionService = req.scope.resolve( + "shippingOptionService" + ) const shippingProfileService = req.scope.resolve("shippingProfileService") // Add to default shipping profile @@ -113,8 +118,11 @@ export default async (req, res) => { } class OptionRequirement { - @IsString() - type: string + @IsEnum(RequirementType, { + message: `Invalid option type, must be one of "min_subtotal" or "max_subtotal"`, + }) + type: RequirementType + @IsNumber() amount: number } @@ -203,15 +211,16 @@ export class AdminPostShippingOptionsReq { @IsString() provider_id: string - @IsOptional() @IsString() - profile_id?: string + profile_id: string @IsObject() - data: object + data: Record - @IsString() - price_type: string + @IsEnum(ShippingOptionPriceType, { + message: `Invalid price type, must be one of "flat_rate" or "calculated"`, + }) + price_type: ShippingOptionPriceType @IsOptional() @IsNumber() diff --git a/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts b/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts index c42049e9da829..9d354b835b252 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/update-shipping-option.ts @@ -1,6 +1,7 @@ import { IsArray, IsBoolean, + IsEnum, IsNumber, IsObject, IsOptional, @@ -9,13 +10,14 @@ import { } from "class-validator" import { defaultFields, defaultRelations } from "." -import { Type } from "class-transformer" import { EntityManager } from "typeorm" -import TaxInclusivePricingFeatureFlag from "../../../../loaders/feature-flags/tax-inclusive-pricing" import { FeatureFlagDecorators } from "../../../../utils/feature-flag-decorators" -import { validator } from "../../../../utils/validator" +import { ShippingOptionPriceType } from "../../../../models" import { ShippingOptionService } from "../../../../services" +import TaxInclusivePricingFeatureFlag from "../../../../loaders/feature-flags/tax-inclusive-pricing" +import { Type } from "class-transformer" import { UpdateShippingOptionInput } from "../../../../types/shipping-options" +import { validator } from "../../../../utils/validator" /** * @oas [post] /admin/shipping-options/{id} @@ -123,8 +125,10 @@ class OptionRequirement { @IsString() @IsOptional() id: string + @IsString() type: string + @IsNumber() amount: number } @@ -187,6 +191,12 @@ export class AdminPostShippingOptionsOptionReq { @IsOptional() amount?: number + @IsEnum(ShippingOptionPriceType, { + message: `Invalid price type, must be one of "flat_rate" or "calculated"`, + }) + @IsOptional() + price_type?: ShippingOptionPriceType + @IsArray() @ValidateNested({ each: true }) @Type(() => OptionRequirement) diff --git a/packages/medusa/src/models/shipping-option-requirement.ts b/packages/medusa/src/models/shipping-option-requirement.ts index 5a864d7bd8eda..6abe97f9706e8 100644 --- a/packages/medusa/src/models/shipping-option-requirement.ts +++ b/packages/medusa/src/models/shipping-option-requirement.ts @@ -15,7 +15,7 @@ import { generateEntityId } from "../utils/generate-entity-id" /** * @enum - * + * * The type of shipping option requirement. */ export enum RequirementType { diff --git a/packages/medusa/src/services/shipping-option.ts b/packages/medusa/src/services/shipping-option.ts index 2d14660bd8326..b111c35bd29e4 100644 --- a/packages/medusa/src/services/shipping-option.ts +++ b/packages/medusa/src/services/shipping-option.ts @@ -1,8 +1,3 @@ -import { FlagRouter, promiseAll } from "@medusajs/utils" -import { isDefined, MedusaError } from "medusa-core-utils" -import { EntityManager } from "typeorm" -import { TransactionBaseService } from "../interfaces" -import TaxInclusivePricingFeatureFlag from "../loaders/feature-flags/tax-inclusive-pricing" import { Cart, Order, @@ -11,20 +6,27 @@ import { ShippingOptionPriceType, ShippingOptionRequirement, } from "../models" -import { ShippingMethodRepository } from "../repositories/shipping-method" -import { ShippingOptionRepository } from "../repositories/shipping-option" -import { ShippingOptionRequirementRepository } from "../repositories/shipping-option-requirement" -import { FindConfig, Selector } from "../types/common" import { CreateShippingMethodDto, CreateShippingOptionInput, ShippingMethodUpdate, UpdateShippingOptionInput, ValidatePriceTypeAndAmountInput, + validateRequirementTypeInput, } from "../types/shipping-options" +import { FindConfig, Selector } from "../types/common" +import { FlagRouter, promiseAll } from "@medusajs/utils" +import { MedusaError, isDefined } from "medusa-core-utils" import { buildQuery, isString, setMetadata } from "../utils" + +import { EntityManager } from "typeorm" import FulfillmentProviderService from "./fulfillment-provider" import RegionService from "./region" +import { ShippingMethodRepository } from "../repositories/shipping-method" +import { ShippingOptionRepository } from "../repositories/shipping-option" +import { ShippingOptionRequirementRepository } from "../repositories/shipping-option-requirement" +import TaxInclusivePricingFeatureFlag from "../loaders/feature-flags/tax-inclusive-pricing" +import { TransactionBaseService } from "../interfaces" type InjectedDependencies = { manager: EntityManager @@ -75,7 +77,7 @@ class ShippingOptionService extends TransactionBaseService { * @return {ShippingOptionRequirement} a validated shipping requirement */ async validateRequirement_( - requirement: ShippingOptionRequirement, + requirement: validateRequirementTypeInput, optionId: string | undefined = undefined ): Promise { return await this.atomicPhase_(async (manager) => { diff --git a/packages/medusa/src/types/shipping-options.ts b/packages/medusa/src/types/shipping-options.ts index d025c86850720..7df34b308aa1f 100644 --- a/packages/medusa/src/types/shipping-options.ts +++ b/packages/medusa/src/types/shipping-options.ts @@ -1,10 +1,11 @@ import { Cart, Order } from ".." -import { ShippingOptionPriceType } from "../models/shipping-option" import { RequirementType, ShippingOptionRequirement, } from "../models/shipping-option-requirement" +import { ShippingOptionPriceType } from "../models/shipping-option" + export type ShippingRequirement = { type: RequirementType amount: number @@ -50,7 +51,15 @@ export type CreateShippingOptionInput = { is_return?: boolean admin_only?: boolean metadata?: Record - requirements?: ShippingOptionRequirement[] + requirements?: RequirementInput[] +} + +export type RequirementInput = { type: RequirementType; amount: number } + +export type validateRequirementTypeInput = { + id?: string + type: RequirementType + amount: number } export type CreateCustomShippingOptionInput = { @@ -67,7 +76,7 @@ export type UpdateShippingOptionInput = { name?: string admin_only?: boolean is_return?: boolean - requirements?: ShippingOptionRequirement[] + requirements?: RequirementInput[] region_id?: string provider_id?: string profile_id?: string From 210dd3bd5f410bee0116a49b8eb45387112f411f Mon Sep 17 00:00:00 2001 From: Philip Korsholm Date: Fri, 15 Dec 2023 08:03:40 +0100 Subject: [PATCH 2/5] undo admin changes --- .../ui/src/domain/settings/taxes/edit-tax-rate-details.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/admin-ui/ui/src/domain/settings/taxes/edit-tax-rate-details.tsx b/packages/admin-ui/ui/src/domain/settings/taxes/edit-tax-rate-details.tsx index 4c917270fd4bc..d8a7c66fd4030 100644 --- a/packages/admin-ui/ui/src/domain/settings/taxes/edit-tax-rate-details.tsx +++ b/packages/admin-ui/ui/src/domain/settings/taxes/edit-tax-rate-details.tsx @@ -1,8 +1,8 @@ -import FormValidator from "../../../utils/form-validator" -import Input from "../../../components/molecules/input" +import { useTranslation } from "react-i18next" import LockIcon from "../../../components/fundamentals/icons/lock-icon" +import Input from "../../../components/molecules/input" +import FormValidator from "../../../utils/form-validator" import { NestedForm } from "../../../utils/nested-form" -import { useTranslation } from "react-i18next" export type EditTaxRateFormType = { name: string From 21f5679c67e54839c0eb502f3e8e3887e00bffef Mon Sep 17 00:00:00 2001 From: Philip Korsholm Date: Fri, 15 Dec 2023 09:17:37 +0100 Subject: [PATCH 3/5] fix unit tests --- .../admin/shipping-options/__tests__/create-shipping-option.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/medusa/src/api/routes/admin/shipping-options/__tests__/create-shipping-option.js b/packages/medusa/src/api/routes/admin/shipping-options/__tests__/create-shipping-option.js index 18cc5a5e1879e..de41ef7f8df61 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/__tests__/create-shipping-option.js +++ b/packages/medusa/src/api/routes/admin/shipping-options/__tests__/create-shipping-option.js @@ -1,6 +1,6 @@ import { IdMap } from "medusa-test-utils" -import { request } from "../../../../../helpers/test-request" import { ShippingOptionServiceMock } from "../../../../../services/__mocks__/shipping-option" +import { request } from "../../../../../helpers/test-request" describe("POST /admin/shipping-options", () => { describe("successful creation", () => { @@ -13,6 +13,7 @@ describe("POST /admin/shipping-options", () => { name: "Test option", region_id: "testregion", provider_id: "test_provider", + profile_id: "gift-card", data: { id: "test" }, price_type: "flat_rate", amount: 100, From d3bd3204519c830c4c00ea48366ed9fbe1439712 Mon Sep 17 00:00:00 2001 From: Philip Korsholm Date: Fri, 15 Dec 2023 10:46:13 +0100 Subject: [PATCH 4/5] pr comments --- .../routes/admin/shipping-options/create-shipping-option.ts | 6 ++++-- packages/medusa/src/services/shipping-option.ts | 4 ++-- packages/medusa/src/types/shipping-options.ts | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts b/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts index 1810f1a5485f7..4ed788f0bf7f3 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts +++ b/packages/medusa/src/api/routes/admin/shipping-options/create-shipping-option.ts @@ -17,6 +17,7 @@ import { ShippingOptionService } from "../../../../services" import TaxInclusivePricingFeatureFlag from "../../../../loaders/feature-flags/tax-inclusive-pricing" import { Type } from "class-transformer" import { validator } from "../../../../utils/validator" +import { CreateShippingOptionInput } from "../../../../types/shipping-options" /** * @oas [post] /admin/shipping-options @@ -106,7 +107,7 @@ export default async (req, res) => { const result = await manager.transaction(async (transactionManager) => { return await optionService .withTransaction(transactionManager) - .create(validated) + .create(validated as CreateShippingOptionInput) }) const data = await optionService.retrieve(result.id, { @@ -212,7 +213,8 @@ export class AdminPostShippingOptionsReq { provider_id: string @IsString() - profile_id: string + @IsOptional() + profile_id?: string @IsObject() data: Record diff --git a/packages/medusa/src/services/shipping-option.ts b/packages/medusa/src/services/shipping-option.ts index b111c35bd29e4..539be5da52aeb 100644 --- a/packages/medusa/src/services/shipping-option.ts +++ b/packages/medusa/src/services/shipping-option.ts @@ -12,7 +12,7 @@ import { ShippingMethodUpdate, UpdateShippingOptionInput, ValidatePriceTypeAndAmountInput, - validateRequirementTypeInput, + ValidateRequirementTypeInput, } from "../types/shipping-options" import { FindConfig, Selector } from "../types/common" import { FlagRouter, promiseAll } from "@medusajs/utils" @@ -77,7 +77,7 @@ class ShippingOptionService extends TransactionBaseService { * @return {ShippingOptionRequirement} a validated shipping requirement */ async validateRequirement_( - requirement: validateRequirementTypeInput, + requirement: ValidateRequirementTypeInput, optionId: string | undefined = undefined ): Promise { return await this.atomicPhase_(async (manager) => { diff --git a/packages/medusa/src/types/shipping-options.ts b/packages/medusa/src/types/shipping-options.ts index 7df34b308aa1f..77339bb3f2309 100644 --- a/packages/medusa/src/types/shipping-options.ts +++ b/packages/medusa/src/types/shipping-options.ts @@ -56,7 +56,7 @@ export type CreateShippingOptionInput = { export type RequirementInput = { type: RequirementType; amount: number } -export type validateRequirementTypeInput = { +export type ValidateRequirementTypeInput = { id?: string type: RequirementType amount: number From 1e74b21d9aee3e8d6ca1fbf3a614cb04965f75b4 Mon Sep 17 00:00:00 2001 From: Philip Korsholm Date: Fri, 15 Dec 2023 10:51:58 +0100 Subject: [PATCH 5/5] update test --- .../admin/shipping-options/__tests__/create-shipping-option.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/medusa/src/api/routes/admin/shipping-options/__tests__/create-shipping-option.js b/packages/medusa/src/api/routes/admin/shipping-options/__tests__/create-shipping-option.js index de41ef7f8df61..b14e7c71feca4 100644 --- a/packages/medusa/src/api/routes/admin/shipping-options/__tests__/create-shipping-option.js +++ b/packages/medusa/src/api/routes/admin/shipping-options/__tests__/create-shipping-option.js @@ -13,7 +13,6 @@ describe("POST /admin/shipping-options", () => { name: "Test option", region_id: "testregion", provider_id: "test_provider", - profile_id: "gift-card", data: { id: "test" }, price_type: "flat_rate", amount: 100,