application

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreditCardProcessor

type CreditCardProcessor interface {
	Auth(amount float64) error
	Capture(amount float64) error
}

CreditCardProcessor allows to auth and eventually capture an amount float64 is used as an example here

type Service

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

Service defines our example application service

func (*Service) Inject

func (s *Service) Inject(logger TransactionLog, processor CreditCardProcessor) *Service

Inject dependencies for our service

func (*Service) MakeTransaction

func (s *Service) MakeTransaction(amount float64, message string) error

MakeTransaction tries to authorize and capture an amount, and logs these steps.

type TransactionLog

type TransactionLog interface {
	Log(id, message string)
}

TransactionLog logs information with a unique id and a message

Jump to

Keyboard shortcuts

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