Skip to content

Commit

Permalink
Twitter ID is now a string vs int
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Jan 24, 2022
1 parent 70b2860 commit 7f01863
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type conversionOptions struct {
shortCode string // (optional) trigger a conversion for a link short_code
tncpwSession string // tncpw session
tonicPowUserID uint64 // (optional) trigger a conversion for a specific user
twitterID uint64 // (optional) trigger a conversion for a specific Twitter user
twitterID string // (optional) trigger a conversion for a specific Twitter user
}

// validate will check the options before processing
Expand All @@ -29,7 +29,7 @@ func (o *conversionOptions) validate() error {
return fmt.Errorf("missing required attribute(s): %s or %s", fieldID, fieldName)
} else if o.goalID == 0 && o.tonicPowUserID > 0 {
return fmt.Errorf("missing required attribute: %s", fieldID)
} else if o.tonicPowUserID == 0 && len(o.tncpwSession) == 0 && len(o.shortCode) == 0 && o.twitterID == 0 {
} else if o.tonicPowUserID == 0 && len(o.tncpwSession) == 0 && len(o.shortCode) == 0 && len(o.twitterID) == 0 {
return fmt.Errorf(
"missing required attribute(s): %s or %s or %s or %s",
fieldVisitorSessionGUID, fieldUserID, fieldShortCode, fieldTwitterID,
Expand Down Expand Up @@ -57,8 +57,8 @@ func (o *conversionOptions) payload() map[string]string {
m[fieldUserID] = fmt.Sprintf("%d", o.tonicPowUserID)
} else if len(o.shortCode) > 0 {
m[fieldShortCode] = o.shortCode
} else if o.twitterID > 0 {
m[fieldTwitterID] = fmt.Sprintf("%d", o.twitterID)
} else if len(o.twitterID) > 0 {
m[fieldTwitterID] = o.twitterID
} else if len(o.tncpwSession) > 0 {
m[fieldVisitorSessionGUID] = o.tncpwSession
}
Expand Down Expand Up @@ -138,7 +138,7 @@ func WithShortCode(shortCode string) ConversionOps {
}

// WithTwitterID will set a Twitter user ID
func WithTwitterID(twitterID uint64) ConversionOps {
func WithTwitterID(twitterID string) ConversionOps {
return func(c *conversionOptions) {
c.twitterID = twitterID
}
Expand Down
2 changes: 1 addition & 1 deletion tonicpow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
testRateCurrency string = "usd"
testShortCode string = "test_short_code"
testTncpwSession string = "TestSessionKey12345678987654321"
testTwitterID uint64 = 22413277
testTwitterID string = "22413277"
testUserID uint64 = 43
)

Expand Down

0 comments on commit 7f01863

Please sign in to comment.