Adding backend changes to save company name in account
MODIFY
src/assets/server/rest/v1/schemas/billing/billing-create-account.json
src/assets/server/rest/v1/schemas/billing/billing-create-account.json
"properties": {
"businessOwnerID": {
"$ref": "common#/definitions/id"
+ },
+ "companyName": {
+ "type": "string",
+ "sanitize": "mongo"
}
},
"required": [
- "businessOwnerID"
+ "businessOwnerID",
+ "companyName"
]
}

MODIFY
src/server/rest/v1/service/BillingService.ts
src/server/rest/v1/service/BillingService.ts
@@ -564,7 +564,8 @@ export default class BillingService {
status: BillingAccountStatus.IDLE,
accountExternalID: null,
createdBy: { id: req.user.id },
- createdOn: new Date()
+ createdOn: new Date(),
+ companyName: filteredRequest.companyName
};
// Save the account
billingAccount.id = await BillingStorage.saveAccount(req.tenant, billingAccount);

MODIFY
src/storage/mongodb/BillingStorage.ts
src/storage/mongodb/BillingStorage.ts
@@ -214,6 +214,7 @@ export default class BillingStorage {
businessOwnerID: DatabaseUtils.convertToObjectID(billingAccount.businessOwnerID),
accountExternalID: billingAccount.accountExternalID,
activationLink: billingAccount.activationLink, // Should not be persisted - added here only for troubleshooting purposes
+ companyName: billingAccount.companyName
};
// Check Created/Last Changed By
DatabaseUtils.addLastChangedCreatedProps(billingAccountMDB, billingAccount);

MODIFY
src/types/Billing.ts
src/types/Billing.ts
@@ -166,6 +166,7 @@ export interface BillingAccount extends CreatedUpdatedProps, BillingTransferAuth
id?: string;
businessOwnerID: string;
businessOwner?: User;
+ companyName: string;
status: BillingAccountStatus;
activationLink?: string;
accountExternalID: string;

MODIFY
test/api/BillingTestHelper.ts
test/api/BillingTestHelper.ts
@@ -886,7 +886,8 @@ export default class BillingTestHelper {
public async createBillingAccount(): Promise<string> {
let response = await this.getCurrentUserService().billingApi.createBillingAccount({
- businessOwnerID: this.getCurrentUserContext().id
+ businessOwnerID: this.getCurrentUserContext().id,
+ companyName: 'utbillingdemo'
});
expect(response.status).to.be.eq(StatusCodes.OK);
const accountID = response.data?.id ;

Adding backend changes to save company name in account