-
Notifications
You must be signed in to change notification settings - Fork 4
[Ready] Implement and unify KYC/B processes via API. #1318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
18ea3c4
docs(repo): clarify delegated profile request context
gianfra-t 30dbda2
docs(repo): propose unified KYC and KYB API
gianfra-t 6e63cdb
docs(repo): define staged verification flow
gianfra-t 2cbf3e3
Merge branch 'managed-profiles' into streamline-kyc-kyb
ebma 8aa735c
docs(repo): define lean unified verification first iteration
ebma f1def3a
docs(repo): restore unified verification proposal scope
ebma 1507d09
feat(shared): map Avenia KYB Level 1 API
gianfra-t f10d2af
feat(api): add Avenia API-based KYB Level 1 flow
gianfra-t e0440e6
chore(repo): merge managed-profiles into streamline-kyc-kyb
gianfra-t cf20974
Merge branch 'managed-profiles' into streamline-kyc-kyb
gianfra-t 3de61fc
feat(api): publish onboarding requirements discovery
gianfra-t 6449a57
Merge branch 'managed-profiles' into streamline-kyc-kyb
gianfra-t ab3f137
docs(api): refresh merged OpenAPI declarations
gianfra-t 64634fb
refactor(api)!: streamline onboarding discovery metadata
gianfra-t 98b89eb
refactor(api): rely on Avenia KYB attempt state
gianfra-t 45e49c1
Merge branch 'managed-profiles' into streamline-kyc-kyb
gianfra-t d1eda67
fix(shared): tolerate unsettled Avenia attempts without resultMessage
gianfra-t 17923e0
fix(api): bind record-attempt marker to an owned Brazil quote
gianfra-t e5de51d
feat(api): inherit manager pricing for managed profiles
gianfra-t d5fa78b
fix(api): enforce Avenia KYC customer type
gianfra-t 89a328b
fix(api): protect Avenia recovery identity
gianfra-t 4410c96
fix(api): keep paid-ramp recovery pollable
gianfra-t 9fc10b7
fix(api): reconcile existing Avenia KYB attempts
gianfra-t 5797a81
fix(api): validate onboarding request metadata
gianfra-t d70b77d
fix(api): harden Avenia onboarding state
gianfra-t 8ab1f39
fix(api): make Avenia KYB retries safe
gianfra-t e07ff31
fix(api): restore resumable KYB and sync public contracts
ebma ee3a123
style(api): apply Biome formatting
ebma 13fb59b
docs(api): propose Avenia Sumsub KYC import
gianfra-t 5c8593b
feat(api): add Sumsub KYC token import
gianfra-t File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,660 changes: 1,518 additions & 142 deletions
1,660
apps/api/src/api/controllers/brla.controller.test.ts
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
74 changes: 74 additions & 0 deletions
74
apps/api/src/api/controllers/onboarding-requirements.controller.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import { describe, expect, it, mock } from "bun:test"; | ||
| import type { Request, Response } from "express"; | ||
| import { getOnboardingRequirements } from "./onboarding.controller"; | ||
|
|
||
| function createResponse() { | ||
| const response = { | ||
| body: undefined as unknown, | ||
| statusCode: 200, | ||
| json: mock((body: unknown) => { | ||
| response.body = body; | ||
| return response; | ||
| }), | ||
| status: mock((statusCode: number) => { | ||
| response.statusCode = statusCode; | ||
| return response; | ||
| }) | ||
| }; | ||
| return response; | ||
| } | ||
|
|
||
| describe("getOnboardingRequirements", () => { | ||
| it("returns public requirements case-insensitively", () => { | ||
| const response = createResponse(); | ||
|
|
||
| getOnboardingRequirements( | ||
| { query: { country: "br", customerType: "BUSINESS" } } as unknown as Request, | ||
| response as unknown as Response | ||
| ); | ||
|
|
||
| expect(response.statusCode).toBe(200); | ||
| expect(response.body).toMatchObject({ | ||
| country: "BR", | ||
| customerType: "business", | ||
| flow: "avenia-br-business-level-1-api-kyb", | ||
| provider: "avenia" | ||
| }); | ||
| expect(response.body).not.toHaveProperty("fields"); | ||
| const steps = (response.body as { steps: Array<{ method?: string; operationId?: string }> }).steps; | ||
| expect(steps.map(step => step.operationId).filter(Boolean)).toContain("submitAveniaKybLevel1Api"); | ||
| expect(steps.some(step => step.method === "GET")).toBe(false); | ||
| }); | ||
|
|
||
| it("rejects incomplete queries", () => { | ||
| const response = createResponse(); | ||
|
|
||
| getOnboardingRequirements({ query: { country: "BR" } } as unknown as Request, response as unknown as Response); | ||
|
|
||
| expect(response.statusCode).toBe(400); | ||
| expect(response.body).toMatchObject({ error: { code: "INVALID_ONBOARDING_REQUIREMENTS_QUERY" } }); | ||
| }); | ||
|
|
||
| it("does not advertise unsupported provider flows", () => { | ||
| const response = createResponse(); | ||
|
|
||
| getOnboardingRequirements( | ||
| { query: { country: "AR", customerType: "business" } } as unknown as Request, | ||
| response as unknown as Response | ||
| ); | ||
|
|
||
| expect(response.statusCode).toBe(404); | ||
| expect(response.body).toMatchObject({ error: { code: "ONBOARDING_REQUIREMENTS_NOT_FOUND" } }); | ||
| }); | ||
|
|
||
| it("leaves Monerium outside this discovery proposal", () => { | ||
| const response = createResponse(); | ||
|
|
||
| getOnboardingRequirements( | ||
| { query: { country: "EU", customerType: "individual" } } as unknown as Request, | ||
| response as unknown as Response | ||
| ); | ||
|
|
||
| expect(response.statusCode).toBe(404); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { describe, expect, it, mock } from "bun:test"; | ||
| import type { NextFunction, Request, Response } from "express"; | ||
| import { validateAlfredpayCustomerType } from "./alfredpay.middleware"; | ||
|
|
||
| function run(type: unknown) { | ||
| const next = mock(() => undefined); | ||
| const json = mock(() => undefined); | ||
| const status = mock(() => ({ json })); | ||
|
|
||
| validateAlfredpayCustomerType({ query: type === undefined ? {} : { type } } as unknown as Request, { status } as unknown as Response, next as NextFunction); | ||
|
|
||
| return { json, next, status }; | ||
| } | ||
|
|
||
| describe("validateAlfredpayCustomerType", () => { | ||
| it("accepts an omitted or supported customer type", () => { | ||
| expect(run(undefined).next).toHaveBeenCalledTimes(1); | ||
| expect(run("INDIVIDUAL").next).toHaveBeenCalledTimes(1); | ||
| expect(run("BUSINESS").next).toHaveBeenCalledTimes(1); | ||
| }); | ||
|
|
||
| it("rejects unknown and repeated customer types", () => { | ||
| for (const type of ["BUSINES", "business", ["BUSINESS", "INDIVIDUAL"]]) { | ||
| const { json, next, status } = run(type); | ||
| expect(next).not.toHaveBeenCalled(); | ||
| expect(status).toHaveBeenCalledWith(400); | ||
| expect(json).toHaveBeenCalledWith({ error: "Invalid type: expected INDIVIDUAL or BUSINESS" }); | ||
| } | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.