cmdpricing

package
v0.0.0-...-122f59b Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const SafeOffset = 1 * time.Second

SafeOffset is introduced to work around a weird bug of Stripe. When the subscription has its first invoice issued, It is an error to create an usage record of timestamp equal to current_period_start. So we add a 1-second offset to ensure the timestamp is WITHIN the current period.

Variables

Functions

func NewClientAPI

func NewClientAPI(stripeConfig *portalconfig.StripeConfig, logger Logger) *client.API

func ToStripeConvention

func ToStripeConvention(t time.Time) *int64

Types

type Logger

type Logger struct{ *log.Logger }

func NewLogger

func NewLogger(lf *log.Factory) Logger

type StripeService

type StripeService struct {
	ClientAPI   *client.API
	Handle      *globaldb.Handle
	SQLBuilder  *globaldb.SQLBuilder
	SQLExecutor *globaldb.SQLExecutor
	Store       *configsource.Store
	Clock       clock.Clock
	Logger      Logger
}

func NewStripeService

func NewStripeService(ctx context.Context, pool *db.Pool, databaseCredentials *config.DatabaseCredentials, stripeConfig *config2.StripeConfig, hub *sentry.Hub) *StripeService

func (*StripeService) ListAppIDs

func (s *StripeService) ListAppIDs() (appIDs []string, err error)

func (*StripeService) UploadUsage

func (s *StripeService) UploadUsage(ctx context.Context, appID string) (err error)

Jump to

Keyboard shortcuts

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