|
1 | 1 | import db from 'common/db' |
2 | 2 | import * as schema from 'common/db/schema' |
3 | | -import { eq } from 'drizzle-orm' |
4 | | -import { stripeServer } from 'common/util/stripe' |
5 | | -import { logger } from 'common/util/logger' |
| 3 | +import { CREDIT_PRICING } from 'common/src/constants' |
| 4 | +import { env } from 'common/src/env.mjs' |
6 | 5 | import { convertCreditsToUsdCents } from 'common/util/currency' |
7 | | -import { getUserCostPerCredit } from './conversion' |
| 6 | +import { getNextQuotaReset } from 'common/util/dates' |
| 7 | +import { logger } from 'common/util/logger' |
| 8 | +import { stripeServer } from 'common/util/stripe' |
| 9 | +import { eq } from 'drizzle-orm' |
8 | 10 | import type Stripe from 'stripe' |
9 | | -import { processAndGrantCredit } from './grant-credits' |
10 | 11 | import { calculateUsageAndBalance } from './balance-calculator' |
11 | | -import { generateOperationIdTimestamp } from './utils' |
12 | | -import { env } from 'common/src/env.mjs' |
13 | | -import { CREDIT_PRICING } from 'common/src/constants' |
| 12 | +import { getUserCostPerCredit } from './conversion' |
| 13 | +import { processAndGrantCredit } from './grant-credits' |
14 | 14 | import { |
15 | | - grantOrganizationCredits, |
16 | 15 | calculateOrganizationUsageAndBalance, |
| 16 | + grantOrganizationCredits, |
17 | 17 | } from './org-billing' |
18 | | -import { getNextQuotaReset } from 'common/util/dates' |
| 18 | +import { generateOperationIdTimestamp } from './utils' |
19 | 19 |
|
20 | 20 | const MINIMUM_PURCHASE_CREDITS = 500 |
21 | 21 |
|
@@ -100,6 +100,8 @@ export async function validateAutoTopupStatus( |
100 | 100 | validPaymentMethod, |
101 | 101 | } |
102 | 102 | } catch (error) { |
| 103 | + logger.error({ error }, 'Failed to validate auto top-up status') |
| 104 | + |
103 | 105 | const blockedReason = |
104 | 106 | error instanceof AutoTopupValidationError |
105 | 107 | ? error.message |
|
0 commit comments