Skip to content

Instantly share code, notes, and snippets.

@OmarKhattab
Created July 30, 2020 22:13
Show Gist options
  • Save OmarKhattab/3cbeca8abf77e3dc9946a1fdeacf0207 to your computer and use it in GitHub Desktop.
Save OmarKhattab/3cbeca8abf77e3dc9946a1fdeacf0207 to your computer and use it in GitHub Desktop.
package api
import (
"server/api/apierror"
"server/slog"
"server/store"
)
// VerifyUserIdentity allows a user to mark there identity verification method as skipped to allow booking in the ios app
// Products: ios app
// POST /v3/user/verify_user_identity_skipped/:userID
func VerifyUserIdentityAsSkipped(ctx context.Context,
pathUserID store.UserID) apierror.APIError {
if pathUserID == "" {
slog.Warning(ctx, APIErrUserIDRequired)
return APIErrUserIDRequired
}
err := store.Transaction(ctx, func(ctx context.Context) error {
user, err := store.GetUser(ctx, pathUserID)
if err != nil {
return notifyAndReturnAPIErr(ctx, err)
}
user.IdentityVerificationMethod = "skipped"
err = store.Save(ctx, user)
if err != nil {
return notifyAndReturnAPIErr(ctx, err)
}
return nil
})
if err != nil {
return returnAPIErrOrFallbackToInternalServerErr(ctx, err)
}
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment