diff --git a/cmd/eskimo-hut/eskimo.go b/cmd/eskimo-hut/eskimo.go index 3709d21..650d357 100644 --- a/cmd/eskimo-hut/eskimo.go +++ b/cmd/eskimo-hut/eskimo.go @@ -345,9 +345,11 @@ func (s *service) GetUserByID( //nolint:gocritic // False negative. return nil, server.Unexpected(errors.Wrapf(err, "failed to get user by id: %v", req.Data.UserID)) } - const doctorxTenant = "doctorx" - if cfg.Tenant == doctorxTenant { - usr.CreatedAt = time.Now() + if false { + const doctorxTenant = "doctorx" + if cfg.Tenant == doctorxTenant { + usr.CreatedAt = time.Now() + } } return server.OK(&UserProfile{UserProfile: usr, Checksum: usr.Checksum()}), nil diff --git a/go.mod b/go.mod index 75b6105..8266270 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/google/uuid v1.6.0 github.com/hashicorp/go-multierror v1.1.1 github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb - github.com/ice-blockchain/santa v1.183.0 + github.com/ice-blockchain/santa v1.184.0 github.com/ice-blockchain/wintr v1.154.0 github.com/imroc/req/v3 v3.48.0 github.com/ip2location/ip2location-go/v9 v9.7.0 @@ -95,7 +95,7 @@ require ( github.com/gofrs/flock v0.12.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.1 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e // indirect github.com/google/pprof v0.0.0-20241128161848-dc51965c6481 // indirect diff --git a/go.sum b/go.sum index 40a22b0..847149a 100644 --- a/go.sum +++ b/go.sum @@ -196,8 +196,8 @@ github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17w github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -247,8 +247,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb h1:8TnFP3mc7O+tc44kv2e0/TpZKnEVUaKH+UstwfBwRkk= github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb/go.mod h1:ZsQU7i3mxhgBBu43Oev7WPFbIjP4TniN/b1UPNGbrq8= -github.com/ice-blockchain/santa v1.183.0 h1:FkhdGSCFfAJE635K421koa4VeZ0AuUS4yIR2vrHLoqU= -github.com/ice-blockchain/santa v1.183.0/go.mod h1:X21vypru0hE65EXMMB7239vhkcYEIfE43X5gSkLI608= +github.com/ice-blockchain/santa v1.184.0 h1:ZChoze7WoDMOeg46MPtfi7n8BbilpSEQU7RfSsFyxV0= +github.com/ice-blockchain/santa v1.184.0/go.mod h1:4mwgz3o88E5k6PKqwAzxOXqu4KCbpOHdJ+tgfZ17BTQ= github.com/ice-blockchain/wintr v1.154.0 h1:yZSQtAEwGHTSmJ5pXjX0tpui1TNnG615QfpBkhY99a4= github.com/ice-blockchain/wintr v1.154.0/go.mod h1:DoUn66XJGzPzfCZTsHyMjfgj2aVLGvjqDSuKj2pa3KE= github.com/imroc/req/v3 v3.48.0 h1:IYuMGetuwLzOOTzDCquDqs912WNwpsPK0TBXWPIvoqg= diff --git a/kyc/linking/linking.go b/kyc/linking/linking.go index 9663ba7..07d6e58 100644 --- a/kyc/linking/linking.go +++ b/kyc/linking/linking.go @@ -53,12 +53,12 @@ func (l *linker) Verify(ctx context.Context, now *time.Time, userID UserID, toke var hasKYCResult bool remoteID, hasKYCResult, err = l.verifyToken(ctx, userID, tenant, token) if err != nil { - return allProfiles, verified, errors.Wrap(err, "failed to verify token") + return allProfiles, verified, errors.Wrapf(err, "failed to verify token: %v for tenant: %v", token, tenant) } var remoteProfiles LinkedProfiles remoteProfiles, verified, err = l.Get(ctx, remoteID) if err != nil { - return allProfiles, verified, errors.Wrapf(err, "failed to get remote profiles for remote %v %v", tenant, remoteID) + return allProfiles, verified, errors.Wrapf(err, "failed to get remote profiles for remote tenant:%v, remoteID:%v, token: %v", tenant, remoteID, token) } for remTenant, rem := range remoteProfiles { allProfiles[remTenant] = rem @@ -143,13 +143,13 @@ func (l *linker) verifyToken(ctx context.Context, userID, tenant, token string) usr, err := fetchTokenData(ctx, tenant, token, l.host, l.cfg.TenantURLs) if err != nil { if errors.Is(err, ErrRemoteUserNotFound) { - return "", false, errors.Wrapf(ErrNotOwnRemoteUser, "token is not belong to %v", userID) + return "", false, errors.Wrapf(ErrNotOwnRemoteUser, "tenant:%v, token:%v is not belong to %v", tenant, token, userID) } - return "", false, errors.Wrapf(err, "failed to fetch remote user data for %v", userID) + return "", false, errors.Wrapf(err, "failed to fetch remote user data for %v, tenant:%v with token:%v", userID, tenant, token) } if usr.CreatedAt == nil || usr.ReferredBy == "" || usr.Username == "" { - return "", false, errors.Wrapf(ErrNotOwnRemoteUser, "token is not belong to %v", userID) + return "", false, errors.Wrapf(ErrNotOwnRemoteUser, "tenant:%v, token:%v is not belong to %v", tenant, token, userID) } return usr.ID, usr.HasFaceKYCResult(), nil @@ -159,7 +159,7 @@ func (l *linker) verifyToken(ctx context.Context, userID, tenant, token string) func fetchTokenData(ctx context.Context, tenant, token, host string, tenantURLs map[Tenant]string) (*users.User, error) { tok, err := server.Auth(ctx).ParseToken(token, false) if err != nil { - return nil, errors.Wrapf(err, "invalid token passed") + return nil, errors.Wrapf(err, "invalid token passed for tenant:%v, token:%v", tenant, token) } var resp *req.Response var usr users.User @@ -185,7 +185,7 @@ func fetchTokenData(ctx context.Context, tenant, token, host string, tenantURLs log.Error(errors.Wrap(err, "failed to check accounts linking, retrying... ")) } else { body, bErr := resp.ToString() - log.Error(errors.Wrapf(bErr, "failed to parse negative response body for account linking")) + log.Error(errors.Wrapf(bErr, "failed to parse negative response body for account linking, tenant: %v, token: %v", tenant, token)) log.Error(errors.Errorf("failed check link accounts with status code:%v, body:%v, retrying... ", resp.GetStatusCode(), body)) } }). @@ -196,13 +196,13 @@ func fetchTokenData(ctx context.Context, tenant, token, host string, tenantURLs SetHeader("Authorization", token). AddQueryParam("caller", "eskimo-hut"). Get(getUserURL); err != nil { - return nil, errors.Wrap(err, "failed to link accounts") + return nil, errors.Wrapf(err, "failed to link accounts for tenant:%v, token:%v", tenant, token) } else if statusCode := resp.GetStatusCode(); statusCode != http.StatusOK { if statusCode == http.StatusNotFound { - return nil, errors.Wrapf(ErrRemoteUserNotFound, "wrong status code for fetch token data for user %v", tok.Subject) + return nil, errors.Wrapf(ErrRemoteUserNotFound, "wrong status code for fetch token data for user %v, tenant:%v, token:%v", tok.Subject, tenant, token) } - return nil, errors.Errorf("[%v]failed to link accounts", statusCode) + return nil, errors.Errorf("[%v]failed to link accounts, tenant:%v, token:%v", statusCode, tenant, token) } else if data, err2 := resp.ToBytes(); err2 != nil { return nil, errors.Wrapf(err2, "failed to read body of linking users: %v", getUserURL) } else if jErr := json.UnmarshalContext(ctx, data, &usr); jErr != nil {