card

package
v0.0.0-...-9192568 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalid  = errors.New("passed card data is invalid")
	ErrNotFound = errors.New("requested card data not found")
)

Functions

This section is empty.

Types

type Card

type Card struct {
	UID     string `json:"-"`
	ID      string `json:"id"`
	Name    string `json:"name"`
	Number  string `json:"number"`
	Holder  string `json:"holder"`
	ExpDate string `json:"exp_date"`
	CVV     string `json:"cvv"`
	Note    string `json:"note"`
}

type Service

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

func NewService

func NewService(dataService data.Service) Service

NewService returns an instance of the Service with pre-defined data microservice.

func (Service) DeleteCard

func (s Service) DeleteCard(ctx context.Context, uid, id string) error

DeleteCard removes the stored data with the unique ID. The method removes the data of the specified user only.

func (Service) GetAllCards

func (s Service) GetAllCards(ctx context.Context, uid string) ([]Card, error)

GetAllCards returns all the user's stored cards.

func (Service) GetCardByID

func (s Service) GetCardByID(ctx context.Context, uid, id string) (Card, error)

GetCardByID returns the stored data by the unique ID. The method returns the data of the specified user only.

func (Service) StoreCard

func (s Service) StoreCard(ctx context.Context, card Card) (string, error)

StoreCard stores the original card via the associated data microservice.

Jump to

Keyboard shortcuts

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