fee

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package fee provides access to the club fee of the Buddy System.

Package fee provides access to the club fee of the Buddy System.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicatedFee   = errors.New("duplicated fee")
	ErrAlreadyExempted = errors.New("already exempted")
)

Functions

func Amount

func Amount(year, semester int, id string) (amount int, err error)

Amount returns the amount of payments of member of id.

NOTE:

It is a member-limited operation:

Only the authenticated members can access to this operation.

func Deposit

func Deposit(year, semester, amount int, description string) error

Deposit makes a new log with amount and append it to fee with year of YEAR, semester of SEMESTER.

Note:

It is a privileged operation:

Only the club managers can access to this operation.

func Pay

func Pay(year, semester int, ids []string, amounts []int) error

Pay registers payments of members of ids for each amount of amounts.

Note:

It is a privileged operation:

Only the club managers can access to this operation.

Types

type Fee

type Fee struct {
	Year      int                  `json:"year" bson:"year"`
	Semester  int                  `json:"semester" bson:"semester"`
	CarryOver int                  `json:"carry_over" bson:"carry_over"`
	Amount    int                  `json:"amount" bson:"amount"`
	Logs      []primitive.ObjectID `json:"logs" bson:"logs"`
}

Fee represents a club fee state.

func New

func New(year, semester, carryOver, amount int) *Fee

New returns a new club fee.

func (Fee) Create

func (f Fee) Create() (err error)

Create creates a new fee history.

NOTE:

It is a privileged operation:

Only the club managers can access to this operation.

func (*Fee) Deptors

func (f *Fee) Deptors() (deptors member.Members, depts []int, err error)

Deptors returns the list of members who did not pay the fee of year and semester.

NOTE:

It is a privileged operation:

Only the club managers can access to this operation.

func (*Fee) Exempt

func (f *Fee) Exempt(id string) error

Exempt exempts the member of id from the fee of year and semester.

Note :

It is a privileged operation:

Only the club managers can access to this operation.

func (*Fee) Payers

func (f *Fee) Payers() (members member.Members, err error)

Payers returns the list of members who paid the fee of year and semester.

NOTE:

It is a privileged operation:

Only the club managers can access to this operation.

func (*Fee) Search

func (f *Fee) Search() (carryOver int, _ []map[string]interface{}, total int, err error)

Search returns the fee history of year and semester.

NOTE:

It is a member-limited operation:

Only the authenticated members can access to this operation.

type Log

type Log struct {
	ID          primitive.ObjectID `json:"id" bson:"_id"`
	MemberID    string             `json:"member_id" bson:"member_id"`
	Description string             `json:"description" bson:"description"`
	Amount      int                `json:"amount" bson:"amount"`
	Type        int                `json:"type" bson:"type"`
	CreatedAt   int64              `json:"created_at,string" bson:"created_at"`
}

Log represents a fees history.

func NewLog

func NewLog(memberID, description string, amount, typ int) *Log

NewLog returns a new fee log.

func (Log) Public

func (l Log) Public() map[string]interface{}

Public returns the limited information of l.

type Logs

type Logs []Log

func (Logs) Public

func (ls Logs) Public() []map[string]interface{}

Public returns the limited information of ls.

Jump to

Keyboard shortcuts

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