2
0

🐛 (payment) Fix payment redirection

This commit is contained in:
Baptiste Arnaud
2024-06-26 10:59:11 +02:00
parent 6db0464fd7
commit 6af47a8cfe
16 changed files with 182 additions and 38 deletions

View File

@@ -5,6 +5,8 @@ import {
WorkspaceRole,
} from '@typebot.io/prisma'
import { encrypt } from '@typebot.io/lib/api/encryption/encrypt'
import { env } from '@typebot.io/env'
import { StripeCredentials } from '@typebot.io/schemas'
const prisma = new PrismaClient()
@@ -134,6 +136,16 @@ const setupCredentials = async () => {
refresh_token:
'1//039xWRt8YaYa3CgYIARAAGAMSNwF-L9Iru9FyuTrDSa7lkSceggPho83kJt2J29G69iEhT1C6XV1vmo6bQS9puL_R2t8FIwR3gek',
})
const { encryptedData: stripeEncryptedData, iv: stripeIv } = await encrypt({
test: {
publicKey: env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY,
secretKey: env.STRIPE_SECRET_KEY,
},
live: {
publicKey: env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY ?? '',
secretKey: env.STRIPE_SECRET_KEY ?? '',
},
} satisfies StripeCredentials['data'])
return prisma.credentials.createMany({
data: [
{
@@ -143,6 +155,14 @@ const setupCredentials = async () => {
workspaceId: proWorkspaceId,
iv,
},
{
id: 'stripe',
name: 'Test',
type: 'stripe',
data: stripeEncryptedData,
workspaceId: proWorkspaceId,
iv: stripeIv,
},
],
})
}

View File

@@ -10,10 +10,11 @@
"@playwright/test": "1.43.1",
"@typebot.io/lib": "workspace:*",
"@typebot.io/prisma": "workspace:*",
"@typebot.io/schemas": "workspace:*"
"@typebot.io/schemas": "workspace:*",
"@typebot.io/env": "workspace:*"
},
"devDependencies": {
"@types/node": "20.4.2",
"@typebot.io/tsconfig": "workspace:*"
}
}
}