doc(subaccount): removed siteID and companyID
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
"bearerAuth": []
}
],
- "description": "Create a Billing sub-account for a site or a company",
+ "description": "Create a Billing sub-account",
"tags": [
"Billing"
],
"application/json": {
"example": {
"userID": "###",
- "siteID": "###",
"accountID": "###",
"activationLink": "###",
"pending": true,
},
"500": {
"$ref": "#/components/responses/BackendError"
+ },
+ "550": {
+ "$ref": "#/components/responses/ResourceDoesNotExists"
}
}
}

MODIFY
src/integration/billing/stripe/StripeBillingIntegration.ts
src/integration/billing/stripe/StripeBillingIntegration.ts
@@ -1697,7 +1697,7 @@ export default class StripeBillingIntegration extends BillingIntegration {
throw new BackendError({
message: 'Unexpected situation - unable to create sub-account',
detailedMessages: { e },
- module: MODULE_NAME, action: ServerAction.BILLING_CREATE_SUB_ACCOUNT,
+ module: MODULE_NAME, action: ServerAction.BILLING_SUB_ACCOUNT_CREATE,
method: 'createSubAccount',
});
}
@@ -1714,7 +1714,7 @@ export default class StripeBillingIntegration extends BillingIntegration {
throw new BackendError({
message: 'Unexpected situation - unable to create activation link',
detailedMessages: { e },
- module: MODULE_NAME, action: ServerAction.BILLING_CREATE_SUB_ACCOUNT,
+ module: MODULE_NAME, action: ServerAction.BILLING_SUB_ACCOUNT_CREATE,
method: 'createSubAccount',
});
}

MODIFY
src/notification/NotificationHandler.ts
src/notification/NotificationHandler.ts
@@ -1383,12 +1383,12 @@ export default class NotificationHandler {
try {
// Save
await NotificationHandler.saveNotification(
- tenant, notificationSource.channel, notificationID, ServerAction.BILLING_CREATE_SUB_ACCOUNT, { user });
+ tenant, notificationSource.channel, notificationID, ServerAction.BILLING_SUB_ACCOUNT_CREATE, { user });
// Send
void notificationSource.notificationTask.sendBillingSubAccountCreationLink(
sourceData, user, tenant, NotificationSeverity.INFO);
} catch (error) {
- await Logging.logActionExceptionMessage(tenant.id, ServerAction.BILLING_CREATE_SUB_ACCOUNT, error);
+ await Logging.logActionExceptionMessage(tenant.id, ServerAction.BILLING_SUB_ACCOUNT_CREATE, error);
}
}
}

MODIFY
src/server/rest/v1/router/api/BillingRouter.ts
src/server/rest/v1/router/api/BillingRouter.ts
@@ -145,7 +145,7 @@ export default class BillingRouter {
private buildRouteBillingCreateSubAccount(): void {
this.router.post(`/${RESTServerRoute.REST_BILLING_SUB_ACCOUNTS}`, (req: Request, res: Response, next: NextFunction) => {
- void RouterUtils.handleRestServerAction(BillingService.handleCreateSubAccount.bind(this), ServerAction.BILLING_CREATE_SUB_ACCOUNT, req, res, next);
+ void RouterUtils.handleRestServerAction(BillingService.handleCreateSubAccount.bind(this), ServerAction.BILLING_SUB_ACCOUNT_CREATE, req, res, next);
});
}
}

MODIFY
src/server/rest/v1/service/BillingService.ts
src/server/rest/v1/service/BillingService.ts
import { Action, Entity } from '../../../../types/Authorization';
-import { BillingAccount, BillingInvoiceStatus, BillingOperationResult, BillingPaymentMethod } from '../../../../types/Billing';
import { BillingInvoiceDataResult, BillingPaymentMethodDataResult } from '../../../../types/DataResult';
-import { HTTPAuthError, HTTPError } from '../../../../types/HTTPError';
+import { BillingInvoiceStatus, BillingOperationResult, BillingPaymentMethod } from '../../../../types/Billing';
import { NextFunction, Request, Response } from 'express';
-import AppAuthError from '../../../../exception/AppAuthError';
import AppError from '../../../../exception/AppError';
import AuthorizationService from './AuthorizationService';
import BillingFactory from '../../../../integration/billing/BillingFactory';
@@ -12,16 +10,14 @@ import BillingSecurity from './security/BillingSecurity';
import { BillingSettings } from '../../../../types/Setting';
import BillingStorage from '../../../../storage/mongodb/BillingStorage';
import BillingValidator from '../validator/BillingValidator';
-import CompanyStorage from '../../../../storage/mongodb/CompanyStorage';
import Constants from '../../../../utils/Constants';
+import { HTTPError } from '../../../../types/HTTPError';
import LockingHelper from '../../../../locking/LockingHelper';
import LockingManager from '../../../../locking/LockingManager';
import Logging from '../../../../utils/Logging';
import NotificationHandler from '../../../../notification/NotificationHandler';
-import NotificationService from './NotificationService';
import { ServerAction } from '../../../../types/Server';
import SettingStorage from '../../../../storage/mongodb/SettingStorage';
-import SiteStorage from '../../../../storage/mongodb/SiteStorage';
import { StatusCodes } from 'http-status-codes';
import { TenantComponents } from '../../../../types/Tenant';
import User from '../../../../types/User';

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -452,7 +452,7 @@ export enum ServerAction {
BILLING_CHARGE_INVOICE = 'BillingChargeInvoice',
BILLING_TEST_DATA_CLEANUP = 'BillingTestDataCleanup',
BILLING_BILL_PENDING_TRANSACTION = 'BillingBillPendingTransaction',
- BILLING_CREATE_SUB_ACCOUNT = 'BillingCreateSubAccount',
+ BILLING_SUB_ACCOUNT_CREATE = 'BillingCreateSubAccount',
PRICING = 'Pricing',
PRICING_DEFINITION = 'PricingDefinition',

MODIFY
src/types/requests/HttpBillingRequest.ts
src/types/requests/HttpBillingRequest.ts
@@ -31,6 +31,4 @@ export interface HttpDeletePaymentMethod {
export interface HttpBillingCreateSubAccount {
userID: string;
- siteID?: string;
- companyID: string;
}

MODIFY
test/api/BillingTest.ts
test/api/BillingTest.ts
/* eslint-disable max-len */
-import { BillingAccount, BillingChargeInvoiceAction, BillingInvoiceStatus } from '../../src/types/Billing';
+import { BillingChargeInvoiceAction, BillingInvoiceStatus } from '../../src/types/Billing';
import { BillingSettings, BillingSettingsType } from '../../src/types/Setting';
import chai, { expect } from 'chai';
import { BillingPeriodicOperationTaskConfig } from '../../src/types/TaskConfig';
import BillingTestHelper from './BillingTestHelper';
import CentralServerService from './client/CentralServerService';
-import CompanyFactory from '../factories/CompanyFactory';
import Constants from '../../src/utils/Constants';
import ContextDefinition from './context/ContextDefinition';
import ContextProvider from './context/ContextProvider';
@@ -16,7 +15,6 @@ import { StatusCodes } from 'http-status-codes';
import StripeTestHelper from './StripeTestHelper';
import TestConstants from './client/utils/TestConstants';
import User from '../../src/types/User';
-import Utils from '../../src/utils/Utils';
import assert from 'assert';
import chaiSubset from 'chai-subset';
import config from '../config';

doc(subaccount): removed siteID and companyID