Skip to content

KYB/KYC Verification Integration... Frontend #100

Description

@ManuelJG1999

Frontend: KYB/KYC Verification Integration

Depends on: Backend KYB workflow (POST /kyb/session, GET /kyb/status/:organizationId)

Task Description

Connect the frontend to the backend KYB/KYC verification workflow so business users can start verification and see their status before creating high-value / enterprise agreements. The backend exposes a provider-agnostic Identity Provider abstraction; the frontend must consume it without knowing the specific provider.

Background / Current State

  • The Thalos frontend already has a shared API client pattern in lib/api/ (each module reuses an apiRequest/apiClient helper and returns the { success, data, error } shape).
  • Business features live in app/dashboard/business/page.tsx; the profile gating is already based on the business profile check.
  • No KYB/KYC UI or client exists yet.

Deliverable

A KYB verification UI flow integrated with the backend endpoints, plus a status gate on enterprise agreement creation.

Requirements

  • New lib/api/kyb.ts client (reusing the shared API client) with:
    • startKybSession()POST /kyb/session
    • getKybStatus(organizationId)GET /kyb/status/:organizationId
  • A verification screen/section that:
    • Collects/displays business name, registration number, country.
    • Starts a verification session and handles the provider redirect/embedded flow.
    • Shows status states: pending, in_review, verified, rejected.
  • A gate: block fund deposits / enterprise agreement creation unless status is verified, with a clear call to action to complete KYB.

Validation System

  • Starting a session calls POST /kyb/session and transitions the UI to in_review.
  • Status polling/refresh reflects verified/rejected from GET /kyb/status/:organizationId.
  • Enterprise agreement creation is blocked when status is not verified.

Technical Requirements

  • Reuse the shared apiRequest/apiClient (do not create a new fetch helper).
  • Keep the UI provider-agnostic (no hardcoded provider assumptions).
  • Handle loading/error and expired-session states.
  • Gate lives in the business dashboard flow (app/dashboard/business/page.tsx), consistent with the existing business-profile check.

Additional Notes

Pairs with the backend KYB issue. Individual KYC (person) can reuse the same client pattern if a /kyc/* counterpart exists later.

Testing (required)

  • Component/unit test: the KYB client calls the correct endpoints and maps the four status states.
  • UI test: session start moves the UI to in_review; status refresh reflects verified/rejected.
  • Gate test: enterprise agreement creation / fund deposit is blocked unless verified.
  • Error-state test: expired/failed session shows a clear recovery CTA.

Proof of Completion (required)

  • Link the merged PR.
  • Attach screenshots/recording of the full flow: start → in_review → verified, plus the blocked-until-verified gate.
  • Paste passing test output.
  • Confirm (link/diff) that lib/api/kyb.ts reuses the shared API client, not a new fetch helper.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions