Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct {
Line1 string `json:"line1"`
Line2 string `json:"line2,omitempty"`
City string `json:"city"`
State string `json:"state,omitempty"`
PostalCode string `json:"postal_code"`
Country string `json:"country"` // ISO 3166-1 alpha-2
}
Address represents a physical location for residence verification.
type DocumentType ¶
type DocumentType string
DocumentType defines the category of government-issued ID provided.
const ( DocumentTypePassport DocumentType = "PASSPORT" DocumentTypeDriversLicense DocumentType = "DRIVERS_LICENSE" DocumentTypeNationalID DocumentType = "NATIONAL_ID" DocumentTypeResidencePermit DocumentType = "RESIDENCE_PERMIT" )
type KYCRecord ¶
type KYCRecord struct {
// ID is the unique identifier for this KYC attempt.
ID string `json:"id"`
// UserID links this record to a specific user in the system.
UserID string `json:"user_id"`
// Status denotes the current progress of the verification.
Status KYCStatus `json:"status"`
// CurrentTier represents the verification level achieved (e.g., 1 for basic, 2 for advanced).
CurrentTier int `json:"current_tier"`
// Submission contains the data provided by the user.
Submission KYCSubmission `json:"submission"`
// VerificationResult contains details from the verification provider/admin.
VerificationResult *VerificationResult `json:"verification_result,omitempty"`
// Audit metadata.
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
KYCRecord represents the aggregate root for a user's Know Your Customer (KYC) verification process. It tracks the history, current status, and outcome of the verification.
func NewKYCRecord ¶
func NewKYCRecord(id, userID string, submission KYCSubmission) (*KYCRecord, error)
NewKYCRecord creates a new KYC record in pending state.
func (*KYCRecord) RequestMoreInfo ¶
RequestMoreInfo transitions the record to RequiresAction.
type KYCStatus ¶
type KYCStatus string
KYCStatus represents the lifecycle state of an Identity Verification request.
const ( // KYCStatusDraft indicates the submission is being prepared but not yet finalized. KYCStatusDraft KYCStatus = "DRAFT" // KYCStatusPending indicates the submission has been received and is awaiting processing. KYCStatusPending KYCStatus = "PENDING" // KYCStatusInReview indicates the submission is currently being analyzed by an agent or automated system. KYCStatusInReview KYCStatus = "IN_REVIEW" // KYCStatusApproved indicates the identity has been successfully verified. KYCStatusApproved KYCStatus = "APPROVED" // KYCStatusRejected indicates the verification failed permanently for this submission. KYCStatusRejected KYCStatus = "REJECTED" // KYCStatusRequiresAction indicates the user must provide additional information or re-upload documents. KYCStatusRequiresAction KYCStatus = "REQUIRES_ACTION" )
func (KYCStatus) IsTerminal ¶
IsTerminal returns true if the status represents a completed state.
type KYCSubmission ¶
type KYCSubmission struct {
DocumentType DocumentType `json:"document_type"`
DocumentNumber string `json:"document_number"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
// DateOfBirth is expected in ISO 8601 format (YYYY-MM-DD).
DateOfBirth string `json:"date_of_birth"`
// Nationality is the ISO 3166-1 alpha-2 country code.
Nationality string `json:"nationality"`
Address Address `json:"address"`
// Secure URLs or references to the stored document images.
DocumentFrontImageID string `json:"document_front_image_id"`
DocumentBackImageID string `json:"document_back_image_id,omitempty"`
SelfieImageID string `json:"selfie_image_id"`
// ClientIP captures the IP address from where the submission originated (fraud prevention).
ClientIP string `json:"client_ip,omitempty"`
}
KYCSubmission encapsulates the input data required to perform identity verification.
func (*KYCSubmission) Validate ¶
func (s *KYCSubmission) Validate() error
Validate performs domain-level validation on the submission data.
type VerificationResult ¶
type VerificationResult struct {
VerifiedAt time.Time `json:"verified_at"`
ReviewedBy string `json:"reviewed_by,omitempty"` // Admin ID or System
RejectionReason string `json:"rejection_reason,omitempty"`
RiskScore float64 `json:"risk_score,omitempty"` // 0.0 to 1.0
Notes string `json:"notes,omitempty"`
}
VerificationResult holds the outcome details of a review.