services

package
v0.0.0-...-2f85d4a Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KoFi

type KoFi struct {
	// contains filtered or unexported fields
}

KoFi service handles Ko-Fi data

func NewKoFi

func NewKoFi(psdc *psd.Client, db *gorm.DB, matrix *Matrix, verificationToken string) *KoFi

NewKoFi creates a new KoFi service

func (*KoFi) AdjustServers

func (k *KoFi) AdjustServers(ctx context.Context)

AdjustServers is a cron job that finds transactions without servers and tries to identify their servers

func (*KoFi) CSV

func (k *KoFi) CSV(ctx context.Context, fileHeader *multipart.FileHeader) error

CSV handles Ko-Fi CSV files

func (*KoFi) Webhook

func (k *KoFi) Webhook(ctx context.Context, req *models.WebhookRequest) error

Webhook handles Ko-Fi webhooks

type Matrix

type Matrix struct {
	// contains filtered or unexported fields
}

func NewMatrix

func NewMatrix(lp *linkpearl.Linkpearl, host, paymentsRoom, ordersRoom string) *Matrix

NewMatrix creates a new Matrix service

func (*Matrix) NewPayment

func (m *Matrix) NewPayment(ctx context.Context, tx *models.Transaction, expectedPrice float64)

NewPayment sends a notice about a new payment

func (*Matrix) OverduePayments

func (m *Matrix) OverduePayments(ctx context.Context, servers map[string]time.Duration)

OverduePayments sends a notice about overdue payments of the specified servers

func (*Matrix) Start

func (m *Matrix) Start(ctx context.Context) error

Start starts the Matrix service

func (*Matrix) Stop

func (m *Matrix) Stop(ctx context.Context)

Stop stops the Matrix service

type Status

type Status struct {
	// contains filtered or unexported fields
}

Status service handles servers payment status

func NewStatus

func NewStatus(db *gorm.DB, psdc *psd.Client, kofi *KoFi, matrix *Matrix) *Status

NewStatus creates a new status service

func (*Status) CheckOverdue

func (s *Status) CheckOverdue()

CheckOverdue is a cron job that checks for overdue payments

func (*Status) Get

func (s *Status) Get(ctx context.Context, server string) (*models.Status, error)

Get returns the status of a server

func (*Status) GetAll

func (s *Status) GetAll(ctx context.Context) ([]*models.Status, error)

GetAll returns the status of all servers

func (*Status) GetGlobals

func (s *Status) GetGlobals(ctx context.Context) ([]*models.GlobalStatus, error)

GetGlobals returns the global status of the system

func (*Status) GetServers

func (s *Status) GetServers(ctx context.Context) (subscribable, nonsubscribable []string, err error)

GetServers returns a list of servers with Ko-Fi subscriptions

func (*Status) SaveGlobalStatus

func (s *Status) SaveGlobalStatus()

SaveGlobalStatus saves the global status of the system for the previous month to the database NOTE: IT IS IMPORTANT TO CALL THIS FUNCTION ON THE FIRST DAY OF THE MONTH (as early as possible)

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

Transaction service handles the business logic for transactions

func NewTransaction

func NewTransaction(db *gorm.DB) *Transaction

NewTransaction creates a new transaction service

func (*Transaction) GetAll

Jump to

Keyboard shortcuts

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