Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
fix: remove kyc and make text messages to attendee org only (calcom#1…
Browse files Browse the repository at this point in the history
…1389)

* add orgs upgrade badge to select

* don't allow updating to if no teams or orgs plan

* make sure only paying users can request verification codes

* add new action helper function

* remove kyc code

* code clean up

* fix verify button UI

* fix type errors

* add eventTypeRequiresConfirmation everywhere

* address feedback

---------

Co-authored-by: CarinaWolli <[email protected]>
  • Loading branch information
CarinaWolli and CarinaWolli authored Sep 21, 2023
1 parent 96263b0 commit 3b50fe0
Show file tree
Hide file tree
Showing 30 changed files with 89 additions and 542 deletions.
4 changes: 0 additions & 4 deletions apps/web/pages/api/trpc/kycVerification/[trpc].ts

This file was deleted.

11 changes: 0 additions & 11 deletions apps/web/pages/settings/admin/kycVerification/index.tsx

This file was deleted.

This file was deleted.

6 changes: 1 addition & 5 deletions apps/web/public/static/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,7 @@
"minimum_round_robin_hosts_count": "Number of hosts required to attend",
"hosts": "Hosts",
"upgrade_to_enable_feature": "You need to create a team to enable this feature. Click to create a team.",
"orgs_upgrade_to_enable_feature" : "You need to upgrade to our enterprise plan to enable this feature.",
"new_attendee": "New Attendee",
"awaiting_approval": "Awaiting Approval",
"requires_google_calendar": "This app requires a Google Calendar connection",
Expand Down Expand Up @@ -2003,11 +2004,6 @@
"requires_booker_email_verification": "Requires booker email verification",
"description_requires_booker_email_verification": "To ensure booker's email verification before scheduling events",
"requires_confirmation_mandatory": "Text messages can only be sent to attendees when event type requires confirmation.",
"kyc_verification_information": "To ensure security, you have to verify your {{teamOrAccount}} before sending text messages to attendees. Please contact us at <a>{{supportEmail}}</a> and provide the following information:",
"kyc_verification_documents": "<ul><li>Your {{teamOrUser}}</li><li>For businesses: Attach your Business Verification Documentation</li><li>For individuals: Attach a government-issued ID</li></ul>",
"verify_team_or_account": "Verify {{teamOrAccount}}",
"verify_account": "Verify Account",
"kyc_verification": "KYC Verification",
"organizations": "Organizations",
"org_admin_other_teams": "Other teams",
"org_admin_other_teams_description": "Here you can see teams inside your organization that you are not part of. You can add yourself to them if needed.",
Expand Down
16 changes: 1 addition & 15 deletions packages/features/bookings/lib/handleCancelBooking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { deleteMeeting, updateMeeting } from "@calcom/core/videoClient";
import dayjs from "@calcom/dayjs";
import { sendCancelledEmails, sendCancelledSeatEmails } from "@calcom/emails";
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
import { isEventTypeOwnerKYCVerified } from "@calcom/features/ee/workflows/lib/isEventTypeOwnerKYCVerified";
import { deleteScheduledEmailReminder } from "@calcom/features/ee/workflows/lib/reminders/emailReminderManager";
import { sendCancelledReminders } from "@calcom/features/ee/workflows/lib/reminders/reminderScheduler";
import { deleteScheduledSMSReminder } from "@calcom/features/ee/workflows/lib/reminders/smsReminderManager";
Expand Down Expand Up @@ -71,17 +70,6 @@ async function getBookingToDelete(id: number | undefined, uid: string | undefine
select: {
id: true,
hideBranding: true,
metadata: true,
teams: {
select: {
accepted: true,
team: {
select: {
metadata: true,
},
},
},
},
},
},
teamId: true,
Expand Down Expand Up @@ -299,8 +287,6 @@ async function handler(req: CustomRequest) {
);
await Promise.all(promises);

const isKYCVerified = isEventTypeOwnerKYCVerified(bookingToDelete.eventType);

//Workflows - schedule reminders
if (bookingToDelete.eventType?.workflows) {
await sendCancelledReminders({
Expand All @@ -311,7 +297,7 @@ async function handler(req: CustomRequest) {
...{ eventType: { slug: bookingToDelete.eventType.slug } },
},
hideBranding: !!bookingToDelete.eventType.owner?.hideBranding,
isKYCVerified,
eventTypeRequiresConfirmation: bookingToDelete.eventType.requiresConfirmation,
});
}

