Skip to content

Commit b7b045f

Browse files
committed
[ubp] allow usage of team without stripe sub
1 parent 797c1b7 commit b7b045f

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

components/dashboard/src/components/UsageBasedBillingConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export default function UsageBasedBillingConfig({ attributionId }: Props) {
185185
}, [attributionId, billingCycleFrom]);
186186

187187
const showSpinner = !attributionId || isLoadingStripeSubscription || !!pendingStripeSubscription;
188-
const showBalance = !showSpinner && !(AttributionId.parse(attributionId)?.kind === "team" && !stripeSubscriptionId);
188+
const showBalance = !showSpinner;
189189
const showUpgradeTeam =
190190
!showSpinner && AttributionId.parse(attributionId)?.kind === "team" && !stripeSubscriptionId;
191191
const showUpgradeUser =

components/server/src/user/user-service.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,6 @@ export class UserService {
210210
"You're no longer a member of the selected billing team.",
211211
);
212212
}
213-
if (await this.isUnbilledTeam(attribution)) {
214-
throw new ResponseError(
215-
ErrorCodes.INVALID_COST_CENTER,
216-
"The billing team you've selected does not have billing enabled.",
217-
);
218-
}
219213
}
220214
if (attribution.kind === "user") {
221215
if (user.id !== attribution.userId) {
@@ -258,11 +252,7 @@ export class UserService {
258252
} else {
259253
attributionId = AttributionId.create(user);
260254
}
261-
if (
262-
!!attributionId &&
263-
(await this.hasCredits(attributionId)) &&
264-
!(await this.isUnbilledTeam(attributionId))
265-
) {
255+
if (!!attributionId && (await this.hasCredits(attributionId))) {
266256
return attributionId;
267257
}
268258
}
@@ -317,14 +307,6 @@ export class UserService {
317307
return response.usedCredits < response.usageLimit;
318308
}
319309

320-
protected async isUnbilledTeam(attributionId: AttributionId): Promise<boolean> {
321-
if (attributionId.kind !== "team") {
322-
return false;
323-
}
324-
const billingStrategy = await this.usageService.getCurrentBillingStategy(attributionId);
325-
return billingStrategy !== CostCenter_BillingStrategy.BILLING_STRATEGY_STRIPE;
326-
}
327-
328310
async setUsageAttribution(user: User, usageAttributionId: string): Promise<void> {
329311
await this.validateUsageAttributionId(user, usageAttributionId);
330312
user.usageAttributionId = usageAttributionId;

0 commit comments

Comments
 (0)