users - sync billing - reverting changes
MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -919,12 +919,6 @@ export default class UserService {
private static async syncUserAndUpdateBillingData(action: ServerAction, tenant: Tenant, loggedUser: UserToken, user: User): Promise<void> {
if (Utils.isComponentActiveFromToken(loggedUser, TenantComponents.BILLING)) {
- if (!FeatureToggles.isFeatureActive(Feature.BILLING_SYNC_USER_ASAP)) {
- if (!user.billingData?.customerID) {
- // Nothing to do - user will be synchronized in a LAZY mode when adding a payment method
- return;
- }
- }
const billingImpl = await BillingFactory.getBillingImpl(tenant);
if (billingImpl) {
try {

MODIFY
src/utils/FeatureToggles.ts
src/utils/FeatureToggles.ts
@@ -5,7 +5,6 @@ export enum Feature {
BILLING_PREVENT_CUSTOMER_DELETION,
BILLING_SHOW_PRICING_DETAIL,
BILLING_PLATFORM_USE_EXPRESS_ACCOUNT,
- BILLING_SYNC_USER_ASAP,
}
export default class FeatureToggles {
@@ -14,7 +13,6 @@ export default class FeatureToggles {
Feature.BILLING_INVOICES_EXCLUDE_PENDING_ITEMS,
Feature.BILLING_PREVENT_CUSTOMER_DELETION,
Feature.BILLING_PLATFORM_USE_EXPRESS_ACCOUNT,
- // Feature.BILLING_SYNC_USER_ASAP - We do not want it - too slow when importing users
];
// Check whether the feature is active or not!

MODIFY
test/api/BillingTest.ts
test/api/BillingTest.ts
import { BillingSettings, BillingSettingsType } from '../../src/types/Setting';
-import FeatureToggles, { Feature } from '../../src/utils/FeatureToggles';
import StripeTestHelper, { BillingTestConfigHelper } from './StripeTestHelper';
import chai, { expect } from 'chai';
@@ -332,11 +331,7 @@ describeif(isBillingProperlyConfigured)('Billing', () => {
fakeUser
);
billingTestHelper.createdUsers.push(fakeUser);
- if (!FeatureToggles.isFeatureActive(Feature.BILLING_SYNC_USER_ASAP)) {
- // LAZY Mode - STRIPE Customer is created on-demand!
- // Let's trigger the creation of the customer
await billingTestHelper.billingImpl.synchronizeUser(fakeUser);
- }
// Let's check that the corresponding billing user exists as well (a Customer in the STRIPE DB)
let billingUser = await billingTestHelper.billingImpl.getUser(fakeUser);
expect(billingUser).to.be.not.null;

users - sync billing - reverting changes