Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClaimReferral ¶
ClaimReferral processes a referral claim: validates the code, checks fraud rules, creates credit grants for both parties, and records the referral.
POST /api/v1/referral/claim
Types ¶
type ClaimRequest ¶
type ClaimRequest struct {
UserId string // The new user being referred
Email string // The new user's email
IP string // The IP address of the claim request
ReferCode string // The referrer code being used
}
ClaimRequest represents an incoming referral claim to validate.
type FraudChecker ¶
type FraudChecker struct {
// contains filtered or unexported fields
}
FraudChecker validates referral claims against fraud rules. Config is loaded from the shared config package.
func NewFraudChecker ¶
func NewFraudChecker(db *datastore.Datastore) *FraudChecker
NewFraudChecker creates a FraudChecker backed by the shared program config.
func (*FraudChecker) Check ¶
func (fc *FraudChecker) Check(c *gin.Context, ref *referrer.Referrer, claim ClaimRequest) (bool, string)
Check runs all fraud checks against a referral claim. Returns (allowed, reason). If not allowed, reason describes why. Sets ref.Blacklisted and ref.Duplicate as appropriate side effects.
Click to show internal directories.
Click to hide internal directories.