Files
7e73d675d7 refactor: improve invoice.upcoming logging and add strategyName to billing strategies (#28143)
- Add strategyName property to ISeatBillingStrategy interface and all implementations
- Log which strategy handled the invoice.upcoming webhook (not just whether it applied)
- Always log strategy result (not just when applied=true) for better observability
- Rename highWaterMarkApplied to strategyApplied since applied covers multiple strategies

Co-Authored-By: unknown <>

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-02-23 15:57:13 +00:00

20 lines
733 B
TypeScript

import type { IBillingProviderService } from "../billingProvider/IBillingProviderService";
import type { SeatChangeContext } from "./ISeatBillingStrategy";
import { BaseSeatBillingStrategy } from "./ISeatBillingStrategy";
export class ImmediateUpdateStrategy extends BaseSeatBillingStrategy {
readonly strategyName = "ImmediateUpdate";
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,
});
}
}