referral

package
v1.39.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaimReferral

func ClaimReferral(c *gin.Context)

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

func Route

func Route(r router.Router, args ...gin.HandlerFunc)

Route registers referral and referrer routes. This is the base layer: tracking referral codes, claims, credits, fraud. Affiliate/contributor routes are registered separately via api/affiliate.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL