mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
f4abbb2de1
* factory and statergie * chore: use correct method of DI * feat: add onchagne * add logic to HWM stat * add webhook resolver methods to each statergy * move seat tracking + webhooks over to own statergy * Move to factory base approach * move logic to correct class * rename create -> createByTeamId * fix: remove debug `true ||` overrides from IS_STRIPE_ENABLED and IS_TEAM_BILLING_ENABLED Remove accidentally committed debug overrides that short-circuited IS_STRIPE_ENABLED and IS_TEAM_BILLING_ENABLED to always be true, bypassing Stripe credential checks. This would break self-hosted instances without Stripe configured. Identified by cubic (https://cubic.dev) Co-Authored-By: unknown <> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
18 lines
687 B
TypeScript
18 lines
687 B
TypeScript
import type { IBillingProviderService } from "../billingProvider/IBillingProviderService";
|
|
import { BaseSeatBillingStrategy } from "./ISeatBillingStrategy";
|
|
import type { SeatChangeContext } from "./ISeatBillingStrategy";
|
|
|
|
export class ImmediateUpdateStrategy extends BaseSeatBillingStrategy {
|
|
constructor(private readonly billingProviderService: IBillingProviderService) {
|
|
super();
|
|
}
|
|
|
|
async onSeatChange(context: SeatChangeContext): Promise<void> {
|
|
await this.billingProviderService.handleSubscriptionUpdate({
|
|
subscriptionId: context.subscriptionId,
|
|
subscriptionItemId: context.subscriptionItemId,
|
|
membershipCount: context.membershipCount,
|
|
});
|
|
}
|
|
}
|