summaryrefslogtreecommitdiffhomepage
path: root/packages/console/core/src
diff options
context:
space:
mode:
authorFrank <[email protected]>2025-10-31 14:42:18 -0400
committerFrank <[email protected]>2025-10-31 14:43:51 -0400
commit021334509e8d4d9a823caf49216346afca1c36f4 (patch)
treed4779f2fcf2a25da5e38bdd54ccf0f74fdd537f9 /packages/console/core/src
parent4bde3f7b156729733c0286a8119825d5782d8a31 (diff)
downloadopencode-021334509e8d4d9a823caf49216346afca1c36f4.tar.gz
opencode-021334509e8d4d9a823caf49216346afca1c36f4.zip
sync
Diffstat (limited to 'packages/console/core/src')
-rw-r--r--packages/console/core/src/billing.ts13
-rw-r--r--packages/console/core/src/schema/billing.sql.ts2
2 files changed, 4 insertions, 11 deletions
diff --git a/packages/console/core/src/billing.ts b/packages/console/core/src/billing.ts
index ec7df7e36..70bf1bc36 100644
--- a/packages/console/core/src/billing.ts
+++ b/packages/console/core/src/billing.ts
@@ -13,7 +13,9 @@ export namespace Billing {
export const CHARGE_NAME = "opencode credits"
export const CHARGE_FEE_NAME = "processing fee"
export const CHARGE_AMOUNT = 2000 // $20
+ export const CHARGE_AMOUNT_DOLLAR = 20
export const CHARGE_FEE = 123 // Stripe fee 4.4% + $0.30
+ export const CHARGE_THRESHOLD_DOLLAR = 5
export const CHARGE_THRESHOLD = 500 // $5
export const stripe = () =>
new Stripe(Resource.STRIPE_SECRET_KEY.value, {
@@ -142,17 +144,6 @@ export namespace Billing {
})
}
- export const disableReload = async () => {
- return await Database.use((tx) =>
- tx
- .update(BillingTable)
- .set({
- reload: false,
- })
- .where(eq(BillingTable.workspaceID, Actor.workspace())),
- )
- }
-
export const setMonthlyLimit = fn(z.number(), async (input) => {
return await Database.use((tx) =>
tx
diff --git a/packages/console/core/src/schema/billing.sql.ts b/packages/console/core/src/schema/billing.sql.ts
index c72eba283..6d1520d15 100644
--- a/packages/console/core/src/schema/billing.sql.ts
+++ b/packages/console/core/src/schema/billing.sql.ts
@@ -16,6 +16,8 @@ export const BillingTable = mysqlTable(
monthlyUsage: bigint("monthly_usage", { mode: "number" }),
timeMonthlyUsageUpdated: utc("time_monthly_usage_updated"),
reload: boolean("reload"),
+ reloadTrigger: int("reload_trigger"),
+ reloadAmount: int("reload_amount"),
reloadError: varchar("reload_error", { length: 255 }),
timeReloadError: utc("time_reload_error"),
timeReloadLockedTill: utc("time_reload_locked_till"),