Documentation ¶
Overview ¶
Package payment provides the use-case of payments management. Used by views facing an administrator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidArgument = errors.New("invalid argument")
ErrInvalidArgument is returned when one or more arguments are invalid.
Functions ¶
Types ¶
type ErrorResp ¶
type ErrorResp struct {
Error error `json:"error"`
}
func (*ErrorResp) MarshalJSON ¶
func (*ErrorResp) StatusCode ¶
type Payment ¶
type Payment struct { ID wallet.PaymentID `json:"id"` Account wallet.AccountID `json:"account"` ToAccount wallet.AccountID `json:"to_account"` FromAccount wallet.AccountID `json:"from_account"` Amount wallet.Money `json:"amount"` Direction wallet.PaymentDirection `json:"direction"` CreatedAt time.Time `json:"created_at"` IdempotencyKey uuid.UUID `json:"-"` }
Payment is a read model for payment views.
type Service ¶
type Service interface { // List shows all available payments List(ctx context.Context) ([]Payment, error) // One shows payment details One(ctx context.Context, id wallet.PaymentID) (Payment, error) // Perform creates payment object and cares about money transfer Perform(ctx context.Context, idempotencyKey uuid.UUID, payment *wallet.Payment) (Payment, error) }
Service provides payment related methods.
func NewInstrumenting ¶
NewInstrumenting returns an instance of an instrumenting Service.
func NewLoggingService ¶
NewLoggingService returns a new instance of a logging Service.
func NewService ¶
func NewService(logger log.Logger, db *pg.DB, payments wallet.PaymentRepository, accounts wallet.AccountRepository) Service
NewService service constructor
Click to show internal directories.
Click to hide internal directories.