Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPlan ¶
func AddPlan(plan BillingPlan)
Types ¶
type AdminServices ¶
type AdminServices interface {
LogRequests(reqs []model.APIRequest) error
}
AdminServices TODO: investigate this...
type BillingFlags ¶
type BillingFlags int
BillingFlags is used to set which integrations a plan is authorize to use
type BillingPlan ¶
type BillingPlan struct { ID string `json:"id"` StripeID string `json:"stripeId"` Name string `json:"name"` Version string `json:"version"` Price float32 `json:"price"` YearlyPrice float32 `json:"yearly"` Params map[string]interface{} `json:"params"` }
BillingPlan defines what one plan to have access to and set limitations
func GetPlans ¶
func GetPlans(v string) []BillingPlan
GetPlans returns a slice of the desired version plans
func GetPlansVersion ¶
func GetPlansVersion(plan string, defaultVersion string) []BillingPlan
GetPlansVersion returns a slice of the plans matching a current plan
type DB ¶
type DB struct { // DatabaseName is the name of the database used. DatabaseName string // Connection is the reference to the database connection. Connection *sql.DB // Users contains the data access functions related to account, user and billing. Users UserServices // Webhooks contains the data access functions related to managing Webhooks. Webhooks WebhookServices }
DB is a database agnostic abstraction that contains a reference to the database connection.
At this moment Postgres and an in-memory data provider are supported.
type UserServices ¶
type UserServices interface { SignUp(email, password string) (*model.Account, error) ChangePassword(id, accountID int64, passwd string) error AddToken(accountID, userID int64, name string) (*model.AccessToken, error) RemoveToken(accountID, userID, tokenID int64) error Auth(accountID int64, token string, pat bool) (*model.Account, *model.User, error) GetUserByEmail(email string) (*model.User, error) GetDetail(id int64) (*model.Account, error) GetByStripe(stripeID string) (*model.Account, error) SetSeats(id int64, seats int) error ConvertToPaid(id int64, stripeID, subID, plan string, yearly bool, seats int) error ChangePlan(id int64, plan string, yearly bool) error Cancel(id int64) error }
UserServices is an interface that contians all functions related to account, user and billing.
type WebhookServices ¶
type WebhookServices interface { Add(accountID int64, events, url string) error List(accountID int64) ([]model.Webhook, error) Delete(accountID int64, event, url string) error AllSubscriptions(event string) ([]model.Webhook, error) }
WebhookServices is an interface that contains all functions to manage webhook.
Click to show internal directories.
Click to hide internal directories.