diff --git a/go.mod b/go.mod index 5ef10ef4..11e58e22 100644 --- a/go.mod +++ b/go.mod @@ -49,7 +49,7 @@ require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/distribution/reference v0.5.0 // indirect github.com/docker/distribution v2.8.3+incompatible // indirect - github.com/docker/docker v25.0.0+incompatible // indirect + github.com/docker/docker v25.0.1+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect diff --git a/kyc/social/internal/social_test.go b/kyc/social/internal/social_test.go index 2647c81f..2c8e7c4e 100644 --- a/kyc/social/internal/social_test.go +++ b/kyc/social/internal/social_test.go @@ -42,6 +42,31 @@ func TestTwitterKYC(t *testing.T) { }) } +func TestTwitterKYCNoRepost(t *testing.T) { + t.Parallel() + + const ( + expectedText = `✅ Verifying my account on @ice_blockchain with the nickname: "john"` + targetURL = `https://twitter.com/JohnDoe1495747/status/1750103621184700443` + ) + + conf := loadConfig() + require.NotNil(t, conf) + + sc := newMustWebScraper(conf.WebScrapingAPI.URL, conf.WebScrapingAPI.APIKey) + require.NotNil(t, sc) + + verifier := newTwitterVerifier(sc, []string{"twitter.com"}, []string{"US", "MX", "CA"}) + require.NotNil(t, verifier) + + ctx, cancel := context.WithTimeout(context.TODO(), time.Minute) + defer cancel() + + username, err := verifier.VerifyPost(ctx, &Metadata{PostURL: targetURL, ExpectedPostText: expectedText}) + require.NoError(t, err) + require.Equal(t, "JohnDoe1495747", username) +} + func TestTwitterPrivate(t *testing.T) { t.Parallel() diff --git a/kyc/social/internal/twitter.go b/kyc/social/internal/twitter.go index cc51748c..2985c964 100644 --- a/kyc/social/internal/twitter.go +++ b/kyc/social/internal/twitter.go @@ -59,7 +59,7 @@ func (t *twitterVerifierImpl) VerifyContent(ctx context.Context, oe *twitterOE, return ErrTextNotFound } - if !t.VerifyPostLink(ctx, doc, expextedPostURL) { + if expextedPostURL != "" && !t.VerifyPostLink(ctx, doc, expextedPostURL) { return ErrPostNotFound } diff --git a/kyc/social/social.go b/kyc/social/social.go index 184dd1d9..e8ec5788 100644 --- a/kyc/social/social.go +++ b/kyc/social/social.go @@ -178,9 +178,6 @@ func (r *repository) VerifyPost(ctx context.Context, metadata *VerificationMetad ExpectedPostText: metadata.expectedPostText(user.User), ExpectedPostURL: r.expectedPostURL(metadata), } - if pvm.ExpectedPostURL == "" { - log.Warn(fmt.Sprintf("post url not found for KYCStep:%v,Social:%v", metadata.KYCStep, metadata.Social)) - } if true { // Because we want to be less strict, for the moment. pvm.ExpectedPostText = fmt.Sprintf("%q", user.Username) }