Documentation
¶
Index ¶
- Constants
- func IsPositive(amt float64) bool
- type Service
- func (se *Service) ApiGW(data interface{}, err error) (events.APIGatewayProxyResponse, error)
- func (se *Service) CardStatement(id string) (*model.CardStatement, error)
- func (se *Service) CardStatus(id string) (*model.CardStatus, error)
- func (se *Service) CardTopup(id string, amt float64) (*model.CardStatus, error)
- func (se *Service) NewCard(initialAmount float64) (*model.CardStatus, error)
- func (se *Service) NewTx(cardID string, amt float64, merchant string) (*model.TxStatus, error)
- func (se *Service) TxCapture(id string, amt float64) (*model.TxStatus, error)
- func (se *Service) TxCleanup() error
- func (se *Service) TxRefund(id string, amt float64) (*model.TxStatus, error)
- func (se *Service) TxReverse(id string, amt float64) (*model.TxStatus, error)
- func (se *Service) TxStatus(id string) (*model.TxStatus, error)
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 ¶
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 (*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) NewCard ¶
func (se *Service) NewCard(initialAmount float64) (*model.CardStatus, error)
NewCard creates a new card, loaded with initialAmount of funds.
func (*Service) NewTx ¶
NewTx creates a new transaction on card cardID, blocking amt funds for merchant.
func (*Service) TxCleanup ¶
TxCleanup scans expired transactions and refunds blocked amount to prepaid cards.
func (*Service) TxRefund ¶
TxRefund refunds part of a fully-captured transaction, refunding amt funds to card.
Click to show internal directories.
Click to hide internal directories.