invoicesservice

package
v0.0.0-...-e2d33fb Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvoiceNotFoundByID = func(invoiceID uuid.UUID) error {
		return fmt.Errorf("invoice not found by id = %q", invoiceID.String())
	}

	ErrInvoiceNotFoundByAddress = func(address string) error {
		return fmt.Errorf("invoice not found by address = %q", address)
	}

	ErrInvoiceAlreadyCompleted = errors.New("invoice is already completed")
)

Functions

This section is empty.

Types

type CreateInvoiceInput

type CreateInvoiceInput struct {
	ClientID       uuid.UUID
	UsdCentsAmount int64
}

func CreateInvoiceInputFromRequest

func CreateInvoiceInputFromRequest(req *desc.CreateInvoiceRequest) (*CreateInvoiceInput, error)

type ExternalAPI

type ExternalAPI interface {
	GetPrice(ctx context.Context, in *external_api.GetPriceRequest, opts ...grpc.CallOption) (*external_api.GetPriceResponse, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(
	ctx context.Context,
	storage Storage,
	cryptoServiceClient CryptoServiceClient,
	externalAPI ExternalAPI,
) *Service

func (*Service) CheckInvoice

func (s *Service) CheckInvoice(ctx context.Context, invoiceIDStr string) (*models.Invoice, error)

func (*Service) CreateInvoice

func (s *Service) CreateInvoice(ctx context.Context, input *CreateInvoiceInput) (*models.Invoice, error)

func (*Service) ListInvoices

func (s *Service) ListInvoices(ctx context.Context, reqFilter *desc.ListInvoicesRequest_Filter) ([]*models.Invoice, error)

func (*Service) UpdateInvoice

func (s *Service) UpdateInvoice(ctx context.Context, input *UpdateInvoiceInput) (*models.Invoice, error)

type Storage

type Storage interface {
	CreateInvoice(ctx context.Context, invoice *models.Invoice) (*models.Invoice, error)
	ListInvoices(ctx context.Context, filter storage.ListInvoicesFilter) ([]*models.Invoice, error)
	UpdateInvoice(ctx context.Context, invoice *models.Invoice) (*models.Invoice, error)
}

type UpdateInvoiceInput

type UpdateInvoiceInput struct {
	InvoiceID     uuid.UUID
	Chain         string
	Token         string
	PayerClientID *string
}

func UpdateInvoiceInputFromRequest

func UpdateInvoiceInputFromRequest(req *desc.UpdateInvoiceRequest) (*UpdateInvoiceInput, error)

Jump to

Keyboard shortcuts

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