Skip to content

Commit

Permalink
allow ExpectedPostText for social kyc to be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-ares committed Jun 6, 2024
1 parent dc778b5 commit ee69332
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kyc/social/internal/twitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ func (t *twitterVerifierImpl) VerifyPostLink(ctx context.Context, doc *goquery.D
return
}

func (t *twitterVerifierImpl) VerifyContent(ctx context.Context, oe *twitterOE, expectedText, expextedPostURL string) (err error) {
func (t *twitterVerifierImpl) VerifyContent(ctx context.Context, oe *twitterOE, expectedText, expectedPostURL string) (err error) {
doc, err := goquery.NewDocumentFromReader(bytes.NewReader([]byte(oe.HTML)))
if err != nil {
return multierror.Append(ErrInvalidPageContent, err)
}

if !t.VerifyText(doc, expectedText) {
if expectedText != "" && !t.VerifyText(doc, expectedText) {
return ErrTextNotFound
}

if expextedPostURL != "" && !t.VerifyPostLink(ctx, doc, expextedPostURL) {
if expectedPostURL != "" && !t.VerifyPostLink(ctx, doc, expectedPostURL) {
return ErrPostNotFound
}

Expand Down
3 changes: 3 additions & 0 deletions kyc/social/social.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ func (r *repository) VerifyPost(ctx context.Context, metadata *VerificationMetad
if true { // Because we want to be less strict, for the moment.
pvm.ExpectedPostText = fmt.Sprintf("%q", user.Username)
}
if metadata.KYCStep == users.Social2KYCStep {
pvm.ExpectedPostText = ""
}
if metadata.Language == "zzzzzzzzzz" { // This is for testing purposes.
stdlibtime.Sleep(120 * stdlibtime.Second) //nolint:gomnd // .
} else if metadata.Language == "yyyyyyyyyy" {
Expand Down

0 comments on commit ee69332

Please sign in to comment.