publisher

package
v0.0.0-...-553ec8c Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNilConfig = errors.New("cannot override nil config")

Functions

This section is empty.

Types

type Config

type Config struct {
	MonitorProcessTopic       string        `yaml:"monitor_process_topic"`
	PaymentProccessingTime    time.Duration `yaml:"payment_processing_time"`
	SucceededTransactionTopic string        `yaml:"succeeded_transaction_topic"`
	FailedTransactionTopic    string        `yaml:"failed_transaction_topic"`
}

Config represents publisher configuration parameters.

type PaymentWorker

type PaymentWorker interface {
	Start(context.Context) error
	Stop(StopReason) error
}

PaymentWorker defines the behavior of a worker responsible for processing payments.

func NewWorker

func NewWorker(
	cfg *Config,
	log logger.Logger,
	g gateway.PaymentGateway,
	pub message.Publisher,
) (PaymentWorker, error)

NewWorker creates a new paymentWorker instance.

type ProccessPaymentError

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

ProcessPaymentError represents an error type associated with payment processing.

func NewProccessPaymentError

func NewProccessPaymentError(msg string, err error) *ProccessPaymentError

NewProcessPaymentError creates a new instance of ProcessPaymentError with the given message and error.

func (ProccessPaymentError) Error

func (e ProccessPaymentError) Error() string

type StartError

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

StartError represents an error encountered during start payment worker.

func NewStartError

func NewStartError(msg string, err error) *StartError

NewStartError creates a new instance of StartError with the given message and error.

func (StartError) Error

func (e StartError) Error() string

type StopReason

type StopReason int

StopReason represents the reason for stopping a PaymentWorker.

const (
	Undefined StopReason = iota
	CancelledTransaction
	Shutdown
)

type WorkerError

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

WorkerError represents an error encountered during creation payment worker.

func NewWorkerError

func NewWorkerError(msg string, err error) *WorkerError

NewWorkerError creates a new instance of WorkerError with the given message and error.

func (WorkerError) Error

func (e WorkerError) Error() string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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