referralprogram

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 5 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

This section is empty.

Variables

This section is empty.

Functions

func Query

Types

type Action

type Action struct {
	Type ActionType `json:"type"`
	Name string     `json:"name"`
	Once bool       `json:"once"`

	CreditAction
	// PercentAction
	SendTransactionalUserEmailAction
	SendWoopraEvent

	Trigger Trigger `json:"trigger"`
}

Union of possible actions

type ActionType

type ActionType string
const (
	StoreCredit ActionType = "Credit" // Add credit to user's balance
	// Refund        ActionType = "Refund" // Refund part of the payment on a order
	SendUserEmail ActionType = "SendUserEmail"
	SendWoopra    ActionType = "SendWoopraEvent"
)

type CreditAction

type CreditAction struct {
	Currency currency.Type  `json:"currency,omitempty"`
	Amount   currency.Cents `json:"amount,omitempty"`
}

type CreditGreaterThanOrEqualsTrigger

type CreditGreaterThanOrEqualsTrigger struct {
	CreditGreaterThanOrEquals currency.Cents `json:"creditGreaterThanOrEquals,omitempty"`
	Currency                  currency.Type  `json:"currency,omitempty"`
}

type ReferralProgram

type ReferralProgram struct {
	mixin.Model[ReferralProgram]

	Name string `json:"name"`

	// Trigger is the number of referrals, 0 means it triggers on every referral
	Triggers []int    `json:"triggers"` // Deprecate soon, keep until that point in time
	Actions  []Action `json:"actions"`
}

func New

type ReferralsGreaterThanOrEqualsTrigger

type ReferralsGreaterThanOrEqualsTrigger struct {
	ReferralsGreaterThanOrEquals int `json:"referralsGreaterThanOrEquals,omitempty"`
}

type SendTransactionalUserEmailAction

type SendTransactionalUserEmailAction struct {
	EmailTemplate string `json:"template"`
}

type SendWoopraEvent

type SendWoopraEvent struct {
	Domain string `json:"domain"`
}

type Trigger

type Trigger struct {
	Event referral.Event `json:"event"`

	Type TriggerType `json:"type"`
	CreditGreaterThanOrEqualsTrigger
	ReferralsGreaterThanOrEqualsTrigger
}

Union of possible triggers

type TriggerType

type TriggerType string
const (
	CreditGreaterThanOrEquals    TriggerType = "CreditGreaterThanOrEquals"
	ReferralsGreaterThanOrEquals TriggerType = "ReferralsGreaterThanOrEquals"
	Always                       TriggerType = "Always"
)

Jump to

Keyboard shortcuts

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