Seed pricing context for demo orders
Build and deploy Docker image / build (push) Successful in 1m38s
Build and deploy Docker image / build (push) Successful in 1m38s
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { createHash } from 'node:crypto'
|
||||
import { Prisma } from '@prisma/client'
|
||||
import { prisma } from './db.js'
|
||||
import { lockCurrencyPrice, resolveKycPricingContext } from './pricing-context.js'
|
||||
import { ensureDemoKycPricingContext, lockCurrencyPrice } from './pricing-context.js'
|
||||
|
||||
interface DemoWorkspaceAccess {
|
||||
teamUuid: string
|
||||
@@ -98,6 +98,7 @@ const demoRoutes: DemoRoute[] = [
|
||||
]
|
||||
|
||||
const demoNote = JSON.stringify({ seed: 'empty-team-workspace' })
|
||||
const demoPricingCountryCode = process.env.DEMO_PRICING_COUNTRY_CODE ?? 'RU'
|
||||
|
||||
function stableUuid(teamUuid: string, entity: string, index: number): string {
|
||||
const hex = createHash('sha256')
|
||||
@@ -126,7 +127,10 @@ export async function ensureDemoWorkspaceData(access: DemoWorkspaceAccess): Prom
|
||||
const needsOrders = orderCount === 0
|
||||
const needsPricingBackfill = demoQuotationPricingCount > 0 || demoOrderPricingCount > 0
|
||||
const kyc = needsCalculations || needsOrders || needsPricingBackfill
|
||||
? await resolveKycPricingContext(access.userId)
|
||||
? await ensureDemoKycPricingContext({
|
||||
userId: access.userId,
|
||||
countryCode: demoPricingCountryCode,
|
||||
})
|
||||
: null
|
||||
|
||||
for (const [index, route] of demoRoutes.entries()) {
|
||||
|
||||
Reference in New Issue
Block a user