identity

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKYCAlreadySubmitted = errors.New("KYC verification is already in progress or approved")
	ErrKYCNotFound         = errors.New("KYC record not found")
	ErrInvalidInput        = errors.New("invalid KYC submission data")
)

Common errors for the KYC service.

Functions

This section is empty.

Types

type KYCRepository

type KYCRepository interface {
	Save(ctx context.Context, submission *KYCSubmission) error
	GetByUserID(ctx context.Context, userID string) (*KYCSubmission, error)
	UpdateStatus(ctx context.Context, id string, status KYCStatus, notes string) error
}

KYCRepository defines the data access layer requirements for KYC operations.

type KYCService

type KYCService interface {
	SubmitKYC(ctx context.Context, req SubmitKYCRequest) (*KYCSubmission, error)
	GetKYCStatus(ctx context.Context, userID string) (*KYCSubmission, error)
	ProcessDecision(ctx context.Context, submissionID string, approved bool, notes string) error
}

KYCService defines the business logic for KYC operations.

func NewKYCService

func NewKYCService(repo KYCRepository, logger *slog.Logger) KYCService

NewKYCService creates a new instance of the KYC service.

type KYCStatus

type KYCStatus string

KYCStatus represents the state of a KYC verification.

const (
	KYCStatusDraft    KYCStatus = "DRAFT"
	KYCStatusPending  KYCStatus = "PENDING"
	KYCStatusReview   KYCStatus = "MANUAL_REVIEW"
	KYCStatusApproved KYCStatus = "APPROVED"
	KYCStatusRejected KYCStatus = "REJECTED"
)

type KYCSubmission

type KYCSubmission struct {
	ID             string
	UserID         string
	Status         KYCStatus
	FirstName      string
	LastName       string
	DateOfBirth    time.Time
	DocumentType   string
	DocumentNumber string
	DocumentURL    string
	SubmittedAt    time.Time
	UpdatedAt      time.Time
	ReviewNotes    string
}

KYCSubmission represents the domain entity for a KYC record.

type SubmitKYCRequest

type SubmitKYCRequest struct {
	UserID         string
	FirstName      string
	LastName       string
	DateOfBirth    time.Time
	DocumentType   string
	DocumentNumber string
	DocumentURL    string
}

SubmitKYCRequest holds the payload for a new KYC submission.

func (*SubmitKYCRequest) Validate

func (r *SubmitKYCRequest) Validate() error

Validate checks if the request data is valid.

Jump to

Keyboard shortcuts

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