Expand Down
46 changes: 0 additions & 46 deletions packages/features/bookings/lib/handleConfirmation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { Prisma, Workflow, WorkflowsOnEventTypes, WorkflowStep } from "@pri
import type { EventManagerUser } from "@calcom/core/EventManager";
import EventManager from "@calcom/core/EventManager";
import { sendScheduledEmails } from "@calcom/emails";
import { isEventTypeOwnerKYCVerified } from "@calcom/features/ee/workflows/lib/isEventTypeOwnerKYCVerified";
import { scheduleWorkflowReminders } from "@calcom/features/ee/workflows/lib/reminders/reminderScheduler";
import getWebhooks from "@calcom/features/webhooks/lib/getWebhooks";
import { scheduleTrigger } from "@calcom/features/webhooks/lib/scheduleTrigger";
Expand Down Expand Up @@ -87,18 +86,8 @@ export async function handleConfirmation(args: {
eventType: {
bookingFields: Prisma.JsonValue | null;
slug: string;
team: {
metadata: Prisma.JsonValue;
} | null;
owner: {
hideBranding?: boolean | null;
metadata: Prisma.JsonValue;
teams: {
accepted: boolean;
team: {
metadata: Prisma.JsonValue;
};
}[];
} | null;
workflows: (WorkflowsOnEventTypes & {
workflow: Workflow & {
Expand Down Expand Up @@ -135,25 +124,9 @@ export async function handleConfirmation(args: {
select: {
slug: true,
bookingFields: true,
team: {
select: {
metadata: true,
},
},
owner: {
select: {
hideBranding: true,
metadata: true,
teams: {
select: {
accepted: true,
team: {
select: {
metadata: true,
},
},
},
},
},
},
workflows: {
Expand Down Expand Up @@ -202,25 +175,9 @@ export async function handleConfirmation(args: {
select: {
slug: true,
bookingFields: true,
team: {
select: {
metadata: true,
},
},
owner: {
select: {
hideBranding: true,
metadata: true,
teams: {
select: {
accepted: true,
team: {
select: {
metadata: true,
},
},
},
},
},
},
workflows: {
Expand Down Expand Up @@ -250,8 +207,6 @@ export async function handleConfirmation(args: {
updatedBookings.push(updatedBooking);
}

const isKYCVerified = isEventTypeOwnerKYCVerified(updatedBookings[0].eventType);

//Workflows - set reminders for confirmed events
try {
for (let index = 0; index < updatedBookings.length; index++) {
Expand All @@ -276,7 +231,6 @@ export async function handleConfirmation(args: {
isFirstRecurringEvent: isFirstBooking,
hideBranding: !!updatedBookings[index].eventType?.owner?.hideBranding,
eventTypeRequiresConfirmation: true,
isKYCVerified,
});
}
}
Expand Down
21 changes: 3 additions & 18 deletions packages/features/bookings/lib/handleNewBooking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
allowDisablingAttendeeConfirmationEmails,
allowDisablingHostConfirmationEmails,
} from "@calcom/features/ee/workflows/lib/allowDisablingStandardEmails";
import { isEventTypeOwnerKYCVerified } from "@calcom/features/ee/workflows/lib/isEventTypeOwnerKYCVerified";
import {
cancelWorkflowReminders,
scheduleWorkflowReminders,
Expand Down Expand Up @@ -260,7 +259,6 @@ const getEventTypesFromDB = async (eventTypeId: number) => {
select: {
id: true,
name: true,
metadata: true,
},
},
bookingFields: true,
Expand Down Expand Up @@ -292,17 +290,6 @@ const getEventTypesFromDB = async (eventTypeId: number) => {
owner: {
select: {
hideBranding: true,
metadata: true,
teams: {
select: {
accepted: true,
team: {
select: {
metadata: true,
},
},
},
},
},
},
workflows: {
Expand Down Expand Up @@ -379,7 +366,7 @@ async function ensureAvailableUsers(
}
) {
const availableUsers: IsFixedAwareUser[] = [];
const duration = dayjs(input.dateTo).diff(input.dateFrom, 'minute');
const duration = dayjs(input.dateTo).diff(input.dateFrom, "minute");

const originalBookingDuration = input.originalRescheduledBooking
? dayjs(input.originalRescheduledBooking.endTime).diff(
Expand Down Expand Up @@ -1199,8 +1186,6 @@ async function handler(

const subscribersMeetingEnded = await getWebhooks(subscriberOptionsMeetingEnded);

const isKYCVerified = isEventTypeOwnerKYCVerified(eventType);

const handleSeats = async () => {
let resultBooking:
| (Partial<Booking> & {
Expand Down Expand Up @@ -1769,7 +1754,7 @@ async function handler(
isFirstRecurringEvent: true,
emailAttendeeSendToOverride: bookerEmail,
seatReferenceUid: evt.attendeeSeatId,
isKYCVerified,
eventTypeRequiresConfirmation: eventType.requiresConfirmation,
});
} catch (error) {
log.error("Error while scheduling workflow reminders", error);
Expand Down Expand Up @@ -2416,7 +2401,7 @@ async function handler(
isFirstRecurringEvent: true,
hideBranding: !!eventType.owner?.hideBranding,
seatReferenceUid: evt.attendeeSeatId,
isKYCVerified,
eventTypeRequiresConfirmation: eventType.requiresConfirmation,
});
} catch (error) {
log.error("Error while scheduling workflow reminders", error);
Expand Down
10 changes: 4 additions & 6 deletions packages/features/ee/workflows/components/AddActionDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ interface IAddActionDialog {
senderId?: string,
senderName?: string
) => void;
setKYCVerificationDialogOpen: () => void;
}

interface ISelectActionOption {
Expand All @@ -57,7 +56,7 @@ type AddActionFormValues = {

export const AddActionDialog = (props: IAddActionDialog) => {
const { t } = useLocale();
const { isOpenDialog, setIsOpenDialog, addAction, setKYCVerificationDialogOpen } = props;
const { isOpenDialog, setIsOpenDialog, addAction } = props;
const [isPhoneNumberNeeded, setIsPhoneNumberNeeded] = useState(false);
const [isSenderIdNeeded, setIsSenderIdNeeded] = useState(false);
const [isEmailAddressNeeded, setIsEmailAddressNeeded] = useState(false);
Expand Down Expand Up @@ -171,14 +170,13 @@ export const AddActionDialog = (props: IAddActionDialog) => {
onChange={handleSelectAction}
options={actionOptions.map((option) => ({
...option,
verificationAction: () => setKYCVerificationDialogOpen(),
}))}
isOptionDisabled={(option: {
label: string;
value: WorkflowActions;
needsUpgrade: boolean;
needsVerification: boolean;
}) => option.needsUpgrade || option.needsVerification}
needsTeamsUpgrade: boolean;
needsOrgsUpgrade: boolean;
}) => option.needsTeamsUpgrade || option.needsOrgsUpgrade}
/>
);
}}
Expand Down
Loading

0 comments on commit 3b50fe0

Please sign in to comment.