Added transactions syncRefund / getRefundReports / status based queries rest endpoints + doc
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
"servers": [
{
"description": "Current server",
- "url": "/v1"
+ "url": "http://localhost:8080/v1"
}
],
"info": {
"type": "string",
"enum": [
"completed",
- "active"
+ "active",
+ "to-refund",
+ "in-error",
+ "not-assigned-to-user"
]
}
},
}
}
},
+ "/api/transactions/action/refund/synchronize": {
+ "post": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Synchronize refunded Transactions",
+ "tags": [
+ "Transactions"
+ ],
+ "responses": {
+ "200": {
+ "description": "Synchronized refunded transactions successfully",
+ "content": {
+ "application/json": {
+ "example": {
+ "status": "Success"
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ }
+ }
+ }
+ },
+ "/api/transactions/action/refund/reports": {
+ "get": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Retrieve Transactions refund reports",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/SiteAreaIDs"
+ },
+ {
+ "$ref": "#/components/parameters/SiteIDs"
+ },
+ {
+ "$ref": "#/components/parameters/Limit"
+ },
+ {
+ "$ref": "#/components/parameters/Skip"
+ },
+ {
+ "$ref": "#/components/parameters/SortFields"
+ },
+ {
+ "$ref": "#/components/parameters/OnlyRecordCount"
+ }
+ ],
+ "tags": [
+ "Transactions"
+ ],
+ "responses": {
+ "200": {
+ "description": "Retrieved Transactions refund reports",
+ "content": {
+ "application/json": {
+ "example": {
+ "count": 1,
+ "result": [
+ {
+ "id": "###",
+ "user": {
+ "id": "###",
+ "name": "###",
+ "firstName": "###",
+ "email": "###"
+ }
+ }
+ ]
+
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ }
+ }
+ }
+ },
"/api/transactions/action/assign": {
"post": {
"security": [

MODIFY
src/server/rest/v1/router/api/TransactionRouter.ts
src/server/rest/v1/router/api/TransactionRouter.ts
@@ -25,12 +25,33 @@ export default class TransactionRouter {
this.buildRouteTransactionsRefund();
this.buildRouteTransactionsAssignUser();
this.buildRouteTransactionsExport();
+ this.buildRouteSynchronizeRefundedTransactions();
+ this.buildRouteTransactionsRefundReports();
return this.router;
}
protected buildRouteTransactions(): void {
this.router.get(`/${ServerRoute.REST_TRANSACTIONS}`, async (req: Request, res: Response, next: NextFunction) => {
+ switch (req.query.Status) {
+ case 'in-error':
+ await RouterUtils.handleServerAction(TransactionService.handleGetTransactionsInError.bind(this), ServerAction.TRANSACTIONS_IN_ERROR, req, res, next);
+ break;
+ case 'completed':
+ await RouterUtils.handleServerAction(TransactionService.handleGetTransactionsCompleted.bind(this), ServerAction.TRANSACTIONS_COMPLETED, req, res, next);
+ break;
+ case 'to-refund':
+ await RouterUtils.handleServerAction(TransactionService.handleGetTransactionsToRefund.bind(this), ServerAction.TRANSACTIONS_TO_REFUND, req, res, next);
+ break;
+ case 'active':
+ await RouterUtils.handleServerAction(TransactionService.handleGetTransactionsActive.bind(this), ServerAction.TRANSACTIONS_ACTIVE, req, res, next);
+ break;
+ case 'not-assigned-to-user':
+ await RouterUtils.handleServerAction(TransactionService.handleGetUnassignedTransactionsCount.bind(this), ServerAction.UNASSIGNED_TRANSACTIONS_COUNT, req, res, next);
+ break;
+ default:
await RouterUtils.handleServerAction(TransactionService.handleGetTransactions.bind(this), ServerAction.TRANSACTIONS, req, res, next);
+ break;
+ }
});
}
@@ -106,4 +127,16 @@ export default class TransactionRouter {
await RouterUtils.handleServerAction(TransactionService.handleExportTransactions.bind(this), ServerAction.TRANSACTIONS_EXPORT, req, res, next);
});
}
+
+ protected buildRouteSynchronizeRefundedTransactions(): void {
+ this.router.post(`/${ServerRoute.REST_TRANSACTIONS_SYNCHRONIZE_REFUNDED}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(TransactionService.handleSynchronizeRefundedTransactions.bind(this), ServerAction.SYNCHRONIZE_REFUNDED_TRANSACTIONS, req, res, next);
+ });
+ }
+
+ protected buildRouteTransactionsRefundReports(): void {
+ this.router.post(`/${ServerRoute.REST_TRANSACTIONS_REFUND_REPORTS}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(TransactionService.handleGetRefundReports.bind(this), ServerAction.TRANSACTIONS_TO_REFUND_REPORTS, req, res, next);
+ });
+ }
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -495,6 +495,8 @@ export enum ServerRoute {
REST_TRANSACTION_SOFT_STOP = 'transactions/:id/stop/soft',
REST_TRANSACTIONS_REFUND = 'transactions/action/refund',
REST_TRANSACTIONS_ASSIGN_USER = 'transactions/action/assign',
+ REST_TRANSACTIONS_SYNCHRONIZE_REFUNDED = 'transactions/action/refund/synchronize',
+ REST_TRANSACTIONS_REFUND_REPORTS = 'transactions/action/refund/reports',
REST_USERS = 'users',
REST_USER = 'users/:id',

Added transactions syncRefund / getRefundReports / status based queries rest endpoints + doc