feat: added cus

This commit is contained in:
Nevo David 2026-03-21 16:32:34 +07:00
parent cf2a980dd8
commit 8dcfffff53
2 changed files with 13 additions and 1 deletions

View file

@ -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,

View file

@ -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',
};