Skip to content

Commit

Permalink
fixed non 200 OK response handling for TryResetKYCSteps webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-ares committed Nov 22, 2023
1 parent de89fab commit 4e423ad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/cenkalti/backoff/v4 v4.2.1
github.com/goccy/go-json v0.10.2
github.com/hashicorp/go-multierror v1.1.1
github.com/ice-blockchain/eskimo v1.185.0
github.com/ice-blockchain/eskimo v1.186.0
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb
github.com/ice-blockchain/wintr v1.125.0
github.com/imroc/req/v3 v3.42.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,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/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ice-blockchain/eskimo v1.185.0 h1:+qXOktkEnlDmE0wOiLZC6Tcp5wp4eJdbCZeHSsaY4uA=
github.com/ice-blockchain/eskimo v1.185.0/go.mod h1:wjt+BudjNYu6y2wRwUK8HKgPPPTi77WLRUG2Sp4ZCZM=
github.com/ice-blockchain/eskimo v1.186.0 h1:04SAmvmIePHOcckQNItC8miif2lKnOEu/J8o1gYtm3g=
github.com/ice-blockchain/eskimo v1.186.0/go.mod h1:wjt+BudjNYu6y2wRwUK8HKgPPPTi77WLRUG2Sp4ZCZM=
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/wintr v1.125.0 h1:pk/SVyztstUF19+JDCufJRMXJeNpchVA4O26xp47l3Y=
Expand Down
4 changes: 3 additions & 1 deletion tokenomics/kyc.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (r *repository) overrideKYCStateWithEskimoKYCState(ctx context.Context, use
}
}).
SetRetryCondition(func(resp *req.Response, err error) bool {
return err != nil || (resp.GetStatusCode() != http.StatusOK && resp.GetStatusCode() != http.StatusUnauthorized)
return err != nil || (resp.GetStatusCode() != http.StatusOK && resp.GetStatusCode() != http.StatusUnauthorized && resp.GetStatusCode() != http.StatusForbidden) //nolint:lll // .
}).
AddQueryParam("caller", "freezer-refrigerant").
SetHeader("Authorization", authorization(ctx)).
Expand All @@ -215,6 +215,8 @@ func (r *repository) overrideKYCStateWithEskimoKYCState(ctx context.Context, use
SetHeader("Expires", "0").
Post(fmt.Sprintf("%v/users/%v", r.cfg.KYC.TryResetKYCStepsURL, userID)); err != nil {
return errors.Wrapf(err, "failed to fetch eskimo user state for userID:%v", userID)
} else if statusCode := resp.GetStatusCode(); statusCode != http.StatusOK {
return errors.Errorf("[%v]failed to fetch eskimo user state for userID:%v", statusCode, userID)
} else if data, err2 := resp.ToBytes(); err2 != nil {
return errors.Wrapf(err2, "failed to read body of eskimo user state request for userID:%v", userID)
} else {
Expand Down

0 comments on commit 4e423ad

Please sign in to comment.