Skip to content

Commit 0fd39f3

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/hydration-issue-in-UserAvatarGroup
2 parents 2454dff + a494428 commit 0fd39f3

File tree

19 files changed

+777
-1082
lines changed

19 files changed

+777
-1082
lines changed

apps/web/test/utils/bookingScenario/MockPaymentService.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import prismaMock from "../../../../../tests/libs/__mocks__/prisma";
22

33
import type { Payment, Prisma, PaymentOption, Booking } from "@prisma/client";
4-
import { v4 as uuidv4 } from "uuid";
54
import "vitest-fetch-mock";
65

76
import { sendAwaitingPaymentEmailAndSMS } from "@calcom/emails";
@@ -13,8 +12,8 @@ export function getMockPaymentService() {
1312
function createPaymentLink(/*{ paymentUid, name, email, date }*/) {
1413
return "http://mock-payment.example.com/";
1514
}
16-
const paymentUid = uuidv4();
17-
const externalId = uuidv4();
15+
const paymentUid = "MOCK_PAYMENT_UID";
16+
const externalId = "mock_payment_external_id";
1817

1918
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
2019
// @ts-ignore
@@ -37,7 +36,7 @@ export function getMockPaymentService() {
3736
bookingId,
3837
// booking Booking? @relation(fields: [bookingId], references: [id], onDelete: Cascade)
3938
fee: 10,
40-
success: true,
39+
success: false,
4140
refunded: false,
4241
data: {},
4342
externalId,
@@ -46,11 +45,16 @@ export function getMockPaymentService() {
4645
currency: payment.currency,
4746
};
4847

49-
const paymentData = prismaMock.payment.create({
48+
const paymentData = await prismaMock.payment.create({
5049
data: paymentCreateData,
5150
});
5251
logger.silly("Created mock payment", JSON.stringify({ paymentData }));
5352

53+
const verifyPayment = await prismaMock.payment.findFirst({
54+
where: { externalId: paymentCreateData.externalId },
55+
});
56+
logger.silly("Verified payment exists", JSON.stringify({ verifyPayment }));
57+
5458
return paymentData;
5559
}
5660
async afterPayment(

apps/web/test/utils/bookingScenario/bookingScenario.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,18 +2105,7 @@ export function mockPaymentApp({
21052105
appStoreLookupKey?: string;
21062106
}) {
21072107
appStoreLookupKey = appStoreLookupKey || metadataLookupKey;
2108-
const { paymentUid, externalId, MockPaymentService } = getMockPaymentService();
2109-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
2110-
//@ts-ignore
2111-
appStoreMock.default[appStoreLookupKey as keyof typeof appStoreMock.default].mockImplementation(() => {
2112-
return new Promise((resolve) => {
2113-
resolve({
2114-
lib: {
2115-
PaymentService: MockPaymentService,
2116-
},
2117-
});
2118-
});
2119-
});
2108+
const { paymentUid, externalId } = getMockPaymentService();
21202109

21212110
return {
21222111
paymentUid,

packages/app-store-cli/src/build.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,24 @@ function generateFiles() {
415415
analyticsOutput.push(...analyticsServices);
416416
}
417417

418+
const paymentOutput = [];
419+
const paymentServices = getExportedObject(
420+
"PaymentServiceMap",
421+
{
422+
importConfig: {
423+
fileToBeImported: "lib/PaymentService.ts",
424+
importName: "PaymentService",
425+
},
426+
lazyImport: true,
427+
},
428+
(app: App) => {
429+
const hasPaymentService = fs.existsSync(path.join(APP_STORE_PATH, app.path, "lib/PaymentService.ts"));
430+
return hasPaymentService;
431+
}
432+
);
433+
434+
paymentOutput.push(...paymentServices);
435+
418436
const banner = `/**
419437
This file is autogenerated using the command \`yarn app-store:build --watch\`.
420438
Don't modify this file manually.
@@ -430,6 +448,7 @@ function generateFiles() {
430448
["bookerApps.metadata.generated.ts", bookerMetadataOutput],
431449
["crm.apps.generated.ts", crmOutput],
432450
["calendar.services.generated.ts", calendarOutput],
451+
["payment.services.generated.ts", paymentOutput],
433452
];
434453
filesToGenerate.forEach(([fileName, output]) => {
435454
fs.writeFileSync(`${APP_STORE_PATH}/${fileName}`, formatOutput(`${banner}${output.join("\n")}`));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
This file is autogenerated using the command `yarn app-store:build --watch`.
3+
Don't modify this file manually.
4+
**/
5+
export const PaymentServiceMap = {
6+
alby: import("./alby/lib/PaymentService"),
7+
btcpayserver: import("./btcpayserver/lib/PaymentService"),
8+
hitpay: import("./hitpay/lib/PaymentService"),
9+
"mock-payment-app": import("./mock-payment-app/lib/PaymentService"),
10+
paypal: import("./paypal/lib/PaymentService"),
11+
stripepayment: import("./stripepayment/lib/PaymentService"),
12+
};

packages/features/insights/components/routing/FailedBookingsByField.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
1616
import { trpc } from "@calcom/trpc";
1717
import { ToggleGroup } from "@calcom/ui/components/form";
1818

19-
import { useInsightsParameters } from "../../hooks/useInsightsParameters";
19+
import { useInsightsRoutingParameters } from "../../hooks/useInsightsRoutingParameters";
2020
import { ChartCard } from "../ChartCard";
2121

2222
// Custom Tooltip component
@@ -131,13 +131,8 @@ function FormCard({ formName, fields }: FormCardProps) {
131131

132132
export function FailedBookingsByField() {
133133
const { t } = useLocale();
134-
const { userId, teamId, startDate, endDate, isAll, routingFormId } = useInsightsParameters();
135-
const { data } = trpc.viewer.insights.failedBookingsByField.useQuery({
136-
userId,
137-
teamId,
138-
isAll,
139-
routingFormId,
140-
});
134+
const insightsRoutingParams = useInsightsRoutingParameters();
135+
const { data } = trpc.viewer.insights.failedBookingsByField.useQuery(insightsRoutingParams);
141136

142137
if (!data || Object.entries(data).length === 0) return null;
143138

0 commit comments

Comments
 (0)