referralprogram

package
v1.41.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 5 Imported by: 0

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