pricing - test - PricingApi skeleton
MODIFY
src/types/Pricing.ts
src/types/Pricing.ts
@@ -8,6 +8,8 @@ export default interface PricingModel extends CreatedUpdatedProps, Authorization
}
export interface PricingDefinition {
+ name: string, // Short marketing name - e.g.: BLUE Tariff,
+ description: string, // A long description to explain it, e.g.: Time-based pricing for low charging stations
restrictions?: PricingRestriction; // To be clarified! - These restrictions are so far common to all dimensions
dimensions: {
flatFee?: PricingDimension, // Flat fee, no unit

MODIFY
test/api/client/PricingApi.ts
test/api/client/PricingApi.ts
+/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
+import AuthenticatedBaseApi from './utils/AuthenticatedBaseApi';
import CrudApi from './utils/CrudApi';
+import PricingModel from '../../../src/types/Pricing';
+import { ServerRoute } from '../../../src/types/Server';
+import TestConstants from './utils/TestConstants';
-export default class SiteApi extends CrudApi {
- public constructor(authenticatedApi) {
+export default class PricingApi extends CrudApi {
+ public constructor(authenticatedApi: AuthenticatedBaseApi) {
super(authenticatedApi);
}
- public async update(data) {
- return super.update(data, '/client/api/PricingUpdate');
+ public async readPricingModels(params, paging = TestConstants.DEFAULT_PAGING, ordering = TestConstants.DEFAULT_ORDERING) {
+ return super.readAll(params, paging, ordering, this.buildRestEndpointUrl(ServerRoute.REST_PRICING_MODELS));
}
+
+ public async readPricingModel(id: string) {
+ return super.read({ ID: id }, this.buildRestEndpointUrl(ServerRoute.REST_PRICING_MODEL, { id }));
+ }
+
+ public async updatePricingModel(data: PricingModel) {
+ return super.update(data, this.buildRestEndpointUrl(ServerRoute.REST_PRICING_MODEL, { id: data.id }));
+ }
+
+ public async createPricingModel(data: PricingModel) {
+ return super.create(data, this.buildRestEndpointUrl(ServerRoute.REST_PRICING_MODELS));
+ }
+
+ public async deletePricingModel(id: string) {
+ return super.delete(id, this.buildRestEndpointUrl(ServerRoute.REST_PRICING_MODEL, { id }));
+ }
+
}

pricing - test - PricingApi skeleton