billing abstraction - isUserInternal removal
MODIFY
src/integration/billing/BillingIntegration.ts
src/integration/billing/BillingIntegration.ts
@@ -331,14 +331,6 @@ export default abstract class BillingIntegration {
}
}
- protected isTransactionUserInternal(transaction: Transaction): boolean {
- return this.isUserInternal(transaction?.user);
- }
-
- protected isUserInternal(user: User): boolean {
- return !!user.freeAccess;
- }
-
private async _getUsersWithNoBillingData(): Promise<User[]> {
const newUsers = await UserStorage.getUsers(this.tenant,
{

MODIFY
src/integration/billing/stripe/StripeBillingIntegration.ts
src/integration/billing/stripe/StripeBillingIntegration.ts
@@ -756,8 +756,8 @@ export default class StripeBillingIntegration extends BillingIntegration {
withBillingActive: false
};
}
- // Temporary solution - Check for internal users
- if (this.isTransactionUserInternal(transaction)) {
+ // User with free access are not billed
+ if (transaction.user?.freeAccess) {
return {
// Do not bill internal users
withBillingActive: false
@@ -1439,8 +1439,8 @@ export default class StripeBillingIntegration extends BillingIntegration {
// Nothing to check - billing of transactions is not yet ON
return errorCodes;
}
- if (this.isUserInternal(user)) {
- // Nothing to check - we do not bill internal user's transactions
+ if (user.freeAccess) {
+ // Nothing to check - we do not bill user having a free access
return errorCodes;
}
// Make sure the STRIPE connection is ok

billing abstraction - isUserInternal removal