Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(developer): add upper bound to auto top-up amount

Richie McIlroye0cac14f8285
diff --git a/apps/web/actions/developers/update-auto-topup.ts b/apps/web/actions/developers/update-auto-topup.ts
index 68927e65c..1d5fb37fc 100644
--- a/apps/web/actions/developers/update-auto-topup.ts
+++ b/apps/web/actions/developers/update-auto-topup.ts
@@ -35,8 +35,11 @@ export async function updateDeveloperAutoTopUp(data: {
) {
throw new Error("Threshold must be non-negative");
}
- if (data.amountCents !== undefined && data.amountCents <= 0) {
- throw new Error("Top-up amount must be positive");
+ if (
+ data.amountCents !== undefined &&
+ (data.amountCents <= 0 || data.amountCents > 100_000)
+ ) {
+ throw new Error("Top-up amount must be between $0.01 and $1,000.00");
}
const updates: Partial<typeof developerCreditAccounts.$inferInsert> = {