bp - unassign account from site
MODIFY
src/storage/mongodb/SiteStorage.ts
src/storage/mongodb/SiteStorage.ts
@@ -271,11 +271,18 @@ export default class SiteStorage {
(coordinate) => Utils.convertToFloat(coordinate)) : [],
};
}
- if (siteToSave.accountData) {
+ if (Utils.isTenantComponentActive(tenant, TenantComponents.BILLING_PLATFORM)) {
+ if (siteToSave.accountData?.accountID) {
siteMDB.accountData = {
accountID: DatabaseUtils.convertToObjectID(siteToSave.accountData.accountID),
- platformFeeStrategy: siteToSave.accountData.platformFeeStrategy,
+ platformFeeStrategy: {
+ flatFeePerSession: siteToSave.accountData.platformFeeStrategy?.flatFeePerSession || 0,
+ percentage: siteToSave.accountData.platformFeeStrategy?.percentage || 0,
+ }
};
+ } else {
+ siteMDB.accountData = null;
+ }
}
// Add Last Changed/Created props
DatabaseUtils.addLastChangedCreatedProps(siteMDB, siteToSave);

bp - unassign account from site