customer

package
v1.0.0-beta.184 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

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 Config

type Config struct {
	Repository Repository
}

func (*Config) Validate

func (c *Config) Validate() error

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"`
	UsageAttribution  CustomerUsageAttribution  `json:"usageAttribution"`
	PrimaryEmail      *string                   `json:"primaryEmail"`
	Currency          *models.CurrencyCode      `json:"currency"`
	BillingAddress    *models.Address           `json:"billingAddress"`
	TaxProvider       *models.TaxProvider       `json:"taxProvider"`
	InvoicingProvider *models.InvoicingProvider `json:"invoicingProvider"`
	PaymentProvider   *models.PaymentProvider   `json:"paymentProvider"`
	External          *CustomerExternalMapping  `json:"external"`
}

Customer represents a 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

type GetCustomerInput

type GetCustomerInput CustomerID

GetCustomerInput represents the input for the GetCustomer method

type ListCustomersInput

type ListCustomersInput struct {
	Namespace string
	pagination.Page

	IncludeDisabled 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 Config) (Service, error)

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
	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