Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrValidation = fmt.Errorf("validation error") ErrGenerateToken = fmt.Errorf("token generate error") ErrDBPersist = fmt.Errorf("persist to database error") ErrTokenNotFound = fmt.Errorf("token not found in database") )
--- list of error and constants
Functions ¶
func RegisterHandlers ¶
func RegisterHandlers(r *routing.RouteGroup, service Service, authHandler routing.Handler, logger log.Logger)
RegisterHandlers sets up the routing of the HTTP handlers.
Types ¶
type Repository ¶
type Repository interface { // Get returns the customer's token information with the specified token string. Get(ctx context.Context, token string) (entity.PayToken, error) // GetPayTokens return all payment token belong to a customer. GetPayTokens(ctx context.Context, customer_id string) ([]entity.PayToken, error) // GetTodayPayToken return a token that still valid and not expire with the specified today date. GetTodayPayToken(ctx context.Context, token string) (*entity.PayToken, error) // Save will store a token information into data source. Save(ctx context.Context, paytoken entity.PayToken) error // Update will store an updated token information into data source. Update(ctx context.Context, paytoken entity.PayToken) error }
Repository encapsulates the logic to access paytoken from the data source.
func NewRepository ¶
func NewRepository(db *dbcontext.DB, logger log.Logger) Repository
NewRepository creates a new paytoken repository
type Service ¶
type Service interface { GetPayTokens(ctx context.Context, customer_id string) ([]entity.PayToken, error) Generate(ctx context.Context, req entity.InputGenerate) (out entity.OutGenerate, err error) Validate(ctx context.Context, req entity.InputValidate) (out entity.OutValidate, err error) }
Service encapsulates usecase logic for albums.
func NewService ¶
func NewService(repo Repository, logger log.Logger) Service
NewService creates a new payment token service.
Click to show internal directories.
Click to hide internal directories.