referrer

package
v1.36.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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) (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