pricing - Feature togggle - PRICING_WITH_RESTRICTION_CHECKS
MODIFY
src/integration/pricing/PricingEngine.ts
src/integration/pricing/PricingEngine.ts
+import FeatureToggles, { Feature } from '../../utils/FeatureToggles';
/* eslint-disable @typescript-eslint/member-ordering */
import PricingModel, { DimensionType, PricedConsumptionData, PricedDimensionData, PricingDefinition, PricingDimension, PricingRestriction, PricingStaticRestriction, ResolvedPricingModel } from '../../types/Pricing';
@@ -349,8 +350,13 @@ export default class PricingEngine {
static priceConsumption(tenant: Tenant, pricingModel: ResolvedPricingModel, consumptionData: Consumption): PricedConsumptionData {
// Check the restrictions to find the pricing definition matching the current context
- let actualPricingDefinitions = pricingModel.pricingDefinitions.filter((pricingDefinition) =>
- PricingEngine.checkPricingDefinitionRestrictions(pricingDefinition, consumptionData)
+ let actualPricingDefinitions = pricingModel.pricingDefinitions.filter((pricingDefinition) => {
+ if (FeatureToggles.isFeatureActive(Feature.PRICING_WITH_RESTRICTION_CHECKS)) {
+ return PricingEngine.checkPricingDefinitionRestrictions(pricingDefinition, consumptionData);
+ }
+ // Dynamic restrictions check are not yet supported
+ return pricingDefinition;
+ }
);
// Having more than one pricing definition this NOT a normal situation.
// This means that two different tariff matches the same criteria. This should not happen!

MODIFY
src/server/rest/v1/service/PricingService.ts
src/server/rest/v1/service/PricingService.ts
@@ -11,7 +11,7 @@ import PricingModel from '../../../../types/Pricing';
import PricingSecurity from './security/PricingSecurity';
import PricingStorage from '../../../../storage/mongodb/PricingStorage';
import { ServerAction } from '../../../../types/Server';
-import TenantComponents from '../../../../types/TenantComponents';
+import { TenantComponents } from '../../../../types/Tenant';
import UtilsService from './UtilsService';
const MODULE_NAME = 'PricingService';

MODIFY
src/utils/FeatureToggles.ts
src/utils/FeatureToggles.ts
@@ -7,6 +7,7 @@ export enum Feature {
PRICING_NEW_MODEL,
PRICING_TEST_PARKING_TIME,
PRICING_TEST_ENERGY_WITH_STEP_SIZE,
+ PRICING_WITH_RESTRICTION_CHECKS,
}
export default class FeatureToggles {
@@ -16,6 +17,7 @@ export default class FeatureToggles {
Feature.BILLING_CHECK_THRESHOLD_ON_STOP,
Feature.BILLING_PREVENT_CUSTOMER_DELETION,
Feature.PRICING_NEW_MODEL,
+ Feature.PRICING_WITH_RESTRICTION_CHECKS,
// Feature.PRICING_TEST_PARKING_TIME
// Feature.PRICING_TEST_ENERGY_WITH_STEP_SIZE
];

pricing - Feature togggle - PRICING_WITH_RESTRICTION_CHECKS