Added inprogress endpoint
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
}
}
},
- "/api/transactions": {
+ "/api/transactions/history": {
"get": {
"security": [
{
}
}
},
+ "/api/transactions/status/inprogress": {
+ "get": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Retrieve a list of Transactions in progress",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/Issuer"
+ },
+ {
+ "$ref": "#/components/parameters/Search"
+ },
+ {
+ "$ref": "#/components/parameters/StartDateTime"
+ },
+ {
+ "$ref": "#/components/parameters/EndDateTime"
+ },
+ {
+ "$ref": "#/components/parameters/ChargingStationIDs"
+ },
+ {
+ "$ref": "#/components/parameters/ConnectorIDs"
+ },
+ {
+ "$ref": "#/components/parameters/UserIDs"
+ },
+ {
+ "$ref": "#/components/parameters/TagIDs"
+ },
+ {
+ "$ref": "#/components/parameters/SiteIDs"
+ },
+ {
+ "$ref": "#/components/parameters/SiteAreaIDs"
+ },
+ {
+ "$ref": "#/components/parameters/InactivityStatuses"
+ },
+ {
+ "$ref": "#/components/parameters/TransactionStatistics"
+ },
+ {
+ "in": "query",
+ "name": "RefundStatus",
+ "description": "Pipe separated refund statuses",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "MinimalPrice",
+ "description": "Transactions minimal price",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "ReportIDs",
+ "description": "Pipe separated report IDs",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "$ref": "#/components/parameters/Limit"
+ },
+ {
+ "$ref": "#/components/parameters/Skip"
+ },
+ {
+ "$ref": "#/components/parameters/SortFields"
+ },
+ {
+ "$ref": "#/components/parameters/OnlyRecordCount"
+ },
+ {
+ "$ref": "#/components/parameters/ProjectFields"
+ }
+ ],
+ "tags": [
+ "Transactions"
+ ],
+ "responses": {
+ "200": {
+ "description": "Return Transaction's list",
+ "content": {
+ "application/json": {
+ "example": {
+ "count": 1,
+ "result": [
+ {
+ "id": 1234567889,
+ "issuer": true,
+ "siteID": "####",
+ "siteAreaID": "####",
+ "connectorId": 2,
+ "tagID": "####",
+ "userID": "####",
+ "chargeBoxID": "####",
+ "meterStart": 1122030,
+ "timestamp": "2021-02-15T16:04:04.000Z",
+ "stateOfCharge": 0,
+ "timezone": "Europe/Paris",
+ "stop": {
+ "userID": "####",
+ "timestamp": "2021-02-15T16:05:38.000Z",
+ "tagID": "####",
+ "meterStop": 1122046,
+ "stateOfCharge": 0,
+ "totalConsumptionWh": 16,
+ "totalInactivitySecs": 0,
+ "inactivityStatus": "I",
+ "totalDurationSecs": 94,
+ "price": 0.002,
+ "priceUnit": "EUR",
+ "user": {
+ "email": "####",
+ "firstName": "####",
+ "name": "####",
+ "id": "####"
+ }
+ },
+ "ocpi": false,
+ "ocpiWithCdr": false,
+ "user": {
+ "email": "####",
+ "firstName": "####",
+ "name": "####",
+ "id": "####"
+ },
+ "car": {
+ "licensePlate": "####"
+ },
+ "carCatalog": {
+ "vehicleMake": "Tesla",
+ "vehicleModel": "Model 3",
+ "vehicleModelVersion": "Long Range Dual Motor"
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ }
+ }
+ }
+ },
"/api/chargingstations": {
"get": {
"security": [
"TagID": {
"in": "query",
"name": "TagID",
- "description": "Badge ID",
+ "description": "Tag ID",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ "TagIDs": {
+ "in": "query",
+ "name": "TagID",
+ "description": "Pipe separated Tag IDs",
"required": false,
"schema": {
"type": "string"
"type": "string"
}
},
+ "UserIDs": {
+ "in": "query",
+ "name": "UserID",
+ "description": "Pipe separated User IDs",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
"userID": {
"in": "path",
"name": "id",
"type": "number"
}
},
+ "ConnectorIDs": {
+ "in": "query",
+ "name": "ConnectorID",
+ "description": "Pipe separated Connector IDs",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
"InactivityStatus": {
"in": "query",
"name": "InactivityStatus",
]
}
},
+ "InactivityStatuses": {
+ "in": "query",
+ "name": "InactivityStatus",
+ "description": "Pipe separated Inactivity Statuses (I, W, E)",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
"chargingProfileID": {
"in": "path",
"name": "id",

MODIFY
src/server/rest/v1/router/api/TransactionRouter.ts
src/server/rest/v1/router/api/TransactionRouter.ts
@@ -14,6 +14,9 @@ export default class TransactionRouter {
public buildRoutes(): express.Router {
this.buildRouteCompletedTransactions();
+ this.buildRouteTransaction();
+ this.buildRouteTransactionConsumption();
+ this.buildRouteTransactionsInProgress();
return this.router;
}
@@ -22,4 +25,24 @@ export default class TransactionRouter {
await RouterUtils.handleServerAction(TransactionService.handleGetTransactionsCompleted.bind(this), ServerAction.CHARGING_STATIONS, req, res, next);
});
}
+
+ protected buildRouteTransaction(): void {
+ this.router.get(`/${ServerRoute.REST_TRANSACTION}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ID = req.params.id;
+ await RouterUtils.handleServerAction(TransactionService.handleGetTransaction.bind(this), ServerAction.CHARGING_STATIONS, req, res, next);
+ });
+ }
+
+ protected buildRouteTransactionsInProgress(): void {
+ this.router.get(`/${ServerRoute.REST_TRANSACTIONS_IN_PROGRESS}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(TransactionService.handleGetTransactionsActive.bind(this), ServerAction.CHARGING_STATIONS, req, res, next);
+ });
+ }
+
+ protected buildRouteTransactionConsumption(): void {
+ this.router.get(`/${ServerRoute.REST_TRANSACTIONS_CONSUMPTION}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.TransactionId = req.params.id;
+ await RouterUtils.handleServerAction(TransactionService.handleGetTransactionConsumption.bind(this), ServerAction.CHARGING_STATIONS, req, res, next);
+ });
+ }
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -471,7 +471,10 @@ export enum ServerRoute {
REST_CHARGING_PROFILES = 'chargingprofiles',
REST_CHARGING_PROFILE = 'chargingprofiles/:id',
- REST_TRANSACTIONS = 'transactions',
+ REST_TRANSACTIONS = 'transactions/history',
+ REST_TRANSACTION = 'transactions/:id',
+ REST_TRANSACTIONS_IN_PROGRESS = 'transactions/status/inprogress',
+ REST_TRANSACTIONS_CONSUMPTION = 'transactions/:id/consumption',
REST_USERS = 'users',
REST_USER = 'users/:id',

MODIFY
test/api/client/TransactionApi.ts
test/api/client/TransactionApi.ts
import CrudApi from './utils/CrudApi';
+import { ServerRoute } from '../../../src/types/Server';
import TestConstants from './utils/TestConstants';
export default class TransactionApi extends CrudApi {
@@ -11,7 +12,7 @@ export default class TransactionApi extends CrudApi {
}
public async readAllActive(params, paging = TestConstants.DEFAULT_PAGING, ordering = TestConstants.DEFAULT_ORDERING) {
- return await super.readAll(params, paging, ordering, '/client/api/TransactionsActive');
+ return await super.readAll(params, paging, ordering, `/v1/api/${ServerRoute.REST_TRANSACTIONS_IN_PROGRESS}`);
}
public async readAllCompleted(params, paging = TestConstants.DEFAULT_PAGING, ordering = TestConstants.DEFAULT_ORDERING) {

Added inprogress endpoint