customer

package
v1.0.0-beta.186 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IncludeDeleted    = false
	DefaultPageNumber = 1
	DefaultPageSize   = 100
)

Variables

This section is empty.

Functions

func WithTx

func WithTx[T any](ctx context.Context, repo Repository, fn func(ctx context.Context, repo TxRepository) (T, error)) (resp T, err error)

func WithTxNoValue

func WithTxNoValue(ctx context.Context, repo Repository, fn func(ctx context.Context, repo TxRepository) error) error

Types

type CreateCustomerInput

type CreateCustomerInput struct {
	Namespace string
	Customer
}

CreateCustomerInput represents the input for the CreateCustomer method

func (CreateCustomerInput) Validate

func (i CreateCustomerInput) Validate(_ context.Context, _ Service) error

type Customer

type Customer struct {
	models.ManagedResource

	Name             string                   `json:"name"`
	Timezone         *timezone.Timezone       `json:"timezone"`
	UsageAttribution CustomerUsageAttribution `json:"usageAttribution"`
	PrimaryEmail     *string                  `json:"primaryEmail"`
	Currency         *currencyx.Code          `json:"currency"`
	BillingAddress   *models.Address          `json:"billingAddress"`
	External         *CustomerExternalMapping `json:"external"`
}

Customer represents a customer

func (Customer) AsAPICustomer

func (c Customer) AsAPICustomer() (api.Customer, error)

AsAPICustomer converts a Customer to an API Customer

type CustomerExternalMapping

type CustomerExternalMapping struct {
	StripeCustomerID *string `json:"stripeCustomerID"`
}

CustomerExternalMapping represents the external mapping for a customer

type CustomerID

type CustomerID models.NamespacedID

func (CustomerID) Validate

func (i CustomerID) Validate() error

type CustomerRepository

type CustomerRepository interface {
	ListCustomers(ctx context.Context, params ListCustomersInput) (pagination.PagedResponse[Customer], error)
	CreateCustomer(ctx context.Context, params CreateCustomerInput) (*Customer, error)
	DeleteCustomer(ctx context.Context, customer DeleteCustomerInput) error
	GetCustomer(ctx context.Context, customer GetCustomerInput) (*Customer, error)
	UpdateCustomer(ctx context.Context, params UpdateCustomerInput) (*Customer, error)
}

type CustomerService

type CustomerService interface {
	ListCustomers(ctx context.Context, params ListCustomersInput) (pagination.PagedResponse[Customer], error)
	CreateCustomer(ctx context.Context, params CreateCustomerInput) (*Customer, error)
	DeleteCustomer(ctx context.Context, customer DeleteCustomerInput) error
	GetCustomer(ctx context.Context, customer GetCustomerInput) (*Customer, error)
	UpdateCustomer(ctx context.Context, params UpdateCustomerInput) (*Customer, error)
}

type CustomerUsageAttribution

type CustomerUsageAttribution struct {
	SubjectKeys []string
}

CustomerUsageAttribution represents the usage attribution for a customer

type DeleteCustomerInput

type DeleteCustomerInput CustomerID

DeleteCustomerInput represents the input for the DeleteCustomer method

func (DeleteCustomerInput) Validate

func (i DeleteCustomerInput) Validate() error

type GetCustomerInput

type GetCustomerInput CustomerID

GetCustomerInput represents the input for the GetCustomer method

func (GetCustomerInput) Validate

func (i GetCustomerInput) Validate() error

type ListCustomersInput

type ListCustomersInput struct {
	Namespace string
	pagination.Page

	IncludeDeleted bool
}

ListCustomersInput represents the input for the ListCustomers method

type NotFoundError

type NotFoundError struct {
	CustomerID
}

func (NotFoundError) Error

func (e NotFoundError) Error() string

type Repository

type Repository interface {
	CustomerRepository

	WithTx(context.Context) (TxRepository, error)
}

type Service

type Service interface {
	CustomerService
}

func NewService

func NewService(c ServiceConfig) (Service, error)

type ServiceConfig

type ServiceConfig struct {
	Repository Repository
}

func (*ServiceConfig) Validate

func (c *ServiceConfig) Validate() error

type SubjectKeyConflictError

type SubjectKeyConflictError struct {
	Namespace   string   `json:"namespace"`
	SubjectKeys []string `json:"subjectKeys"`
}

SubjectKeyConflictError represents an error when a subject key is already associated with a customer

func (SubjectKeyConflictError) Error

func (e SubjectKeyConflictError) Error() string

type TxRepository

type TxRepository interface {
	CustomerRepository

	Commit() error
	Rollback() error
}

type UpdateAfterDeleteError

type UpdateAfterDeleteError genericError

func (UpdateAfterDeleteError) Error

func (e UpdateAfterDeleteError) Error() string

func (UpdateAfterDeleteError) Unwrap

func (e UpdateAfterDeleteError) Unwrap() error

type UpdateCustomerInput

type UpdateCustomerInput struct {
	Namespace string
	ID        string
	Customer
}

UpdateCustomerInput represents the input for the UpdateCustomer method

func (UpdateCustomerInput) Validate

func (i UpdateCustomerInput) Validate(_ context.Context, _ Service) error

type ValidationError

type ValidationError genericError

func (ValidationError) Error

func (e ValidationError) Error() string

func (ValidationError) Unwrap

func (e ValidationError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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