fix(orchestration,link-modules,pricing,types): fix shippingprofile errror outside of core + change link alias name (#5025)

* fix(orchestration,link-modules,pricing,types): fix shippingprofile error outside of core + change link alias name

* chore: scope relationships and move condition inside

* chore: remove islist

* chore: fix merge conflict

* chore: reverted serviceName scoping

* chore: change shape to make methodOverride compatible

* chore: added methodOverride to remote query

* chore: revert override
This commit is contained in:
Riqwan Thamir
2023-09-13 12:16:00 +02:00
committed by GitHub
parent 7231f65833
commit 3d68be2b6b
10 changed files with 49 additions and 21 deletions
@@ -4,6 +4,8 @@ import {
FindConfig,
InternalModuleDeclaration,
ModuleJoinerConfig,
PricingContext,
PricingFilters,
PricingTypes,
} from "@medusajs/types"
import { Currency, MoneyAmount, PriceSet } from "@models"
@@ -25,10 +27,6 @@ type InjectedDependencies = {
priceSetService: PriceSetService<any>
}
type PricingContext = {
currency_code?: string
}
export default class PricingModuleService<
TPriceSet extends PriceSet = PriceSet,
TMoneyAmount extends MoneyAmount = MoneyAmount,
@@ -61,14 +59,15 @@ export default class PricingModuleService<
@InjectManager("baseRepository_")
async calculatePrices(
priceSetIds: string[],
pricingContext: PricingContext,
pricingFilters: PricingFilters,
pricingContext: PricingContext = { context: {} },
@MedusaContext() sharedContext: Context = {}
): Promise<PricingTypes.CalculatedPriceSetDTO> {
// Keeping this whole logic raw in here for now as they will undergo
// some changes, will abstract them out once we have a final version
const context = pricingContext.context || {}
const priceSetFilters: PricingTypes.FilterablePriceSetProps = {
id: priceSetIds,
id: pricingFilters.id,
}
const priceSets = await this.list(
@@ -95,8 +94,7 @@ export default class PricingModuleService<
// When no price is set, return null values for all cases
const selectedMoneyAmount = priceSet.money_amounts?.find(
(ma) =>
pricingContext.currency_code &&
ma.currency_code === pricingContext.currency_code
context.currency_code && ma.currency_code === context.currency_code
)
return {