Documentation ¶
Index ¶
- Constants
- Variables
- func NewClientAPI(stripeConfig *portalconfig.StripeConfig, logger Logger) *client.API
- func NewGlobalDatabaseCredentials(dbCredentials *config.DatabaseCredentials) *config.GlobalDatabaseCredentialsEnvironmentConfig
- func ToStripeConvention(t time.Time) *int64
- type Logger
- type StripeService
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 ¶
View Source
var DependencySet = wire.NewSet( cobrasentry.NewLoggerFactory, config.NewDefaultDatabaseEnvironmentConfig, NewGlobalDatabaseCredentials, globaldb.DependencySet, clock.DependencySet, NewClientAPI, NewLogger, wire.Struct(new(configsource.Store), "*"), wire.Struct(new(StripeService), "*"), )
Functions ¶
func NewClientAPI ¶
func NewClientAPI(stripeConfig *portalconfig.StripeConfig, logger Logger) *client.API
func NewGlobalDatabaseCredentials ¶
func NewGlobalDatabaseCredentials(dbCredentials *config.DatabaseCredentials) *config.GlobalDatabaseCredentialsEnvironmentConfig
func ToStripeConvention ¶
Types ¶
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)
Click to show internal directories.
Click to hide internal directories.