billing - check components.ORGANIZATION
MODIFY
src/integration/billing/BillingIntegration.ts
src/integration/billing/BillingIntegration.ts
import { BillingChargeInvoiceAction, BillingDataTransactionStart, BillingDataTransactionStop, BillingDataTransactionUpdate, BillingInvoice, BillingInvoiceItem, BillingInvoiceStatus, BillingOperationResult, BillingPaymentMethod, BillingStatus, BillingTax, BillingUser, BillingUserSynchronizeAction } from '../../types/Billing';
+import Tenant, { TenantComponents } from '../../types/Tenant';
import Transaction, { StartTransactionErrorCode } from '../../types/Transaction';
import User, { UserStatus } from '../../types/User';
@@ -14,7 +15,6 @@ import NotificationHandler from '../../notification/NotificationHandler';
import { Promise } from 'bluebird';
import { Request } from 'express';
import { ServerAction } from '../../types/Server';
-import Tenant from '../../types/Tenant';
import TenantStorage from '../../storage/mongodb/TenantStorage';
import TransactionStorage from '../../storage/mongodb/TransactionStorage';
import UserStorage from '../../storage/mongodb/UserStorage';
@@ -256,6 +256,7 @@ export default abstract class BillingIntegration {
action: ServerAction.BILLING_TRANSACTION
});
}
+ if (Utils.isTenantComponentActive(this.tenant, TenantComponents.ORGANIZATION)) {
// Check for the Site Area
if (!chargingStation.siteArea) {
throw new BackendError({
@@ -266,6 +267,7 @@ export default abstract class BillingIntegration {
});
}
}
+ }
private async _synchronizeUser(user: User, forceMode = false): Promise<BillingUser> {
// Check if we need to create or update a STRIPE customer

MODIFY
src/integration/billing/stripe/StripeBillingIntegration.ts
src/integration/billing/stripe/StripeBillingIntegration.ts
@@ -4,6 +4,7 @@ import { BillingDataTransactionStart, BillingDataTransactionStop, BillingDataTra
import { DimensionType, PricedConsumptionData, PricedDimensionData } from '../../../types/Pricing';
import FeatureToggles, { Feature } from '../../../utils/FeatureToggles';
import StripeHelpers, { StripeChargeOperationResult } from './StripeHelpers';
+import Tenant, { TenantComponents } from '../../../types/Tenant';
import Transaction, { StartTransactionErrorCode } from '../../../types/Transaction';
import AsyncTaskBuilder from '../../../async-task/AsyncTaskBuilder';
@@ -27,7 +28,6 @@ import { Request } from 'express';
import { ServerAction } from '../../../types/Server';
import SettingStorage from '../../../storage/mongodb/SettingStorage';
import Stripe from 'stripe';
-import Tenant from '../../../types/Tenant';
import TransactionStorage from '../../../storage/mongodb/TransactionStorage';
import User from '../../../types/User';
import UserStorage from '../../../storage/mongodb/UserStorage';
@@ -797,12 +797,14 @@ export default class StripeBillingIntegration extends BillingIntegration {
withBillingActive: false
};
}
+ if (Utils.isTenantComponentActive(this.tenant, TenantComponents.ORGANIZATION)) {
// Check Access Control
if (!chargingStation.siteArea.accessControl) {
return {
withBillingActive: false
};
}
+ }
// Check Stripe
await this.checkConnection();
// Check Start Transaction Prerequisites

billing - check components.ORGANIZATION