Created
July 30, 2020 22:13
-
-
Save OmarKhattab/3cbeca8abf77e3dc9946a1fdeacf0207 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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