pricing - model reviewed
MODIFY
src/types/Pricing.ts
src/types/Pricing.ts
-export interface PricingModel {
+import { AuthorizationActions } from './Authorization';
+import CreatedUpdatedProps from './CreatedUpdatedProps';
+
+export default interface Pricing extends CreatedUpdatedProps, AuthorizationActions {
id: string;
- description: string;
- currency: string;
- timestamp: Date;
- pricings: Pricing[];
+ contextId: string;
+ pricingDefinitions: PricingDefinition[];
}
-export interface Pricing {
- flatFee?: PricingComponent,
- energy?: PricingComponent,
- parkingTime?: PricingComponent,
- chargingTime?: PricingComponent,
- restrictions?: PricingRestriction;
+export interface PricingDefinition {
+ restrictions?: PricingRestriction; // To be clarified! - These restrictions are so far common to all dimensions
+ dimensions: {
+ flatFee?: PricingDimension, // Flat fee, no unit
+ energy?: PricingDimension, // Defined in kWh, step_size multiplier: 1 Wh
+ chargingTime?: PricingDimension, // Time charging: defined in hours, step_size multiplier: 1 second
+ parkingTime?: PricingDimension, // Time not charging: defined in hours, step_size multiplier: 1 second
+ }
}
-export interface PricingComponent {
+export interface PricingDimension {
+ active: boolean, // Lets the user switch OFF that price without loosing the value (if any)
price: number, // Price per unit (excluding VAT) for this tariff dimension
stepSize?: number, // Minimum amount to be billed. This unit will be billed in this step_size blocks. For example: if type is time and step_size is 300, then time will be billed in blocks of 5 minutes, so if 6 minutes is used, 10 minutes (2 blocks of step_size) will be billed.
}
@@ -43,13 +47,6 @@ export enum DayOfWeek {
SUNDAY = 7
}
-// export enum PricingDimensionType {
-// ENERGY = 'E', // Defined in kWh, step_size multiplier: 1 Wh
-// FLAT = 'F', // Flat fee, no unit
-// PARKING_TIME = 'PT', // Time not charging: defined in hours, step_size multiplier: 1 second
-// TIME = 'T', // Time charging: defined in hours, step_size multiplier: 1 second
-// }
-
// Interface exposed by the pricing integration layer
export interface PricedConsumption {
amount: number;

pricing - model reviewed