pricing - prevent falt fee if no consumption
MODIFY
src/integration/pricing/ConsumptionChunkPricer.ts
src/integration/pricing/ConsumptionChunkPricer.ts
@@ -129,6 +129,12 @@ export default class ConsumptionChunkPricer {
if (!this.getPricingModel().pricerContext.flatFeeAlreadyPriced) {
const activePricingDefinition = this.getActiveDefinition4Dimension(this.actualPricingDefinitions, DimensionType.FLAT_FEE);
if (activePricingDefinition) {
+ // --------------------------------------------------------------------------------
+ // Make sure not to price the Flat Fee when no energy has been delivered
+ // End-users may attempt to plug/unplug several times their car, without charging
+ // In such situation, they should not pay !
+ // -------------------------------------------------------------------------------
+ if (this.consumptionChunk.cumulatedConsumptionWh > 0) {
const dimensionToPrice = activePricingDefinition.dimensions.flatFee;
const pricedData = this.priceFlatFeeDimension(dimensionToPrice);
if (pricedData) {
@@ -139,6 +145,7 @@ export default class ConsumptionChunkPricer {
}
}
}
+ }
private priceEnergyConsumption(): PricedDimensionData {
const activePricingDefinition = this.getActiveDefinition4Dimension(this.actualPricingDefinitions, DimensionType.ENERGY);

pricing - prevent falt fee if no consumption