Skip to content

Commit

Permalink
fix: save user info before approving (#1767)
Browse files Browse the repository at this point in the history
  • Loading branch information
dragosp1011 authored Oct 23, 2024
1 parent e34a0a6 commit a8bf42d
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions packages/wallet/backend/src/gatehub/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,6 @@ export class GateHubService {
throw new NotFound()
}

if (!isApproved) {
isApproved = await this.gateHubClient.connectUserToGateway(
user.gateHubUserId,
this.env.GATEHUB_GATEWAY_UUID
)
}

this.logger.info(
`User ${user.id} with gatehub id ${user.gateHubUserId} CONNECTED TO GATEWAY`
)

const userState = await this.gateHubClient.getUserState(user.gateHubUserId)

const userDetails: Partial<User> = {
Expand All @@ -135,11 +124,22 @@ export class GateHubService {
.join(', ')
}

if (isApproved) {
userDetails.kycVerified = true
await User.query().findById(user.id).patch(userDetails)

if (!isApproved) {
isApproved = await this.gateHubClient.connectUserToGateway(
user.gateHubUserId,
this.env.GATEHUB_GATEWAY_UUID
)
}

await User.query().findById(user.id).patch(userDetails)
this.logger.info(
`User ${user.id} with gatehub id ${user.gateHubUserId} CONNECTED TO GATEWAY`
)

if (isApproved) {
await this.updateUserFlag(user.id, { kycVerified: true })
}

let customerId
if (
Expand Down

0 comments on commit a8bf42d

Please sign in to comment.