pricing - test polish
MODIFY
test/api/BillingStripeIntegrationTest.ts
test/api/BillingStripeIntegrationTest.ts
@@ -23,18 +23,6 @@ describe('Billing Stripe Service', function() {
await testData.initialize();
});
- xdescribe('Initialization Pricing Model', () => {
- before(async () => {
- });
-
- after(async () => {
- });
-
- xit('check CRUD operations on a Pricing Model', async () => {
- await testData.checkPricingDefinitionEndpoints();
- });
- });
-
describe('immediate billing OFF', () => {
before(async () => {
const immediateBilling = false;

MODIFY
test/api/BillingStripeTestData.ts
test/api/BillingStripeTestData.ts
@@ -433,59 +433,4 @@ export default class StripeIntegrationTestData {
assert(response?.data?.error, 'error should not be null');
}
}
-
- public async checkPricingDefinitionEndpoints(): Promise<void> {
- const parkingPrice: PricingDimension = {
- price: 0.75,
- active: true
- };
- const tariff1: Partial<PricingDefinition> = {
- entityID: null, // a pricing model for the tenant
- entityType: null,
- name: 'BLUE Tariff',
- description: 'Tariff for low EVSE',
- staticRestrictions: {
- connectorType: null,
- connectorPowerkW: 40,
- validFrom: new Date(),
- validTo: moment().add(10, 'minutes').toDate(),
- },
- dimensions: {
- chargingTime: parkingPrice,
- // energy: price4TheEnergy, // do not bill the energy - bill the parking time instead
- parkingTime: parkingPrice,
- }
- };
- let response = await this.adminUserService.pricingApi.createPricingDefinition(tariff1);
- assert(response?.data?.status === 'Success', 'The operation should succeed');
- assert(response?.data?.id, 'The ID should not be null');
-
- const pricingDefinitionId = response?.data?.id;
- response = await this.adminUserService.pricingApi.readPricingDefinition(pricingDefinitionId);
- assert(response?.data?.id === pricingDefinitionId, 'The ID should be: ' + pricingDefinitionId);
-
- const price4TheEnergy: PricingDimension = {
- price: 0.35,
- active: true
- };
- const tariff2: Partial<PricingDefinition> = {
- name: 'GREEN Tariff',
- description: 'Tariff for fast chargers',
- staticRestrictions: {
- connectorType: null,
- connectorPowerkW: 40,
- validFrom: new Date(),
- validTo: moment().add(10, 'minutes').toDate(),
- },
- dimensions: {
- // chargingTime: parkingPrice, // parking time is free while charging
- energy: price4TheEnergy,
- parkingTime: parkingPrice, // Parking time is not free when not charging
- }
- };
-
- response = await this.adminUserService.pricingApi.createPricingDefinition(tariff2);
- assert(response?.data?.status === 'Success', 'The operation should succeed');
- assert(response?.data?.id, 'The ID should not be null');
- }
}

MODIFY
test/api/BillingTest.ts
test/api/BillingTest.ts
@@ -513,129 +513,6 @@ class TestData {
return (draftInvoice) ? draftInvoice.sessions?.length : 0;
}
- public async initializePricingDefinitions(): Promise<void> {
- // const company = (await this.adminUserService.companyApi.readAll({}, { limit: 0, skip: 0 }))?.data?.result?.[0];
- // assert(company, 'The Company should not be null');
- // await this.createTariff4Company(company.id);
-
- // const sites = (await this.adminUserService.siteApi.readAll({}, { limit: 0, skip: 0 }))?.data?.result;
- // const selectedSites = sites.filter((site) => site.name === 'ut-site-stop');
- // assert(selectedSites, 'Sites should not be null');
- // assert(selectedSites[0], 'The Site should not be null');
- // await this.createTariff4Site(selectedSites[0].id);
-
- // const chargingStations: ChargingStation[] = (await this.adminUserService.chargingStationApi.readAll({}, { limit: 0, skip: 0 }))?.data?.result;
- // let selectedChargingStations = chargingStations.filter((chargingStation) => chargingStation.id === 'cs-16-ut-site-withSmartChargingDC');
- // await this.createTariff4ChargingStation(selectedChargingStations[0], null, ConnectorType.COMBO_CCS);
-
- // selectedChargingStations = chargingStations.filter((chargingStation) => chargingStation.id === 'cs-16-ut-site-withSmartChargingSinglePhased');
- // await this.createTariff4ChargingStation(selectedChargingStations[0]);
-
- // selectedChargingStations = chargingStations.filter((chargingStation) => chargingStation.id === 'cs-16-ut-site-withSmartChargingThreePhased');
- // await this.createTariff4ChargingStation(selectedChargingStations[0], {
- // flatFee: {
- // price: 2,
- // active: true
- // },
- // energy: {
- // price: 0.25,
- // active: true
- // },
- // chargingTime: {
- // price: 0.4,
- // active: false // THIS IS OFF
- // }
- // });
-
- // selectedChargingStations = chargingStations.filter((chargingStation) => chargingStation.id === 'cs-16-ut-site-withSmartChargingThreePhased-singlePhased');
- // await this.createTariff4ChargingStation(selectedChargingStations[0], {
- // flatFee: {
- // price: 1,
- // active: true
- // },
- // chargingTime: {
- // price: 0.4,
- // active: true
- // }
- // });
- }
-
- // public async createTariff4Company(companyID: string): Promise<void> {
- // const tariff: Partial<PricingDefinition> = {
- // entityID: companyID, // a pricing model for the Company
- // entityType: PricingEntity.COMPANY,
- // name: 'GREEN Tariff',
- // description: 'Tariff for slow chargers',
- // staticRestrictions: {
- // connectorPowerkW: 40,
- // },
- // dimensions: {
- // flatFee: {
- // price: 1.25,
- // active: true
- // },
- // chargingTime: {
- // price: 0.15,
- // active: true
- // },
- // energy: {
- // price: 0.35,
- // active: true
- // },
- // parkingTime: {
- // price: 0.75,
- // active: true
- // },
- // }
- // };
-
- // let response = await this.adminUserService.pricingApi.createPricingDefinition(tariff);
- // assert(response?.data?.status === 'Success', 'The operation should succeed');
- // assert(response?.data?.id, 'The ID should not be null');
-
- // const pricingDefinitionId = response?.data?.id;
- // response = await this.adminUserService.pricingApi.readPricingDefinition(pricingDefinitionId);
- // assert(response?.data?.id === pricingDefinitionId, 'The ID should be: ' + pricingDefinitionId);
- // }
-
- // public async createTariff4Site(siteID: string): Promise<void> {
- // const tariff: Partial<PricingDefinition> = {
- // entityID: siteID, // a pricing model for the site
- // entityType: PricingEntity.SITE,
- // name: 'RED Tariff',
- // description: 'Tariff for fast chargers',
- // staticRestrictions: {
- // connectorPowerkW: 40,
- // },
- // dimensions: {
- // flatFee: {
- // price: 2.25,
- // active: true
- // },
- // chargingTime: {
- // price: 0,
- // active: false
- // },
- // energy: {
- // price: 0.75,
- // active: true
- // },
- // parkingTime: {
- // price: 0,
- // active: true
- // },
- // }
- // };
-
- // let response = await this.adminUserService.pricingApi.createPricingDefinition(tariff);
- // assert(response?.data?.status === 'Success', 'The operation should succeed');
- // assert(response?.data?.id, 'The ID should not be null');
-
- // const pricingDefinitionId = response?.data?.id;
- // response = await this.adminUserService.pricingApi.readPricingDefinition(pricingDefinitionId);
- // assert(response?.data?.id === pricingDefinitionId, 'The ID should be: ' + pricingDefinitionId);
- // }
-
public async createTariff4ChargingStation(
testMode: string,
chargingStation: ChargingStation,
@@ -866,18 +743,6 @@ describe('Billing Service', function() {
await testData.initialize();
});
- describe('Pricing Model', () => {
- before(async () => {
- });
-
- after(async () => {
- });
-
- it('Initialize the Pricing Models', async () => {
- await testData.initializePricingDefinitions();
- });
- });
-
describe('with Transaction Billing ON', () => {
before(async () => {
// Initialize the charing station context

pricing - test polish