The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Keep saleAmount required and cover deprecated commission create fields.
Kiran K24746a3792de
diff --git a/apps/web/lib/zod/schemas/commissions.ts b/apps/web/lib/zod/schemas/commissions.tsindex 74cb92e3c3..c78b90fa62 100644--- a/apps/web/lib/zod/schemas/commissions.ts+++ b/apps/web/lib/zod/schemas/commissions.ts@@ -452,171 +452,173 @@ export const createPartnerCommissionSchema = z.object({),});-export const createCommissionBodySchemaV2 = z- .discriminatedUnion("type", [- // Custom commission (negative amount = clawback)- z.object({- type: z.literal("custom"),- partnerId: z- .string()- .describe("The ID of the partner to create the commission for."),- amount: centsSchema- .pipe(- z.number().refine((n) => n !== 0, {- message: "Amount cannot be 0.",- }),- )- .describe(- "The commission amount in cents. Use a negative amount to create a clawback.",- ),- date: parseDateSchema- .nullish()- .describe("If not provided, the current date will be used."),- description: z- .string()- .max(190)- .nullish()- .describe(- "The description of the commission. Required for clawbacks (negative `amount`). May be a known clawback reason (`order_canceled`, `fraud`, `terms_violation`, `tracking_error`, `payment_failed`, `ineligible_partner`, `duplicate_commission`, `other`) or any other string.",- ),- }),-- // Lead commission- z.object({- type: z.literal("lead"),- partnerId: z- .string()- .describe("The ID of the partner to create the commission for."),- customerId: z- .string()- .nullish()- .describe(- "The customer ID to associate the commission with. Useful if the customer was already created in a prior operation and you want to associate the commission with it.",- ),- customer: createCustomerBodySchema- .nullish()- .describe(- "The full customer object to associate the commission with. Useful for creating the customer on demand.",- ),- linkId: z- .string()- .nullish()- .describe(- "The partner link ID to associate the commission with. If not provided, default to the link with the most revenue.",- ),- date: parseDateSchema- .nullish()- .describe(- "The date and time of the lead event. If not provided, defaults to the current date and time.",- ),- lead: z- .object({- eventName: z- .string()- .trim()- .max(255)- .default("Sign up")- .describe(- "The name of the lead event to track. If not provided, defaults to 'Sign up'.",- )- .meta({ example: "Sign up" }),- metadata: trackLeadRequestSchema.shape.metadata,- })- .nullish()- .describe("The lead event object to associate the commission with."),+// Custom commission (negative amount = clawback)+const createCustomCommissionSchema = z.object({+ type: z.literal("custom"),+ partnerId: z+ .string()+ .describe("The ID of the partner to create the commission for."),+ amount: centsSchema+ .pipe(+ z.number().refine((n) => n !== 0, {+ message: "Amount cannot be 0.",+ }),+ )+ .describe(+ "The commission amount in cents. Use a negative amount to create a clawback.",+ ),+ date: parseDateSchema+ .nullish()+ .describe("If not provided, the current date will be used."),+ description: z+ .string()+ .max(190)+ .nullish()+ .describe(+ "The description of the commission. Required for clawbacks (negative `amount`). May be a known clawback reason (`order_canceled`, `fraud`, `terms_violation`, `tracking_error`, `payment_failed`, `ineligible_partner`, `duplicate_commission`, `other`) or any other string.",+ ),+});- // Deprecated fields- leadEventDate: parseDateSchema- .nullish()- .describe(- "Deprecated: Use `date` instead. The date and time of the lead event. If not provided, defaults to the current date and time.",- )- .meta({ deprecated: true }),- leadEventName: z+const createLeadCommissionSchema = z.object({+ type: z.literal("lead"),+ partnerId: z+ .string()+ .describe("The ID of the partner to create the commission for."),+ customerId: z+ .string()+ .nullish()+ .describe(+ "The customer ID to associate the commission with. Useful if the customer was already created in a prior operation and you want to associate the commission with it.",+ ),+ customer: createCustomerBodySchema+ .nullish()+ .describe(+ "The full customer object to associate the commission with. Useful for creating the customer on demand.",+ ),+ linkId: z+ .string()+ .nullish()+ .describe(+ "The partner link ID to associate the commission with. If not provided, default to the link with the most revenue.",+ ),+ date: parseDateSchema+ .nullish()+ .describe(+ "The date and time of the lead event. If not provided, defaults to the current date and time.",+ ),+ lead: z+ .object({+ eventName: z.string()- .nullish()+ .trim()+ .max(255).default("Sign up").describe(- "Deprecated: Use `lead.eventName` instead. The name of the lead event. If not provided, defaults to 'Sign up'.",+ "The name of the lead event to track. If not provided, defaults to 'Sign up'.",)- .meta({ deprecated: true }),- }),+ .meta({ example: "Sign up" }),+ metadata: trackLeadRequestSchema.shape.metadata,+ })+ .nullish()+ .describe("The lead event object to associate the commission with."),- // Sale commission- z.object({- type: z.literal("sale"),- partnerId: z- .string()- .describe("The ID of the partner to create the commission for."),- customerId: z- .string()- .nullish()- .describe(- "The customer ID to associate the commission with. Useful if the customer was already created in a prior operation and you want to associate the commission with it.",- ),- customer: createCustomerBodySchema- .nullish()- .describe(- "The full customer object to associate the commission with. Useful for creating the customer on demand.",- ),- linkId: z- .string()- .nullish()- .describe(- "The partner link ID to associate the commission with. If not provided, default to the link with the most revenue.",- ),- importStripeInvoices: z- .boolean()- .nullish()- .default(false)- .describe(- "When `true`, import all unimported paid Stripe invoices for the customer and create a commission for each. When `false`, create a single manual sale event using `saleAmount`.",- ),- date: parseDateSchema- .nullish()- .describe(- "Only used when `importStripeInvoices` is `false`. The date of the manual sale event. Defaults to the current date and time if not provided.",- ),- sale: z- .object({- amount: trackSaleRequestSchema.shape.amount,- currency: trackSaleRequestSchema.shape.currency,- eventName: trackSaleRequestSchema.shape.eventName,- paymentProcessor: trackSaleRequestSchema.shape.paymentProcessor,- invoiceId: trackSaleRequestSchema.shape.invoiceId,- metadata: trackSaleRequestSchema.shape.metadata,- })- .nullish(),+ // Deprecated fields+ leadEventDate: parseDateSchema+ .nullish()+ .describe(+ "Deprecated: Use `date` instead. The date and time of the lead event. If not provided, defaults to the current date and time.",+ )+ .meta({ deprecated: true }),+ leadEventName: z+ .string()+ .nullish()+ .default("Sign up")+ .describe(+ "Deprecated: Use `lead.eventName` instead. The name of the lead event. If not provided, defaults to 'Sign up'.",+ )+ .meta({ deprecated: true }),+});- // Deprecated fields- saleAmount: centsSchema- .pipe(z.number().min(0))- .nullish()- .describe(- "Deprecated: Use `sale.amount` instead. Required when `importStripeInvoices` is `false`. The sale amount in cents for the manual sale event. Ignored when importing from Stripe.",- )- .meta({ deprecated: true }),- saleEventDate: parseDateSchema- .nullish()- .describe(- "Deprecated: Use `date` instead. Only used when `importStripeInvoices` is `false`. The date of the manual sale event. Defaults to the current date and time if not provided.",- )- .meta({ deprecated: true }),- invoiceId: z- .string()- .nullish()- .describe(- "Deprecated: Use `sale.invoiceId` instead. Only used when `importStripeInvoices` is `false`. An optional invoice ID to attach to the generated sale event and commission entry for deduplication.",- )- .meta({ deprecated: true }),- productId: z- .string()- .nullish()- .describe(- "Deprecated: Use `sale.metadata.productId` instead. Only used when `importStripeInvoices` is `false`. An optional product ID stored on the sale event metadata – will also impact commission earnings calculation (if a `Sale` `Product ID` modifier is set).",- )- .meta({ deprecated: true }),- }),+const createSaleCommissionSchema = z.object({+ type: z.literal("sale"),+ partnerId: z+ .string()+ .describe("The ID of the partner to create the commission for."),+ customerId: z+ .string()+ .nullish()+ .describe(+ "The customer ID to associate the commission with. Useful if the customer was already created in a prior operation and you want to associate the commission with it.",+ ),+ customer: createCustomerBodySchema+ .nullish()+ .describe(+ "The full customer object to associate the commission with. Useful for creating the customer on demand.",+ ),+ linkId: z+ .string()+ .nullish()+ .describe(+ "The partner link ID to associate the commission with. If not provided, default to the link with the most revenue.",+ ),+ importStripeInvoices: z+ .boolean()+ .nullish()+ .default(false)+ .describe(+ "When `true`, import all unimported paid Stripe invoices for the customer and create a commission for each. When `false`, create a single manual sale event using `saleAmount`.",+ ),+ date: parseDateSchema+ .nullish()+ .describe(+ "Only used when `importStripeInvoices` is `false`. The date of the manual sale event. Defaults to the current date and time if not provided.",+ ),+ sale: z+ .object({+ amount: trackSaleRequestSchema.shape.amount,+ currency: trackSaleRequestSchema.shape.currency,+ eventName: trackSaleRequestSchema.shape.eventName,+ paymentProcessor: trackSaleRequestSchema.shape.paymentProcessor,+ invoiceId: trackSaleRequestSchema.shape.invoiceId,+ metadata: trackSaleRequestSchema.shape.metadata,+ })+ .nullish(),++ // Deprecated fields+ saleAmount: centsSchema+ .pipe(z.number().min(0))+ .nullish()+ .describe(+ "Deprecated: Use `sale.amount` instead. Required when `importStripeInvoices` is `false`. The sale amount in cents for the manual sale event. Ignored when importing from Stripe.",+ )+ .meta({ deprecated: true }),+ saleEventDate: parseDateSchema+ .nullish()+ .describe(+ "Deprecated: Use `date` instead. Only used when `importStripeInvoices` is `false`. The date of the manual sale event. Defaults to the current date and time if not provided.",+ )+ .meta({ deprecated: true }),+ invoiceId: z+ .string()+ .nullish()+ .describe(+ "Deprecated: Use `sale.invoiceId` instead. Only used when `importStripeInvoices` is `false`. An optional invoice ID to attach to the generated sale event and commission entry for deduplication.",+ )+ .meta({ deprecated: true }),+ productId: z+ .string()+ .nullish()+ .describe(+ "Deprecated: Use `sale.metadata.productId` instead. Only used when `importStripeInvoices` is `false`. An optional product ID stored on the sale event metadata – will also impact commission earnings calculation (if a `Sale` `Product ID` modifier is set).",+ )+ .meta({ deprecated: true }),+});++export const createManualCommissionBodySchema = z+ .discriminatedUnion("type", [+ createCustomCommissionSchema,+ createLeadCommissionSchema,+ createSaleCommissionSchema,]).superRefine((data, ctx) => {if (data.type === "custom") {@@ -656,167 +658,6 @@ export const createCommissionBodySchemaV2 = z}});-export const createManualCommissionBodySchema = createCommissionBodySchemaV2;--// z-// .discriminatedUnion("type", [-// // Custom commission (negative amount = clawback)-// z.object({-// type: z.literal("custom"),-// partnerId: z-// .string()-// .describe("The ID of the partner to create the commission for."),-// amount: centsSchema-// .pipe(-// z.number().refine((n) => n !== 0, {-// message: "Amount cannot be 0.",-// }),-// )-// .describe(-// "The commission amount in cents. Use a negative amount to create a clawback.",-// ),-// date: parseDateSchema-// .nullish()-// .describe("If not provided, the current date will be used."),-// description: z-// .string()-// .max(190)-// .nullish()-// .describe(-// "The description of the commission. Required for clawbacks (negative `amount`). May be a known clawback reason (`order_canceled`, `fraud`, `terms_violation`, `tracking_error`, `payment_failed`, `ineligible_partner`, `duplicate_commission`, `other`) or any other string.",-// ),-// }),--// // Lead commission-// z.object({-// type: z.literal("lead"),-// partnerId: z-// .string()-// .describe("The ID of the partner to create the commission for."),-// customerId: z-// .string()-// .nullish()-// .describe(-// "The customer ID to associate the commission with. Useful if the customer was already created in a prior operation and you want to associate the commission with it.",-// ),-// customer: createCustomerBodySchema-// .nullish()-// .describe(-// "The full customer object to associate the commission with. Useful for creating the customer on demand.",-// ),-// linkId: z-// .string()-// .nullish()-// .describe(-// "The partner link ID to associate the commission with. If not provided, default to the link with the most revenue.",-// ),-// leadEventDate: parseDateSchema-// .nullish()-// .describe(-// "The date and time of the lead event. If not provided, defaults to the current date and time.",-// ),-// leadEventName: z-// .string()-// .nullish()-// .default("Sign up")-// .describe(-// "The name of the lead event. If not provided, defaults to 'Sign up'.",-// ),-// }),--// // Sale commission-// z.object({-// type: z.literal("sale"),-// partnerId: z-// .string()-// .describe("The ID of the partner to create the commission for."),-// customerId: z-// .string()-// .nullish()-// .describe(-// "The customer ID to associate the commission with. Useful if the customer was already created in a prior operation and you want to associate the commission with it.",-// ),-// customer: createCustomerBodySchema-// .nullish()-// .describe(-// "The full customer object to associate the commission with. Useful for creating the customer on demand.",-// ),-// linkId: z-// .string()-// .nullish()-// .describe(-// "The partner link ID to associate the commission with. If not provided, default to the link with the most revenue.",-// ),-// importStripeInvoices: z-// .boolean()-// .nullish()-// .default(false)-// .describe(-// "When `true`, import all unimported paid Stripe invoices for the customer and create a commission for each. When `false`, create a single manual sale event using `saleAmount`.",-// ),-// saleAmount: centsSchema-// .pipe(z.number().min(0))-// .nullish()-// .describe(-// "Required when `importStripeInvoices` is `false`. The sale amount in cents for the manual sale event. Ignored when importing from Stripe.",-// ),-// saleEventDate: parseDateSchema-// .nullish()-// .describe(-// "Only used when `importStripeInvoices` is `false`. The date of the manual sale event. Defaults to the current date and time if not provided.",-// ),-// invoiceId: z-// .string()-// .nullish()-// .describe(-// "Only used when `importStripeInvoices` is `false`. An optional invoice ID to attach to the generated sale event and commission entry for deduplication.",-// ),-// productId: z-// .string()-// .nullish()-// .describe(-// "Only used when `importStripeInvoices` is `false`. An optional product ID stored on the sale event metadata – will also impact commission earnings calculation (if a `Sale` `Product ID` modifier is set).",-// ),-// }),-// ])-// .superRefine((data, ctx) => {-// if (data.type === "custom") {-// if (data.amount < 0 && !data.description?.trim()) {-// ctx.addIssue({-// code: z.ZodIssueCode.custom,-// message:-// "`description` is required when creating a clawback (negative amount).",-// path: ["description"],-// });-// }-// return;-// }--// if (data.type === "sale") {-// if (data.importStripeInvoices) {-// return;-// }--// if (data.saleAmount == null) {-// ctx.addIssue({-// code: z.ZodIssueCode.custom,-// message:-// "`saleAmount` is required when `importStripeInvoices` is false.",-// path: ["saleAmount"],-// });-// return;-// }--// if (data.saleAmount === 0) {-// ctx.addIssue({-// code: z.ZodIssueCode.custom,-// message: "Sale amount cannot be 0.",-// path: ["saleAmount"],-// });-// }-// }-// });-export const createCommissionResponseSchema = z.object({success: z.boolean(),message: z.string(),diff --git a/apps/web/playwright/api/commissions/commissions.spec.ts b/apps/web/playwright/api/commissions/commissions.spec.tsindex 45a998ba1d..d5ab19fcf3 100644--- a/apps/web/playwright/api/commissions/commissions.spec.ts+++ b/apps/web/playwright/api/commissions/commissions.spec.ts@@ -215,6 +215,203 @@ test("POST /commissions – duplicate invoiceId", async ({ api, program }) => {}});+test("POST /commissions – lead with deprecated leadEventName and leadEventDate", async ({+ api,+ program,+}) => {+ let partnerId: string | undefined;+ let groupId: string | undefined;+ const customer = randomCustomer();+ const leadEventDate = new Date("2024-06-15T12:00:00.000Z");++ try {+ const created = await createPartnerWithCommissionRewards(api, {+ programId: program.id,+ });+ partnerId = created.data.id;+ groupId = created.groupId;+ expect(created.status).toEqual(201);++ const { status, data } = await api.post("/api/commissions", {+ type: "lead",+ partnerId,+ leadEventName: "Signed up",+ leadEventDate: leadEventDate.toISOString(),+ customer: {+ externalId: customer.externalId,+ email: customer.email,+ name: customer.name,+ country: "US",+ },+ });++ expect(status).toEqual(202);+ expect(data).toStrictEqual(expectedQueuedResponse);++ await expectCommissionCreated({+ partnerId: created.data.id,+ programId: program.id,+ type: "lead",+ expectedAmount: 0,+ expectedEarnings: LEAD_REWARD_CENTS,+ expectedCreatedAt: leadEventDate,+ });+ } finally {+ await deleteCommissionPartner({ partnerId, groupId });+ }+});++test("POST /commissions – sale with deprecated saleEventDate and productId", async ({+ api,+ program,+}) => {+ let partnerId: string | undefined;+ let groupId: string | undefined;+ const invoiceId = `INV_${nanoid()}`;+ const customer = randomCustomer();+ const saleEventDate = new Date("2024-03-01T08:30:00.000Z");++ try {+ const created = await createPartnerWithCommissionRewards(api, {+ programId: program.id,+ });+ partnerId = created.data.id;+ groupId = created.groupId;+ expect(created.status).toEqual(201);++ const { status, data } = await api.post("/api/commissions", {+ type: "sale",+ partnerId,+ saleAmount: 1000,+ invoiceId,+ productId: "sku_deprecated",+ saleEventDate: saleEventDate.toISOString(),+ customer: {+ externalId: customer.externalId,+ email: customer.email,+ name: customer.name,+ country: "US",+ },+ });++ expect(status).toEqual(202);+ expect(data).toStrictEqual(expectedQueuedResponse);++ await expectCommissionCreated({+ partnerId: created.data.id,+ programId: program.id,+ type: "sale",+ invoiceId,+ expectedAmount: 1000,+ expectedEarnings: SALE_REWARD_CENTS,+ expectedCreatedAt: saleEventDate,+ });+ } finally {+ await deleteCommissionPartner({ partnerId, groupId });+ }+});++test("POST /commissions – lead with date and lead.eventName", async ({+ api,+ program,+}) => {+ let partnerId: string | undefined;+ let groupId: string | undefined;+ const customer = randomCustomer();++ try {+ const created = await createPartnerWithCommissionRewards(api, {+ programId: program.id,+ });+ partnerId = created.data.id;+ groupId = created.groupId;+ expect(created.status).toEqual(201);++ const { status, data } = await api.post("/api/commissions", {+ type: "lead",+ partnerId,+ date: new Date("2024-01-10T00:00:00.000Z").toISOString(),+ lead: {+ eventName: "Requested demo",+ metadata: { plan: "pro" },+ },+ customer: {+ externalId: customer.externalId,+ email: customer.email,+ name: customer.name,+ country: "US",+ },+ });++ expect(status).toEqual(202);+ expect(data).toStrictEqual(expectedQueuedResponse);++ await expectCommissionCreated({+ partnerId: created.data.id,+ programId: program.id,+ type: "lead",+ expectedAmount: 0,+ expectedEarnings: LEAD_REWARD_CENTS,+ });+ } finally {+ await deleteCommissionPartner({ partnerId, groupId });+ }+});++test("POST /commissions – sale with nested sale and deprecated saleAmount", async ({+ api,+ program,+}) => {+ let partnerId: string | undefined;+ let groupId: string | undefined;+ const invoiceId = `INV_${nanoid()}`;+ const customer = randomCustomer();++ try {+ const created = await createPartnerWithCommissionRewards(api, {+ programId: program.id,+ });+ partnerId = created.data.id;+ groupId = created.groupId;+ expect(created.status).toEqual(201);++ const { status, data } = await api.post("/api/commissions", {+ type: "sale",+ partnerId,+ saleAmount: 1000,+ invoiceId,+ sale: {+ amount: 1000,+ currency: "usd",+ eventName: "Invoice paid",+ paymentProcessor: "stripe",+ invoiceId,+ metadata: { productId: "sku_nested" },+ },+ customer: {+ externalId: customer.externalId,+ email: customer.email,+ name: customer.name,+ country: "US",+ },+ });++ expect(status).toEqual(202);+ expect(data).toStrictEqual(expectedQueuedResponse);++ await expectCommissionCreated({+ partnerId: created.data.id,+ programId: program.id,+ type: "sale",+ invoiceId,+ expectedAmount: 1000,+ expectedEarnings: SALE_REWARD_CENTS,+ });+ } finally {+ await deleteCommissionPartner({ partnerId, groupId });+ }+});+const commissionErrorCases = [{name: "POST /commissions – missing type",@@ -241,7 +438,7 @@ const commissionErrorCases = [}),},{- name: "POST /commissions – sale missing amount",+ name: "POST /commissions – sale missing saleAmount",body: {type: "sale",partnerId: "pn_test",@@ -251,64 +448,49 @@ const commissionErrorCases = [expected: apiError({code: "unprocessable_entity",message:- "custom: sale.amount: `sale.amount` is required when `importStripeInvoices` is false.",+ "custom: saleAmount: `saleAmount` is required when `importStripeInvoices` is false.",}),},{- name: "POST /commissions – saleAmount 0",+ name: "POST /commissions – sale.amount without saleAmount",body: {type: "sale",partnerId: "pn_test",customerId: "cus_test",- importStripeInvoices: false,- saleAmount: 0,+ sale: { amount: 1000 },},expected: apiError({code: "unprocessable_entity",- message: "custom: saleAmount: Sale amount cannot be 0.",+ message:+ "custom: saleAmount: `saleAmount` is required when `importStripeInvoices` is false.",}),},{- name: "POST /commissions – sale.amount 0",+ name: "POST /commissions – saleAmount 0",body: {type: "sale",partnerId: "pn_test",customerId: "cus_test",- sale: { amount: 0 },+ importStripeInvoices: false,+ saleAmount: 0,},expected: apiError({code: "unprocessable_entity",- message: "custom: sale.amount: Sale amount cannot be 0.",+ message: "custom: saleAmount: Sale amount cannot be 0.",}),},{- name: "POST /commissions – importStripeInvoices with sale",+ name: "POST /commissions – sale object missing amount",body: {type: "sale",partnerId: "pn_test",customerId: "cus_test",- importStripeInvoices: true,+ saleAmount: 1000,sale: {},},expected: apiError({code: "unprocessable_entity",- message:- "custom: sale: `sale`, `date`, `saleAmount`, `saleEventDate`, `invoiceId`, and `productId` cannot be provided when `importStripeInvoices` is enabled.",- }),- },- {- name: "POST /commissions – importStripeInvoices with date",- body: {- type: "sale",- partnerId: "pn_test",- customerId: "cus_test",- importStripeInvoices: true,- date: new Date().toISOString(),- },- expected: apiError({- code: "unprocessable_entity",- message:- "custom: date: `sale`, `date`, `saleAmount`, `saleEventDate`, `invoiceId`, and `productId` cannot be provided when `importStripeInvoices` is enabled.",+ message: "invalid_type: sale.amount: amount is required",}),},{@@ -353,20 +535,6 @@ const commissionErrorCases = ["custom: lead.metadata: Metadata must be less than 10,000 characters when stringified",}),},- {- name: "POST /commissions – custom metadata too large",- body: {- type: "custom",- partnerId: "pn_test",- amount: 500,- metadata: oversizedMetadata,- },- expected: apiError({- code: "unprocessable_entity",- message:- "custom: metadata: Metadata must be less than 10,000 characters when stringified",- }),- },];for (const { name, body, expected } of commissionErrorCases) {diff --git a/apps/web/playwright/api/commissions/helpers.ts b/apps/web/playwright/api/commissions/helpers.tsindex 322d8606de..bab34b3fc8 100644--- a/apps/web/playwright/api/commissions/helpers.ts+++ b/apps/web/playwright/api/commissions/helpers.ts@@ -165,6 +165,7 @@ export async function expectCommissionCreated({invoiceId,expectedAmount,expectedEarnings,+ expectedCreatedAt,}: {partnerId: string;programId: string;@@ -173,6 +174,7 @@ export async function expectCommissionCreated({invoiceId?: string;expectedAmount: number;expectedEarnings: number;+ expectedCreatedAt?: Date;}) {await expect.poll(async () => {@@ -202,6 +204,7 @@ export async function expectCommissionCreated({quantity: commission.quantity,description: commission.description,invoiceId: commission.invoiceId,+ createdAt: commission.createdAt.toISOString(),};}).toEqual({@@ -213,5 +216,8 @@ export async function expectCommissionCreated({quantity: 1,description: description ?? null,invoiceId: invoiceId ?? null,+ createdAt: expectedCreatedAt+ ? expectedCreatedAt.toISOString()+ : expect.any(String),});}