feat: added cus
This commit is contained in:
parent
cf2a980dd8
commit
8dcfffff53
2 changed files with 13 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue