MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / cancelCodingPlanSubscription

Function cancelCodingPlanSubscription

apps/web/src/lib/coding-plans/index.ts:268–286  ·  view source on GitHub ↗
(
  userId: string,
  subscriptionId: string
)

Source from the content-addressed store, hash-verified

266 RETURNING microdollars_used
267 `);
268 if (chargedUsers.length === 0) {
269 throw new Error('Insufficient credit balance for this coding plan purchase.');
270 }
271
272 await tx.insert(credit_transactions).values({
273 id: transactionId,
274 kilo_user_id: userId,
275 amount_microdollars: -plan.costMicrodollars,
276 is_free: false,
277 description: `Coding plan: ${plan.providerName} ${plan.name}`,
278 credit_category: `coding-plan:${plan.planId}:${requestKey}`,
279 check_category_uniqueness: true,
280 original_baseline_microdollars_used: lockedUser.microdollars_used,
281 created_at: periodStartIso,
282 });
283 const { rows: inventoryRows } = await tx.execute<{
284 id: string;
285 encrypted_api_key: { iv: string; data: string; authTag: string } | null;
286 }>(sql`
287 UPDATE coding_plan_key_inventory
288 SET status = 'assigned',
289 assigned_to_user_id = ${userId},

Callers 2

index.test.tsFile · 0.90

Calls 2

setMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected