Added deleteTransaction / deleteTransactions / pushTransactionCDR rest endpoints + doc
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
"$ref": "#/components/responses/BackendError"
}
}
+ },
+ "delete": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Delete several Transactions",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "transactionIDs": {
+ "type": "array",
+ "items": {
+ "type": "number"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "tags": [
+ "Transactions"
+ ],
+ "responses": {
+ "200": {
+ "description": "Transaction deletion result",
+ "content": {
+ "application/json": {
+ "example": {
+ "status": "Success",
+ "inSuccess": 42,
+ "inError": 0
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ }
+ }
}
},
"/api/transactions/{id}": {
"$ref": "#/components/responses/BackendError"
}
}
+ },
+ "delete": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Delete a Transaction",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/transactionID"
+ }
+ ],
+ "tags": [
+ "Transactions"
+ ],
+ "responses": {
+ "200": {
+ "description": "Transaction deletion result",
+ "content": {
+ "application/json": {
+ "example": {
+ "status": "Success",
+ "inSuccess": 1,
+ "inError": 0
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ }
+ }
+ }
+ },
+ "/api/transactions/{id}/ocpi/cdr": {
+ "post": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Push Transaction CDR",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "transactionId": {
+ "type": "number"
+ }
+ }
+ }
+ }
+ }
+ },
+ "tags": [
+ "Transactions"
+ ],
+ "responses": {
+ "200": {
+ "description": "Transaction CDR pushed successfully",
+ "content": {
+ "application/json": {
+ "example": {
+ "status": "Success"
+ }
+ }
+ }
+ },
+ "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": {

MODIFY
src/server/rest/v1/router/api/TransactionRouter.ts
src/server/rest/v1/router/api/TransactionRouter.ts
@@ -16,6 +16,9 @@ export default class TransactionRouter {
this.buildRouteTransactions();
this.buildRouteTransaction();
this.buildRouteTransactionConsumption();
+ this.buildRouteDeleteTransaction();
+ this.buildRouteDeleteTransactions();
+ this.buildRoutePushTransactionCDR();
return this.router;
}
@@ -32,6 +35,26 @@ export default class TransactionRouter {
});
}
+ protected buildRouteDeleteTransactions(): void {
+ this.router.delete(`/${ServerRoute.REST_TRANSACTIONS}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(TransactionService.handleDeleteTransactions.bind(this), ServerAction.TRANSACTIONS_DELETE, req, res, next);
+ });
+ }
+
+ protected buildRouteDeleteTransaction(): void {
+ this.router.delete(`/${ServerRoute.REST_TRANSACTION}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ID = req.params.id;
+ await RouterUtils.handleServerAction(TransactionService.handleDeleteTransaction.bind(this), ServerAction.TRANSACTION_DELETE, req, res, next);
+ });
+ }
+
+ protected buildRoutePushTransactionCDR(): void {
+ this.router.post(`/${ServerRoute.REST_TRANSACTION_CDR}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.body.transactionId = req.params.id;
+ await RouterUtils.handleServerAction(TransactionService.handlePushTransactionCdr.bind(this), ServerAction.OCPI_PUSH_CDRS, 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;

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -487,6 +487,7 @@ export enum ServerRoute {
REST_TRANSACTIONS = 'transactions',
REST_TRANSACTION = 'transactions/:id',
+ REST_TRANSACTION_CDR = 'transactions/:id/ocpi/cdr',
REST_TRANSACTIONS_CONSUMPTION = 'transactions/:id/consumptions',
REST_USERS = 'users',

Added deleteTransaction / deleteTransactions / pushTransactionCDR rest endpoints + doc