34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package billing
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
// Noop returns a billing service for binaries that depend on network.Service
|
|
// but never mutate membership (jobs, pusher). Stripe isn't configured.
|
|
func Noop() Service { return noopService{} }
|
|
|
|
type noopService struct{}
|
|
|
|
var errNoopBilling = errors.New("billing: not configured in this process")
|
|
|
|
func (noopService) GetStatus(context.Context, string) (*Status, error) {
|
|
return nil, errNoopBilling
|
|
}
|
|
func (noopService) CreateCheckoutSession(context.Context, CheckoutParams) (string, error) {
|
|
return "", errNoopBilling
|
|
}
|
|
func (noopService) CreatePortalSession(context.Context, string) (string, error) {
|
|
return "", errNoopBilling
|
|
}
|
|
func (noopService) SyncSeats(context.Context, string, int) error { return nil }
|
|
func (noopService) HandleWebhook(context.Context, []byte, string) error { return errNoopBilling }
|
|
func (noopService) GetUsage(context.Context, string) (*Usage, error) {
|
|
return nil, errNoopBilling
|
|
}
|
|
func (noopService) IncrementDailyUsage(context.Context, string, time.Time) error {
|
|
return errNoopBilling
|
|
}
|