* feat: add PlatformOrganizationBillingTasker with sync and trigger.dev versions - Create PlatformOrganizationBillingTasker extending Tasker base class - Add sync tasker (PlatformOrganizationBillingSyncTasker) for synchronous execution - Add trigger.dev tasker (PlatformOrganizationBillingTriggerTasker) for async execution - Create trigger.dev task for incrementing subscription usage - Add PlatformOrganizationBillingTaskService with business logic - Add PlatformOrganizationBillingRepository for data access - Add createSubscriptionUsageRecord method to StripeBillingService - Follow BookingEmailAndSmsTasker pattern for consistency Co-Authored-By: morgan@cal.com <morgan@cal.com> * refactor: move repository methods per PR feedback - Move findPlatformOrgByUserId to OrganizationRepository - Create new PlatformBillingRepository for billing queries - Remove PlatformOrganizationBillingRepository (consolidated) - Update task service and trigger.dev task to use new repositories Co-Authored-By: morgan@cal.com <morgan@cal.com> * feat: add DI using @evyweb/ioctopus for platform billing tasker - Create di/tasker/ directory following BookingEmailAndSmsTasker pattern - Add tokens.ts with DI tokens for all billing tasker classes - Add module files for PlatformBillingRepository, TaskService, SyncTasker, TriggerTasker, Tasker - Add container files with getter functions - Update trigger.dev task to use DI container instead of manual instantiation Co-Authored-By: morgan@cal.com <morgan@cal.com> * refactor: add select statement to PlatformBillingRepository.findByTeamId Only select subscriptionId field since that's the only field used by the task service Co-Authored-By: morgan@cal.com <morgan@cal.com> * feat: add NestJS DI modules for platform billing tasker in API v2 - Add platform billing tasker exports to platform-libraries/organizations.ts - Export IBillingProviderService type from platform-libraries - Create StripeBillingProviderService wrapper implementing IBillingProviderService - Create PrismaPlatformBillingRepository extending PlatformBillingRepository - Create NestJS service wrappers for all platform billing tasker classes - Create PlatformBillingTaskerModule with all providers and exports - Update PlatformOrganizationBillingTaskService to use Pick<IBillingProviderService> Co-Authored-By: morgan@cal.com <morgan@cal.com> * feat: handle cancel and reschedule usage * fix: restore IsUserInBillingOrg to billing module providers Co-Authored-By: morgan@cal.com <morgan@cal.com> * chore: add idempotency key * fix: just log error] * fix: logger and typo * fix: address Cubic AI review feedback (high confidence issues) - Fix grammar error: 'Delayed task are' -> 'Delayed tasks are' in PlatformOrganizationBillingSyncTasker.ts (3 occurrences) - Re-throw error after logging in increment-usage.ts to enable trigger.dev retry mechanism Co-Authored-By: unknown <> * fix: remove duplicate code and use DI instead * fix: remove orThrow on find first in findPlatformOrgByUserId * refactor: prevent usage increment task from re-throwing errors --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
138 lines
6.5 KiB
TypeScript
138 lines
6.5 KiB
TypeScript
import { getBookingForReschedule } from "@calcom/features/bookings/lib/get-booking";
|
|
import getAllUserBookings from "@calcom/features/bookings/lib/getAllUserBookings";
|
|
import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields";
|
|
import getBookingInfo from "@calcom/features/bookings/lib/getBookingInfo";
|
|
import handleCancelBooking from "@calcom/features/bookings/lib/handleCancelBooking";
|
|
import { getClientSecretFromPayment } from "@calcom/features/ee/payments/pages/getClientSecretFromPayment";
|
|
import { getTeamMemberEmailForResponseOrContactUsingUrlQuery } from "@calcom/features/ee/teams/lib/getTeamMemberEmailFromCrm";
|
|
import {
|
|
sendVerificationCode,
|
|
verifyPhoneNumber,
|
|
} from "@calcom/features/ee/workflows/lib/reminders/verifyPhoneNumber";
|
|
import { handleCreatePhoneCall } from "@calcom/features/handleCreatePhoneCall";
|
|
import handleMarkNoShow from "@calcom/features/handleMarkNoShow";
|
|
import { getRoutedUrl } from "@calcom/features/routing-forms/lib/getRoutedUrl";
|
|
import { symmetricDecrypt, symmetricEncrypt } from "@calcom/lib/crypto";
|
|
import { getTranslation } from "@calcom/lib/server/i18n";
|
|
import type { Prisma } from "@calcom/prisma/client";
|
|
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
|
import { paymentDataSelect } from "@calcom/prisma/selects/payment";
|
|
import { createNewUsersConnectToOrgIfExists } from "@calcom/trpc/server/routers/viewer/teams/inviteMember/utils";
|
|
|
|
export { slugify } from "@calcom/lib/slugify";
|
|
export { slugifyLenient } from "@calcom/lib/slugify-lenient";
|
|
export { getBookingForReschedule };
|
|
|
|
export { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents";
|
|
export {
|
|
DEFAULT_WEBHOOK_VERSION,
|
|
WebhookVersion,
|
|
} from "@calcom/features/webhooks/lib/interface/IWebhookRepository";
|
|
export {
|
|
AttributeType,
|
|
CreationSource,
|
|
MembershipRole,
|
|
PeriodType,
|
|
SchedulingType,
|
|
TimeUnit,
|
|
WebhookTriggerEvents,
|
|
WorkflowActions,
|
|
WorkflowTemplates,
|
|
WorkflowTriggerEvents,
|
|
} from "@calcom/prisma/enums";
|
|
export type { EventBusyDate } from "@calcom/types/Calendar";
|
|
|
|
export { handleMarkNoShow };
|
|
export { handleCreatePhoneCall };
|
|
|
|
export type {
|
|
BookingCreateBody,
|
|
BookingResponse,
|
|
} from "@calcom/features/bookings/types";
|
|
|
|
export { getBusyCalendarTimes } from "@calcom/features/calendars/lib/CalendarManager";
|
|
export { getConnectedDestinationCalendarsAndEnsureDefaultsInDb } from "@calcom/features/calendars/lib/getConnectedDestinationCalendars";
|
|
export type { CityTimezones } from "@calcom/features/cityTimezones/cityTimezonesHandler";
|
|
|
|
export { cityTimezonesHandler } from "@calcom/features/cityTimezones/cityTimezonesHandler";
|
|
export { ENABLE_ASYNC_TASKER, MINUTES_TO_BOOK } from "@calcom/lib/constants";
|
|
|
|
export { TRPCError } from "@trpc/server";
|
|
export { createNewUsersConnectToOrgIfExists };
|
|
|
|
export { getAllUserBookings };
|
|
export { getBookingInfo };
|
|
export { handleCancelBooking };
|
|
|
|
export { dynamicEvent } from "@calcom/features/eventtypes/lib/defaultEvents";
|
|
|
|
export { parseBookingLimit } from "@calcom/lib/intervalLimits/isBookingLimits";
|
|
|
|
export { parseRecurringEvent } from "@calcom/lib/isRecurringEvent";
|
|
export { bookingMetadataSchema, teamMetadataSchema, userMetadata } from "@calcom/prisma/zod-utils";
|
|
|
|
export { symmetricEncrypt, symmetricDecrypt };
|
|
|
|
export { getTranslation };
|
|
|
|
export { roundRobinManualReassignment } from "@calcom/features/ee/round-robin/roundRobinManualReassignment";
|
|
export { roundRobinReassignment } from "@calcom/features/ee/round-robin/roundRobinReassignment";
|
|
|
|
export { validateCustomEventName } from "@calcom/features/eventtypes/lib/eventNaming";
|
|
|
|
export type TeamQuery = Prisma.TeamGetPayload<{
|
|
select: {
|
|
id: true;
|
|
credentials: {
|
|
select: typeof import("@calcom/prisma/selects/credential").credentialForCalendarServiceSelect;
|
|
};
|
|
name: true;
|
|
logoUrl: true;
|
|
members: {
|
|
select: {
|
|
role: true;
|
|
};
|
|
};
|
|
};
|
|
}>;
|
|
|
|
export { credentialForCalendarServiceSelect };
|
|
export { paymentDataSelect };
|
|
export { getClientSecretFromPayment };
|
|
|
|
export type { GroupedAttribute } from "@calcom/trpc/server/routers/viewer/attributes/getByUserId.handler";
|
|
export { groupMembershipAttributes } from "@calcom/trpc/server/routers/viewer/attributes/getByUserId.handler";
|
|
export { confirmHandler as confirmBookingHandler } from "@calcom/trpc/server/routers/viewer/bookings/confirm.handler";
|
|
export { getBookingFieldsWithSystemFields };
|
|
|
|
export { getRoutedUrl };
|
|
|
|
export { getTeamMemberEmailForResponseOrContactUsingUrlQuery };
|
|
|
|
export { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner";
|
|
export { getCalendarLinks } from "@calcom/features/bookings/lib/getCalendarLinks";
|
|
export { findTeamMembersMatchingAttributeLogic } from "@calcom/features/routing-forms/lib/findTeamMembersMatchingAttributeLogic";
|
|
export { SelectedCalendarRepository } from "@calcom/lib/server/repository/selectedCalendar";
|
|
export { encryptServiceAccountKey } from "@calcom/lib/server/serviceAccountKey";
|
|
export { createHandler as createApiKeyHandler } from "@calcom/trpc/server/routers/viewer/apiKeys/create.handler";
|
|
export type { TFindTeamMembersMatchingAttributeLogicInputSchema } from "@calcom/trpc/server/routers/viewer/attributes/findTeamMembersMatchingAttributeLogic.schema";
|
|
|
|
export { verifyPhoneNumber, sendVerificationCode };
|
|
|
|
export { verifyCodeUnAuthenticated } from "@calcom/features/auth/lib/verifyCodeUnAuthenticated";
|
|
export { sendEmailVerificationByCode } from "@calcom/features/auth/lib/verifyEmail";
|
|
export { BookingAccessService } from "@calcom/features/bookings/services/BookingAccessService";
|
|
export { StripeBillingService } from "@calcom/features/ee/billing/service/billingProvider/StripeBillingService";
|
|
|
|
export { TeamService } from "@calcom/features/ee/teams/services/teamService";
|
|
export { OAuthService } from "@calcom/features/oauth/services/OAuthService";
|
|
export { generateSecret } from "@calcom/features/oauth/utils/generateSecret";
|
|
export { ProfileRepository } from "@calcom/features/profile/repositories/ProfileRepository";
|
|
export type { Tasker } from "@calcom/features/tasker/tasker";
|
|
export { getTasker } from "@calcom/features/tasker/tasker-factory";
|
|
export { verifyCodeChallenge } from "@calcom/lib/pkce";
|
|
export { validateUrlForSSRFSync } from "@calcom/lib/ssrfProtection";
|
|
export { checkEmailVerificationRequired } from "@calcom/trpc/server/routers/publicViewer/checkIfUserEmailVerificationRequired.handler";
|
|
export { verifyCode as verifyCodeAuthenticated } from "@calcom/trpc/server/routers/viewer/organizations/verifyCode.handler";
|
|
export type { OrgMembershipLookup } from "@calcom/trpc/server/routers/viewer/slots/util";
|