feat(pricing, types): PriceSets as entry point to pricing module (#4978)
What: - Adds PriceSet, PriceSetMoneyAmount, updates schema - Adds service/repo for PriceSet - Shifts entry point to use PriceSet - Updates link/joiner config RESOLVES CORE-1495
This commit is contained in:
1 parent
adf4903003
commit
834da5c41a
29 files changed
+1853
-113
No files matched your search
@@ -1,2 +1,3 @@
|
||||
export * from "./currency"
|
||||
export * from "./money-amount"
|
||||
export * from "./price-set"
|
||||
@@ -0,0 +1,32 @@
|
||||
import { BaseFilterable } from "../../dal"
|
||||
import { FilterableMoneyAmountProps, MoneyAmountDTO } from "./money-amount"
|
||||
|
||||
export interface PricingContext {
|
||||
currency_code?: string
|
||||
}
|
||||
export interface PriceSetDTO {
|
||||
id: string
|
||||
money_amounts?: MoneyAmountDTO[]
|
||||
}
|
||||
|
||||
export interface CalculatedPriceSetDTO {
|
||||
id: string
|
||||
amount: number | null
|
||||
currency_code: string | null
|
||||
min_quantity: number | null
|
||||
max_quantity: number | null
|
||||
}
|
||||
|
||||
export interface CreatePriceSetDTO {
|
||||
money_amounts?: MoneyAmountDTO[]
|
||||
}
|
||||
|
||||
export interface UpdatePriceSetDTO {
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface FilterablePriceSetProps
|
||||
extends BaseFilterable<FilterablePriceSetProps> {
|
||||
id?: string[]
|
||||
money_amounts?: FilterableMoneyAmountProps
|
||||
}
|
||||
@@ -2,48 +2,90 @@ import { FindConfig } from "../common"
|
||||
import { ModuleJoinerConfig } from "../modules-sdk"
|
||||
import { Context } from "../shared-context"
|
||||
import {
|
||||
CalculatedPriceSetDTO,
|
||||
CreateCurrencyDTO,
|
||||
CreateMoneyAmountDTO,
|
||||
CreatePriceSetDTO,
|
||||
CurrencyDTO,
|
||||
FilterableCurrencyProps,
|
||||
FilterableMoneyAmountProps,
|
||||
FilterablePriceSetProps,
|
||||
MoneyAmountDTO,
|
||||
PriceSetDTO,
|
||||
PricingContext,
|
||||
UpdateCurrencyDTO,
|
||||
UpdateMoneyAmountDTO,
|
||||
UpdatePriceSetDTO,
|
||||
} from "./common"
|
||||
|
||||
export interface IPricingModuleService {
|
||||
__joinerConfig(): ModuleJoinerConfig
|
||||
|
||||
calculatePrices(
|
||||
priceSetIds: string[],
|
||||
pricingContext: PricingContext,
|
||||
sharedContext?: Context
|
||||
): Promise<CalculatedPriceSetDTO>
|
||||
|
||||
retrieve(
|
||||
id: string,
|
||||
id: string,
|
||||
config?: FindConfig<PriceSetDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<PriceSetDTO>
|
||||
|
||||
list(
|
||||
filters?: FilterablePriceSetProps,
|
||||
config?: FindConfig<PriceSetDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<PriceSetDTO[]>
|
||||
|
||||
listAndCount(
|
||||
filters?: FilterablePriceSetProps,
|
||||
config?: FindConfig<PriceSetDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<[PriceSetDTO[], number]>
|
||||
|
||||
create(
|
||||
data: CreatePriceSetDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PriceSetDTO[]>
|
||||
|
||||
update(
|
||||
data: UpdatePriceSetDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PriceSetDTO[]>
|
||||
|
||||
delete(ids: string[], sharedContext?: Context): Promise<void>
|
||||
|
||||
retrieveMoneyAmount(
|
||||
id: string,
|
||||
config?: FindConfig<MoneyAmountDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<MoneyAmountDTO>
|
||||
|
||||
list(
|
||||
listMoneyAmounts(
|
||||
filters?: FilterableMoneyAmountProps,
|
||||
config?: FindConfig<MoneyAmountDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<MoneyAmountDTO[]>
|
||||
|
||||
listAndCount(
|
||||
listAndCountMoneyAmounts(
|
||||
filters?: FilterableMoneyAmountProps,
|
||||
config?: FindConfig<MoneyAmountDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<[MoneyAmountDTO[], number]>
|
||||
|
||||
create(
|
||||
createMoneyAmounts(
|
||||
data: CreateMoneyAmountDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<MoneyAmountDTO[]>
|
||||
|
||||
update(
|
||||
updateMoneyAmounts(
|
||||
data: UpdateMoneyAmountDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<MoneyAmountDTO[]>
|
||||
|
||||
delete(ids: string[], sharedContext?: Context): Promise<void>
|
||||
deleteMoneyAmounts(ids: string[], sharedContext?: Context): Promise<void>
|
||||
|
||||
retrieveCurrency(
|
||||
code: string,
|
||||
|
||||
Reference in new issue
Block a user