referrer

package
v1.49.49 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 21 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// CodeLength is how many characters a minted referral code has.
	CodeLength = 8
)

Variables

This section is empty.

Functions

func NewCode added in v1.49.26

func NewCode() string

NewCode mints a referral code. Callers that accept a caller-supplied code still have to check it is free — this only produces the shape.

func Query

Types

type Referrent

type Referrent interface {
	Id() string
	Kind() string
	Total() currency.Cents
}

type Referrer

type Referrer struct {
	mixin.Model[Referrer]

	Code      string                          `json:"code"`
	Program   referralprogram.ReferralProgram `json:"program"`
	ProgramId string                          `json:"programId"`
	OrderId   string                          `json:"orderId"`
	UserId    string                          `json:"userId"`

	AffiliateId     string              `json:"affiliateId,omitempty"`
	Affiliate       affiliate.Affiliate `json:"affiliate,omitempty" datastore:"-"`
	FirstReferredAt time.Time           `json:"firstReferredAt"`

	Client      client.Client `json:"-"`
	Blacklisted bool          `json:"blacklisted,omitempty"`
	Duplicate   bool          `json:"duplicate,omitempty"`

	State  Map    `json:"state,omitempty" datastore:"-"`
	State_ string `json:"-" datastore:",noindex"`
}

Is a link that can refer customers to buy products

func Fake

func Fake(db *datastore.Datastore, userId string) *Referrer

func New

func New(db *datastore.Datastore) *Referrer

func (*Referrer) ApplyActions

func (r *Referrer) ApplyActions(ctx context.Context, orgId string, event referral.Event, p *referralprogram.ReferralProgram, rfn Referrent, rfl *referral.Referral, test bool) error

func (*Referrer) Defaults

func (r *Referrer) Defaults()

func (*Referrer) Load

func (r *Referrer) Load(ps []datastore.Property) (err error)

func (*Referrer) LoadAffiliate

func (r *Referrer) LoadAffiliate() error

func (*Referrer) LoadReferralProgram

func (r *Referrer) LoadReferralProgram() error

func (*Referrer) Referrals

func (r *Referrer) Referrals() ([]*referral.Referral, error)

func (*Referrer) Save

func (r *Referrer) Save() (ps []datastore.Property, err error)

func (*Referrer) SaveReferral

func (r *Referrer) SaveReferral(ctx context.Context, orgId string, event referral.Event, rfn Referrent, userId string, test bool) (*referral.Referral, error)

func (*Referrer) TestTrigger

func (r *Referrer) TestTrigger(action referralprogram.Action, event referral.Event, test bool) (bool, error)

func (*Referrer) Transactions

func (r *Referrer) Transactions() ([]*transaction.Transaction, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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