Documentation ¶
Index ¶
- Constants
- Variables
- func GetStripeTestClockFromContext(ctx context.Context) (string, bool)
- func GetStripeWebhookSignatureFromContext(ctx context.Context) (string, bool)
- func SetStripeTestClockInContext(ctx context.Context, s string) context.Context
- func SetStripeWebhookSignatureInContext(ctx context.Context, s string) context.Context
- type Address
- type Customer
- type Filter
- type PaymentMethod
- type Provider
- type Repository
- type Service
- func (s *Service) Close() error
- func (s *Service) Create(ctx context.Context, customer Customer, offline bool) (Customer, error)
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) Disable(ctx context.Context, id string) error
- func (s *Service) Enable(ctx context.Context, id string) error
- func (s *Service) GetByID(ctx context.Context, id string) (Customer, error)
- func (s *Service) GetByOrgID(ctx context.Context, orgID string) (Customer, error)
- func (s *Service) Init(ctx context.Context) error
- func (s *Service) List(ctx context.Context, filter Filter) ([]Customer, error)
- func (s *Service) ListPaymentMethods(ctx context.Context, id string) ([]PaymentMethod, error)
- func (s *Service) RegisterToProvider(ctx context.Context, customer Customer) (*stripe.Customer, error)
- func (s *Service) RegisterToProviderIfRequired(ctx context.Context, customerID string) (Customer, error)
- func (s *Service) SyncWithProvider(ctx context.Context, customr Customer) error
- func (s *Service) TriggerSyncByProviderID(ctx context.Context, id string) error
- func (s *Service) Update(ctx context.Context, customer Customer) (Customer, error)
- type State
- type Tax
Constants ¶
View Source
const (
SyncDelay = time.Second * 60
)
Variables ¶
View Source
var ( ErrNotFound = errors.New("customer not found") ErrInvalidUUID = errors.New("invalid syntax of uuid") ErrInvalidID = errors.New("billing customer id is invalid") ErrConflict = errors.New("customer already exist") ErrInvalidDetail = errors.New("invalid billing customer detail") ErrDisabled = errors.New("billing customer is disabled") )
Functions ¶
func GetStripeTestClockFromContext ¶ added in v0.8.29
GetStripeTestClockFromContext returns the stripe test clock id from the context
func GetStripeWebhookSignatureFromContext ¶ added in v0.13.0
func SetStripeTestClockInContext ¶ added in v0.8.29
SetStripeTestClockInContext sets the stripe test clock id in the context
Types ¶
type Customer ¶
type Customer struct { ID string OrgID string // Provider id identifier set by the billing engine provider // could be empty if the customer is created as offline ProviderID string Name string Email string Phone string Address Address TaxData []Tax // Currency Three-letter ISO 4217 currency code in lower case Currency string `default:"usd"` Metadata metadata.Metadata // Stripe specific fields // StripeTestClockID is used for testing purposes only to simulate a subscription StripeTestClockID *string State State CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time }
type PaymentMethod ¶ added in v0.8.13
type Repository ¶
type Repository interface { GetByID(ctx context.Context, id string) (Customer, error) List(ctx context.Context, filter Filter) ([]Customer, error) Create(ctx context.Context, customer Customer) (Customer, error) UpdateByID(ctx context.Context, customer Customer) (Customer, error) Delete(ctx context.Context, id string) error }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(stripeClient *client.API, repository Repository) *Service
func (*Service) GetByOrgID ¶
func (*Service) ListPaymentMethods ¶ added in v0.8.13
func (*Service) RegisterToProvider ¶ added in v0.17.0
func (*Service) RegisterToProviderIfRequired ¶ added in v0.17.0
func (*Service) SyncWithProvider ¶ added in v0.9.0
SyncWithProvider syncs the customer state with the billing provider
func (*Service) TriggerSyncByProviderID ¶ added in v0.13.0
Click to show internal directories.
Click to hide internal directories.