From 8dcfffff53ae45f1fcc602bdda1601b6456f45eb Mon Sep 17 00:00:00 2001 From: Nevo David Date: Sat, 21 Mar 2026 16:32:34 +0700 Subject: [PATCH] feat: added cus --- .../src/database/prisma/oauth/oauth.repository.ts | 8 ++++++++ .../src/database/prisma/oauth/oauth.service.ts | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.repository.ts b/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.repository.ts index fe18a8cb..e3acf6c1 100644 --- a/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.repository.ts +++ b/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.repository.ts @@ -165,6 +165,14 @@ export class OAuthRepository { exchangeCodeForToken(id: string, encryptedToken: string) { return this._oauthAuth.model.oAuthAuthorization.update({ where: { id }, + select: { + organizationId: true, + organization: { + select: { + paymentId: true, + } + } + }, data: { accessToken: encryptedToken, authorizationCode: null, diff --git a/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.service.ts b/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.service.ts index 610b424c..2a1033dd 100644 --- a/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.service.ts +++ b/libraries/nestjs-libraries/src/database/prisma/oauth/oauth.service.ts @@ -138,13 +138,17 @@ export class OAuthService { const token = 'pos_' + makeId(40); const encryptedToken = AuthService.fixedEncryption(token); - const { organizationId } = await this._oauthRepository.exchangeCodeForToken( + const { + organizationId, + organization: { paymentId }, + } = await this._oauthRepository.exchangeCodeForToken( auth.id, encryptedToken ); return { id: organizationId, + cus: paymentId, access_token: token, token_type: 'bearer', };