application

package
v0.0.0-...-3ee0b18 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consensus

type Consensus interface {
	Apply(cmd []byte, timeout time.Duration) (err error)
	GetServers(ctx context.Context) ([]*api.Server, error)
}

type Distributed

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

func New

func New(consensus Consensus, publisher ddd.EventPublisher[ddd.Event], paymentsRepo PaymentsRepository,
	invoicesRepo InvoicesRepository, log *logger.Logger) *Distributed

func (*Distributed) CancelPayment

func (m *Distributed) CancelPayment(ctx context.Context, id, userID int64) (err error)

func (*Distributed) CreateInvoice

func (m *Distributed) CreateInvoice(ctx context.Context, id string, userID int64, total int64, metadata []byte, cart *api.Cart) (err error)

func (*Distributed) GetInvoice

func (m *Distributed) GetInvoice(ctx context.Context, id string, userID int64) (invoice *api.Invoice, err error)

func (*Distributed) GetPayment

func (m *Distributed) GetPayment(ctx context.Context, id, userID int64) (payment *model.Payment, err error)

func (*Distributed) GetServers

func (m *Distributed) GetServers(ctx context.Context) ([]*api.Server, error)

func (*Distributed) ProceedPayment

func (m *Distributed) ProceedPayment(ctx context.Context, id, userID int64) (err error)

func (*Distributed) RefundPayment

func (m *Distributed) RefundPayment(ctx context.Context, id, userID int64) (err error)

func (*Distributed) StartPayment

func (m *Distributed) StartPayment(ctx context.Context, id, userID int64, invoiceID string, currency string, total int64, metadata []byte) (err error)

type InvoicesRepository

type InvoicesRepository interface {
	GetInvoice(ctx context.Context, id string, userID int64) (invoice *api.Invoice, err error)
}

type PaymentsRepository

type PaymentsRepository interface {
	GetPayment(ctx context.Context, id, userID int64) (payment *model.Payment, err error)
}

TODO: can we return *api.Payment directly from repo w/o model conversion?

Jump to

Keyboard shortcuts

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