accountfreeze

package
v1.76.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Error is the standard error class for automatic freeze errors.
	Error = errs.Class("account-freeze-chore")
)

Functions

This section is empty.

Types

type Chore

type Chore struct {
	Loop *sync2.Cycle
	// contains filtered or unexported fields
}

Chore is a chore that checks for unpaid invoices and potentially freezes corresponding accounts.

func NewChore

func NewChore(log *zap.Logger, accounts stripecoinpayments.DB, payments payments.Accounts, usersDB console.Users, freezeService *console.AccountFreezeService, analytics *analytics.Service, config Config) *Chore

NewChore is a constructor for Chore.

func (*Chore) Close

func (chore *Chore) Close() error

Close closes the chore.

func (*Chore) Run

func (chore *Chore) Run(ctx context.Context) (err error)

Run runs the chore.

func (*Chore) TestSetNow

func (chore *Chore) TestSetNow(f func() time.Time)

TestSetNow sets nowFn on chore for testing.

type Config

type Config struct {
	Enabled        bool          `help:"whether to run this chore." default:"false"`
	Interval       time.Duration `help:"How often to run this chore, which is how often unpaid invoices are checked." default:"24h"`
	GracePeriod    time.Duration `help:"How long to wait between a warning event and freezing an account." default:"720h"`
	PriceThreshold int64         `help:"The failed invoice amount (in cents) beyond which an account will not be frozen" default:"10000"`
}

Config contains configurable values for account freeze chore.

Jump to

Keyboard shortcuts

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