web

package
v1.1.0-17 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: MPL-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSessionServiceNotPresent ...
	ErrSessionServiceNotPresent = errors.New("Session service not present in the request context")
	// ErrClientNotPresent ...
	ErrClientNotPresent = errors.New("Client not present in the request context")
)
View Source
var (
	ErrPasswordMismatch = errors.New("Password confirmation mismatch")
	ErrInvalidPassword  = errors.New("Invalid password")
)
View Source
var (
	// ErrEmailInvalid
	ErrEmailInvalid = errors.New("Not a valid email")
)
View Source
var ErrIncorrectResponseType = errors.New("Response type not one of token or code")

ErrIncorrectResponseType a form value for response_type was not set to token or code

View Source
var (
	ErrTokenMissing = errors.New("Email confirmation token is missing")
)

Functions

This section is empty.

Types

type InitialState added in v1.0.5

type InitialState struct {
	ApplicationName string                `json:"applicationName"`
	ClientID        string                `json:"clientID"`
	UserGroup       string                `json:"usergroup"`
	Token           string                `json:"token"`
	Clients         []config.ClientConfig `json:"clients"`
	Profile         *Profile              `json:"profile"`
	Memberships     []Membership          `json:"memberships"`
	Shares          []Share               `json:"shares"`
	Products        []Product             `json:"products"`
	CSRFToken       string                `json:"csrfToken"`
}

func NewInitialState added in v1.0.5

func NewInitialState(
	cnf *config.Config,
	client *model.Client,
	user *model.User,
	userSession *session.UserSession,
	isUserAccountComplete bool,
	credits string,
	usergroups []*models.UserUserGroupPrivateResponse,
	memberships []Membership,
	shares []Share,
	products []Product,
	csrfToken string,
) *InitialState

type Membership

type Membership struct {
	SubscriptionID string    `json:"subscriptionID"`
	Name           string    `json:"name"` // ex: Listener membership
	DateFrom       time.Time `json:"dateFrom"`
	DateTo         time.Time `json:"dateTo"`
	Active         bool      `json:"active"`       // ex: active
	Contribution   string    `json:"contribution"` // ex: €5
}

Membership

type Product

type Product struct {
	Name        string   `json:"name"`
	Images      []string `json:"images"`
	Description string   `json:"description"`
	Quantity    int64    `json:"quantity"`
}

Product is a subset of stripe.Product

type Profile added in v1.0.5

type Profile struct {
	ID          string `json:"id"`
	Role        string `json:"role"`
	LegacyID    int32  `json:"legacyID"`
	DisplayName string `json:"displayName"`
	Email       string `json:"email"`
	Credits     string `json:"credits"`
	// FullName               string                                 `json:"fullName"`
	// FirstName              string                                 `json:"firstName"`
	// LastName               string                                 `json:"lastName"`
	Country                string                                 `json:"country"`
	NewsletterNotification bool                                   `json:"newsletterNotification"`
	EmailConfirmed         bool                                   `json:"emailConfirmed"`
	Member                 bool                                   `json:"member"`
	Complete               bool                                   `json:"complete"`
	Usergroups             []*models.UserUserGroupPrivateResponse `json:"usergroups"`
}

Profile user public profile

func NewProfile

func NewProfile(
	user *model.User,
	usergroups []*models.UserUserGroupPrivateResponse,
	isUserAccountComplete bool,
	credits string,
	role string,
) *Profile

NewProfile

type Service

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

Service struct keeps variables for reuse

func NewService

func NewService(cnf *config.Config, oauthService oauth.ServiceInterface, sessionService session.ServiceInterface) *Service

NewService returns a new Service instance

func (*Service) Close

func (s *Service) Close()

Close stops any running services

func (*Service) GetConfig

func (s *Service) GetConfig() *config.Config

GetConfig returns config.Config instance

func (*Service) GetOauthService

func (s *Service) GetOauthService() oauth.ServiceInterface

GetOauthService returns oauth.Service instance

func (*Service) GetRoutes

func (s *Service) GetRoutes() []routes.Route

GetRoutes returns []routes.Route slice for the health service

func (*Service) GetSessionService

func (s *Service) GetSessionService() session.ServiceInterface

GetSessionService returns session.Service instance

func (*Service) NewMembership

func (s *Service) NewMembership(subscription *stripe.Subscription) Membership

NewMembership

func (*Service) NewProduct

func (*Service) NewProduct(p *stripe.Product, quantity int64) Product

New product creates new Product based on stripe.Product

func (*Service) NewShare

func (s *Service) NewShare(invoice *stripe.Invoice, invoiceLine *stripe.InvoiceLine) Share

NewShare

func (*Service) RegisterRoutes

func (s *Service) RegisterRoutes(router *mux.Router, prefix string)

RegisterRoutes registers route handlers for the health service

type ServiceInterface

type ServiceInterface interface {
	// Exported methods
	GetConfig() *config.Config
	GetOauthService() oauth.ServiceInterface
	GetSessionService() session.ServiceInterface
	GetRoutes() []routes.Route
	RegisterRoutes(router *mux.Router, prefix string)
	Close()
	// contains filtered or unexported methods
}

ServiceInterface defines exported methods

type Share

type Share struct {
	Amount        int64     `json:"amount"`
	DatePurchased time.Time `json:"datePurchased"`
}

Share

Jump to

Keyboard shortcuts

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