billing - merge BillingRouter and BillingSettingRouter
MODIFY
src/server/rest/v1/router/GlobalRouter.ts
src/server/rest/v1/router/GlobalRouter.ts
@@ -3,7 +3,6 @@ import express, { NextFunction, Request, Response } from 'express';
import AuthRouter from './auth/AuthRouter';
import AuthService from '../service/AuthService';
import BillingRouter from './api/BillingRouter';
-import BillingSettingRouter from './api/BillingSettingRouter';
import ChargingStationRouter from './api/ChargingStationRouter';
import { StatusCodes } from 'http-status-codes';
import SwaggerRouter from './doc/SwaggerRouter';
@@ -44,7 +43,6 @@ export default class GlobalRouter {
new TransactionRouter().buildRoutes(),
new UserRouter().buildRoutes(),
new BillingRouter().buildRoutes(),
- new BillingSettingRouter().buildRoutes(),
]);
}

MODIFY
src/server/rest/v1/router/api/BillingRouter.ts
src/server/rest/v1/router/api/BillingRouter.ts
@@ -2,6 +2,7 @@ import { ServerAction, ServerRoute } from '../../../../../types/Server';
import express, { NextFunction, Request, Response } from 'express';
import BillingService from '../../service/BillingService';
+import BillingSettingService from '../../service/BillingSettingService';
import RouterUtils from '../RouterUtils';
export default class BillingRouter {
@@ -12,6 +13,20 @@ export default class BillingRouter {
}
public buildRoutes(): express.Router {
+ // -----------------------------------
+ // ROUTES for BILLING SETTINGS
+ // -----------------------------------
+ this.buildRouteBillingSettings();
+ this.buildRouteBillingSetting();
+ // this.buildRouteCreateBillingSetting();
+ this.buildRouteUpdateBillingSetting();
+ // this.buildRouteDeleteBillingSetting();
+ this.buildRouteCheckBillingSetting();
+ this.buildRouteActivateBillingSetting();
+ this.buildRouteCheckBillingSettingConnection();
+ // -----------------------------------
+ // ROUTES for PAYMENT METHODS
+ // -----------------------------------
this.buildRouteBillingPaymentMethods();
// this.buildRouteBillingPaymentMethod(); - // No use case so far
// this.buildRouteBillingCreatePaymentMethod(); - // No use case so far
@@ -23,6 +38,42 @@ export default class BillingRouter {
return this.router;
}
+ protected buildRouteBillingSettings(): void {
+ this.router.get(`/${ServerRoute.REST_BILLING_SETTINGS}`, (req: Request, res: Response, next: NextFunction) => {
+ void RouterUtils.handleServerAction(BillingSettingService.handleGetBillingSettings.bind(this), ServerAction.SETTINGS, req, res, next);
+ });
+ }
+
+ protected buildRouteBillingSetting(): void {
+ this.router.get(`/${ServerRoute.REST_BILLING_SETTING}`, (req: Request, res: Response, next: NextFunction) => {
+ void RouterUtils.handleServerAction(BillingSettingService.handleGetBillingSetting.bind(this), ServerAction.SETTINGS, req, res, next);
+ });
+ }
+
+ protected buildRouteUpdateBillingSetting(): void {
+ this.router.put(`/${ServerRoute.REST_BILLING_SETTING}`, (req: Request, res: Response, next: NextFunction) => {
+ void RouterUtils.handleServerAction(BillingSettingService.handleUpdateBillingSetting.bind(this), ServerAction.SETTINGS, req, res, next);
+ });
+ }
+
+ protected buildRouteCheckBillingSetting(): void {
+ this.router.post(`/${ServerRoute.REST_BILLING_SETTING_CHECK}`, (req: Request, res: Response, next: NextFunction) => {
+ void RouterUtils.handleServerAction(BillingSettingService.handleCheckBillingSetting.bind(this), ServerAction.SETTINGS, req, res, next);
+ });
+ }
+
+ protected buildRouteActivateBillingSetting(): void {
+ this.router.post(`/${ServerRoute.REST_BILLING_SETTING_ACTIVATE}`, (req: Request, res: Response, next: NextFunction) => {
+ void RouterUtils.handleServerAction(BillingSettingService.handleActivateBillingSetting.bind(this), ServerAction.SETTINGS, req, res, next);
+ });
+ }
+
+ protected buildRouteCheckBillingSettingConnection(): void {
+ this.router.post(`/${ServerRoute.REST_BILLING_SETTING_CHECK_CONNECTION}`, (req: Request, res: Response, next: NextFunction) => {
+ void RouterUtils.handleServerAction(BillingSettingService.handleCheckBillingSettingConnection.bind(this), ServerAction.SETTINGS, req, res, next);
+ });
+ }
+
protected buildRouteBillingPaymentMethods(): void {
this.router.get(`/${ServerRoute.REST_BILLING_PAYMENT_METHODS}`, (req: Request, res: Response, next: NextFunction) => {
// GET {{base_url}}/v1/api/billing/users/5be451dad0685c19bff48856/payment-methods?Limit=100&SortFields=id

DELETE
src/server/rest/v1/router/api/BillingSettingRouter.ts
-import { ServerAction, ServerRoute } from '../../../../../types/Server';
-import express, { NextFunction, Request, Response } from 'express';
-
-import BillingSettingService from '../../service/BillingSettingService';
-import RouterUtils from '../RouterUtils';
-
-export default class SettingRouter {
- private router: express.Router;
-
- public constructor() {
- this.router = express.Router();
- }
-
- public buildRoutes(): express.Router {
- this.buildRouteBillingSettings();
- this.buildRouteBillingSetting();
- // this.buildRouteCreateBillingSetting();
- this.buildRouteUpdateBillingSetting();
- // this.buildRouteDeleteBillingSetting();
- this.buildRouteCheckBillingSetting();
- this.buildRouteActivateBillingSetting();
- return this.router;
- }
-
- protected buildRouteBillingSettings(): void {
- this.router.get(`/${ServerRoute.REST_BILLING_SETTINGS}`, (req: Request, res: Response, next: NextFunction) => {
- void RouterUtils.handleServerAction(BillingSettingService.handleGetBillingSettings.bind(this), ServerAction.SETTINGS, req, res, next);
- });
- }
-
- protected buildRouteBillingSetting(): void {
- this.router.get(`/${ServerRoute.REST_BILLING_SETTING}`, (req: Request, res: Response, next: NextFunction) => {
- void RouterUtils.handleServerAction(BillingSettingService.handleGetBillingSetting.bind(this), ServerAction.SETTINGS, req, res, next);
- });
- }
-
- protected buildRouteUpdateBillingSetting(): void {
- this.router.put(`/${ServerRoute.REST_BILLING_SETTING}`, (req: Request, res: Response, next: NextFunction) => {
- void RouterUtils.handleServerAction(BillingSettingService.handleUpdateBillingSetting.bind(this), ServerAction.SETTINGS, req, res, next);
- });
- }
-
- protected buildRouteCheckBillingSetting(): void {
- this.router.post(`/${ServerRoute.REST_BILLING_SETTING_CHECK}`, (req: Request, res: Response, next: NextFunction) => {
- void RouterUtils.handleServerAction(BillingSettingService.handleCheckBillingSetting.bind(this), ServerAction.SETTINGS, req, res, next);
- });
- }
-
- protected buildRouteActivateBillingSetting(): void {
- this.router.post(`/${ServerRoute.REST_BILLING_SETTING_ACTIVATE}`, (req: Request, res: Response, next: NextFunction) => {
- void RouterUtils.handleServerAction(BillingSettingService.handleActivateBillingSetting.bind(this), ServerAction.SETTINGS, req, res, next);
- });
- }
-
- protected buildRouteCheckBillingSettingConnection(): void {
- this.router.post(`/${ServerRoute.REST_BILLING_SETTING_CHECK_CONNECTION}`, (req: Request, res: Response, next: NextFunction) => {
- void RouterUtils.handleServerAction(BillingSettingService.handleCheckBillingSettingConnection.bind(this), ServerAction.SETTINGS, req, res, next);
- });
- }
-
-}
-

billing - merge BillingRouter and BillingSettingRouter