invoice

package
v0.32.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = fmt.Errorf("invoice not found")
	ErrInvalidDetail = fmt.Errorf("invalid invoice detail")
)

Functions

This section is empty.

Types

type CustomerService

type CustomerService interface {
	GetByID(ctx context.Context, id string) (customer.Customer, error)
	List(ctx context.Context, filter customer.Filter) ([]customer.Customer, error)
}

type Filter

type Filter struct {
	CustomerID  string
	NonZeroOnly bool

	Pagination *pagination.Pagination
}

type Invoice

type Invoice struct {
	ID            string
	CustomerID    string
	ProviderID    string
	State         string
	Currency      string
	Amount        int64
	HostedURL     string
	DueAt         time.Time
	EffectiveAt   time.Time
	CreatedAt     time.Time
	PeriodStartAt time.Time
	PeriodEndAt   time.Time

	Metadata metadata.Metadata
}

type Repository added in v0.8.26

type Repository interface {
	Create(ctx context.Context, invoice Invoice) (Invoice, error)
	GetByID(ctx context.Context, id string) (Invoice, error)
	List(ctx context.Context, filter Filter) ([]Invoice, error)
	UpdateByID(ctx context.Context, invoice Invoice) (Invoice, 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, invoiceRepository Repository,
	customerService CustomerService, cfg billing.Config) *Service

func (*Service) Close added in v0.8.26

func (s *Service) Close() error

func (*Service) DeleteByCustomer added in v0.8.35

func (s *Service) DeleteByCustomer(ctx context.Context, c customer.Customer) error

func (*Service) GetUpcoming

func (s *Service) GetUpcoming(ctx context.Context, customerID string) (Invoice, error)

func (*Service) Init added in v0.8.26

func (s *Service) Init(ctx context.Context) error

func (*Service) List

func (s *Service) List(ctx context.Context, filter Filter) ([]Invoice, error)

List currently queries stripe for invoices, but it should be refactored to query our own database

func (*Service) ListAll added in v0.8.26

func (s *Service) ListAll(ctx context.Context, filter Filter) ([]Invoice, error)

ListAll should only be called by admin users

func (*Service) SyncWithProvider added in v0.8.26

func (s *Service) SyncWithProvider(ctx context.Context, customr customer.Customer) error

Jump to

Keyboard shortcuts

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