svc

package
v0.0.0-...-37c696c Latest Latest
Warning

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

Go to latest
Published: May 21, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TxExpireDuration is the time uncaptured transactions and unrefunded captures expire.
	TxExpireDuration = 5 * time.Minute
)

Variables

This section is empty.

Functions

func IsPositive

func IsPositive(amt float64) bool

IsPositive checks if a given float64 value is positive, excluding NaN and infinity.

Types

type Service

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

Service is our main prepaid card service.

func New

func New(ctx context.Context, logger *log.Logger) (*Service, error)

New creates a new Service.

func (*Service) ApiGW

func (se *Service) ApiGW(data interface{}, err error) (events.APIGatewayProxyResponse, error)

ApiGW converts an (interface{},error) pair to an (APIGatewayProxyResponse,error) pair. All errors are converted to HTTP 500s and logged.

func (*Service) CardStatement

func (se *Service) CardStatement(id string) (*model.CardStatement, error)

CardStatement returns a card statement.

func (*Service) CardStatus

func (se *Service) CardStatus(id string) (*model.CardStatus, error)

CardStatus returns info about a card.

func (*Service) CardTopup

func (se *Service) CardTopup(id string, amt float64) (*model.CardStatus, error)

CardTopup tops up a card with amt funds.

func (*Service) NewCard

func (se *Service) NewCard(initialAmount float64) (*model.CardStatus, error)

NewCard creates a new card, loaded with initialAmount of funds.

func (*Service) NewTx

func (se *Service) NewTx(cardID string, amt float64, merchant string) (*model.TxStatus, error)

NewTx creates a new transaction on card cardID, blocking amt funds for merchant.

func (*Service) TxCapture

func (se *Service) TxCapture(id string, amt float64) (*model.TxStatus, error)

TxCapture captures part of a transaction, spending amt funds from card.

func (*Service) TxCleanup

func (se *Service) TxCleanup() error

TxCleanup scans expired transactions and refunds blocked amount to prepaid cards.

func (*Service) TxRefund

func (se *Service) TxRefund(id string, amt float64) (*model.TxStatus, error)

TxRefund refunds part of a fully-captured transaction, refunding amt funds to card.

func (*Service) TxReverse

func (se *Service) TxReverse(id string, amt float64) (*model.TxStatus, error)

TxReverse reverses part of a transaction, unblocking amt funds.

func (*Service) TxStatus

func (se *Service) TxStatus(id string) (*model.TxStatus, error)

TxStatus returns info about a transaction.

Jump to

Keyboard shortcuts

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