refactor(billing-platform): removed useless code
MODIFY
src/assets/server/rest/v1/schemas/billing/billing-sub-accounts-get.json
src/assets/server/rest/v1/schemas/billing/billing-sub-accounts-get.json
"title": "Get billing sub accounts Request",
"type": "object",
"properties": {
+ "ID": {
+ "$ref": "common#/definitions/ids"
+ },
"userID": {
"$ref": "common#/definitions/ids"
},

MODIFY
src/server/rest/v1/service/CompanyService.ts
src/server/rest/v1/service/CompanyService.ts
@@ -152,7 +152,6 @@ export default class CompanyService {
Action.CREATE, Entity.COMPANY, MODULE_NAME, 'handleCreateCompany');
const billingSubAccount = await BillingStorage.getSubAccountByID(req.tenant, filteredRequest.accountData.accountID);
UtilsService.assertObjectExists(action, billingSubAccount, `Billing Sub-Account ID '${filteredRequest.accountData.accountID}' does not exist`, MODULE_NAME, 'handleCreateCompany', req.user);
- newCompany.accountData.accountID = billingSubAccount.id;
}
// Save
newCompany.id = await CompanyStorage.saveCompany(req.tenant, newCompany);

MODIFY
src/server/rest/v1/service/SiteService.ts
src/server/rest/v1/service/SiteService.ts
@@ -312,7 +312,6 @@ export default class SiteService {
Action.CREATE, Entity.SITE, MODULE_NAME, 'handleCreateSite');
const billingSubAccount = await BillingStorage.getSubAccountByID(req.tenant, filteredRequest.accountData.accountID);
UtilsService.assertObjectExists(action, billingSubAccount, `Billing Sub-Account ID '${filteredRequest.accountData.accountID}' does not exist`, MODULE_NAME, 'handleCreateSite', req.user);
- site.accountData.accountID = billingSubAccount.id;
}
// Save
site.id = await SiteStorage.saveSite(req.tenant, site, Utils.objectHasProperty(filteredRequest, 'image'));

MODIFY
test/api/BillingTest.ts
test/api/BillingTest.ts
@@ -1141,7 +1141,8 @@ describeif(isBillingProperlyConfigured)('Billing', () => {
// List sub-accounts
const subAccountsResponse = await billingTestHelper.userService.billingApi.readSubAccounts({
- userID: billingTestHelper.userContext.id
+ userID: billingTestHelper.userContext.id,
+ ID: subAccountResponse.data.id
});
expect(subAccountsResponse.status).to.be.eq(StatusCodes.OK);
expect(subAccountsResponse.data.result.map((subAccount: BillingAccount) => subAccount.id)).to.include(subAccountResponse.data.id);

refactor(billing-platform): removed useless code