Added cdrExport/rebuildConsumption/softStop rest endpoints + doc
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
}
}
},
+ "/api/transactions/{id}/ocpi/cdr/export": {
+ "get": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/WithUser"
+ },
+ {
+ "$ref": "#/components/parameters/WithCar"
+ },
+ {
+ "$ref": "#/components/parameters/WithTag"
+ }
+ ],
+ "description": "Export Transaction CDR",
+ "tags": [
+ "Transactions"
+ ],
+ "responses": {
+ "200": {
+ "description": "Exported Transaction CDR",
+ "content": {
+ "application/json": {
+ "example": {
+ "id": "###",
+ "start_date_time": "2020-06-30T14:08:50.000Z",
+ "stop_date_time": "2020-06-30T14:33:56.000Z",
+ "total_parking_time": 0,
+ "total_time": 1506,
+ "total_energy": 4.502,
+ "total_cost": 0.72,
+ "currency": "EUR",
+ "auth_id": "###",
+ "authorization_id": "###",
+ "auth_method": "AUTH_REQUEST",
+ "location": {
+ "id": "###",
+ "name": "###",
+ "address": "###",
+ "city": "###",
+ "postal_code": "###",
+ "country": "###",
+ "coordinates": {
+ "latitude": "###",
+ "longitude": "###"
+ },
+ "type": "UNKNOWN",
+ "evses": [
+ {
+ "uid": "###",
+ "evse_id": "###",
+ "status": "BLOCKED",
+ "capabilities": [
+ "REMOTE_START_STOP_CAPABLE",
+ "RFID_READER"
+ ],
+ "connectors": [
+ {
+ "id": "###",
+ "standard": "IEC_62196_T2",
+ "format": "SOCKET",
+ "voltage": 230,
+ "amperage": 96,
+ "power_type": "AC_3_PHASE",
+ "last_updated": "2020-06-30T14:08:47.621Z"
+ }
+ ],
+ "coordinates": {
+ "latitude": "###",
+ "longitude": "###"
+ },
+ "last_updated": "2020-06-30T14:08:47.621Z"
+ }
+ ],
+ "last_updated": "2020-05-06T09:18:10.227Z"
+ },
+ "charging_periods": [
+ {
+ "start_date_time": "2020-06-30T14:08:50.000Z",
+ "dimensions": [
+ {
+ "type": "ENERGY",
+ "volume": 0.108
+ },
+ {
+ "type": "MAX_CURRENT",
+ "volume": 96
+ }
+ ]
+ },
+ {
+ "start_date_time": "2020-06-30T14:10:50.000Z",
+ "dimensions": [
+ {
+ "type": "ENERGY",
+ "volume": 0.182
+ },
+ {
+ "type": "MAX_CURRENT",
+ "volume": 96
+ }
+ ]
+ }
+ ],
+ "last_updated": "2020-06-30T14:33:56.000Z"
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ },
+ "580": {
+ "description": "The transaction belongs to an external organization"
+ },
+ "581": {
+ "description": "The transaction has no OCPI or OICP session data"
+ },
+ "582": {
+ "description": "The CDR of the transaction has already been pushed"
+ }
+ }
+ }
+ },
"/api/transactions/{id}/consumptions": {
"get": {
"security": [
}
}
},
+ "/api/transactions/{id}/consumptions/rebuild": {
+ "post": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Rebuild a Transaction consumptions",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/transactionID"
+ }
+ ],
+ "tags": [
+ "Transactions"
+ ],
+ "responses": {
+ "200": {
+ "description": "Consumptions rebuild result",
+ "content": {
+ "application/json": {
+ "example": {
+ "status": "Success",
+ "nbrOfConsumptions": 1
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ }
+ }
+ }
+ },
+ "/api/transactions/{id}/stop/soft": {
+ "post": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Stop a Transaction",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/transactionID"
+ }
+ ],
+ "tags": [
+ "Transactions"
+ ],
+ "responses": {
+ "200": {
+ "description": "Transaction stop successfully",
+ "content": {
+ "application/json": {
+ "example": {
+ "status": "Success"
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ }
+ }
+ }
+ },
"/api/charging-stations": {
"get": {
"security": [

MODIFY
src/server/rest/v1/router/api/TransactionRouter.ts
src/server/rest/v1/router/api/TransactionRouter.ts
@@ -55,10 +55,31 @@ export default class TransactionRouter {
});
}
+ protected buildRouteExportTransactionCDR(): void {
+ this.router.get(`/${ServerRoute.REST_TRANSACTION_CDR_EXPORT}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ID = req.params.id;
+ await RouterUtils.handleServerAction(TransactionService.handleExportTransactionOcpiCdr.bind(this), ServerAction.TRANSACTION_OCPI_CDR_EXPORT, 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.TRANSACTION_CONSUMPTION, req, res, next);
});
}
+
+ protected buildRouteRebuildTransactionConsumption(): void {
+ this.router.post(`/${ServerRoute.REST_TRANSACTION_CONSUMPTIONS_REBUILD}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ID = req.params.id;
+ await RouterUtils.handleServerAction(TransactionService.handleRebuildTransactionConsumptions.bind(this), ServerAction.REBUILD_TRANSACTION_CONSUMPTIONS, req, res, next);
+ });
+ }
+
+ protected buildRouteTransactionSoftStop(): void {
+ this.router.put(`/${ServerRoute.REST_TRANSACTION_SOFT_STOP}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.body.ID = req.params.id;
+ await RouterUtils.handleServerAction(TransactionService.handleTransactionSoftStop.bind(this), ServerAction.TRANSACTION_SOFT_STOP, req, res, next);
+ });
+ }
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -488,7 +488,10 @@ export enum ServerRoute {
REST_TRANSACTIONS = 'transactions',
REST_TRANSACTION = 'transactions/:id',
REST_TRANSACTION_CDR = 'transactions/:id/ocpi/cdr',
+ REST_TRANSACTION_CDR_EXPORT = 'transactions/:id/ocpi/cdr/action/export',
REST_TRANSACTIONS_CONSUMPTION = 'transactions/:id/consumptions',
+ REST_TRANSACTION_CONSUMPTIONS_REBUILD = 'transactions/:id/consumptions/rebuild',
+ REST_TRANSACTION_SOFT_STOP = 'transactions/:id/stop/soft',
REST_USERS = 'users',
REST_USER = 'users/:id',

Added cdrExport/rebuildConsumption/softStop rest endpoints + doc