Skip to content

feat(kyc): consume context param from KYC/registration exceptions#652

Merged
TaprootFreak merged 9 commits into
stagingfrom
feat/kyc-context-param
Jun 3, 2026
Merged

feat(kyc): consume context param from KYC/registration exceptions#652
TaprootFreak merged 9 commits into
stagingfrom
feat/kyc-context-param

Conversation

@davidleomay
Copy link
Copy Markdown
Contributor

Summary

  • Parse optional context field from KycLevelRequiredException and RegistrationRequiredException API error responses
  • Carry context through failure states → route navigation → KycPageManagerKycCubit → service layer
  • Pass ?context=RealunitBuy (or RealunitSell) as query param on GET /v2/kyc and PUT /v2/kyc
  • No local step-filtering logic — the API is the authority, the app passes through what it receives

Flow: API throws exception with context → cubit stores in failure state → button passes via route extraKycPageManager forwards to KycCubit → service appends query param → API returns only relevant steps

Files changed (18)

Exceptions: buy_exceptions.dart — added nullable context field to both exception classes

States: buy_payment_info_state.dart, sell_payment_info_state.dart — added context to failure states + Equatable props

Cubits: buy_payment_info_cubit.dart, sell_payment_info_cubit.dart — pass e.context to failure states

Navigation: sell_button.dart, payment_additional_action_needed_button.dart — pass state.context via route extra

Route + page: router_config.dart, kyc_page_manager.dart — extract extra as kycContext, forward to cubit

KYC cubit: kyc_cubit.dart — store _kycContext, sticky across re-checks, forward to service calls

KYC service: dfx_kyc_service.dart — accept context param, append as query param on GET/PUT

Tests (7 files, +307 lines): exception parsing, state equality, cubit propagation, service query params, cubit sticky forwarding

Test plan

  • flutter analyze — 0 new errors (pre-existing i18n issues only)
  • api_exception_test.dart — 8/8 pass including new context parsing tests
  • State props assertions updated for new context field
  • Cubit tests verify context propagation from exceptions
  • Service tests verify ?context= query param present/absent
  • KycCubit tests verify context forwarded to service and sticky across re-checks
  • Remaining test files blocked by pre-existing radioButtonUnselectedLabel i18n compilation error on develop

TaprootFreak and others added 9 commits June 1, 2026 23:14
Promote: staging -> develop
## Automatic Staging PR

This PR was automatically created after changes were pushed to staging.

**Commits:** 1 new commit(s)

### Checklist
- [ ] Review all changes
- [ ] Verify CI passes
- [ ] Approve and merge to promote into develop

Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
Promote: staging -> develop
## Automatic Staging PR

This PR was automatically created after changes were pushed to staging.

**Commits:** 1 new commit(s)

### Checklist
- [ ] Review all changes
- [ ] Verify CI passes
- [ ] Approve and merge to promote into develop

Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
## Automatic Staging PR

This PR was automatically created after changes were pushed to staging.

**Commits:** 1 new commit(s)

### Checklist
- [ ] Review all changes
- [ ] Verify CI passes
- [ ] Approve and merge to promote into develop

Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
## Automatic Staging PR

This PR was automatically created after changes were pushed to staging.

**Commits:** 1 new commit(s)

### Checklist
- [ ] Review all changes
- [ ] Verify CI passes
- [ ] Approve and merge to promote into develop

Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
## Automatic Staging PR

This PR was automatically created after changes were pushed to staging.

**Commits:** 1 new commit(s)

### Checklist
- [ ] Review all changes
- [ ] Verify CI passes
- [ ] Approve and merge to promote into develop

Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
## Automatic Staging PR

This PR was automatically created after changes were pushed to staging.

**Commits:** 1 new commit(s)

### Checklist
- [ ] Review all changes
- [ ] Verify CI passes
- [ ] Approve and merge to promote into develop

Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
The DFX API now returns an optional `context` field in
KycLevelRequiredException and RegistrationRequiredException responses.
This lets the API scope KYC steps to the current flow (e.g.
RealunitBuy only requires LEVEL_30, RealunitSell requires all steps).

The app reads the context from the exception, carries it through the
failure state and route navigation, and passes it as a query param
on GET/PUT /v2/kyc. No local step-filtering logic — the API decides.
@TaprootFreak TaprootFreak added the tier3:full Opt-in: run Tier 3 Maestro handbook flows on this PR label Jun 3, 2026
@TaprootFreak TaprootFreak changed the base branch from develop to staging June 3, 2026 14:04
@TaprootFreak TaprootFreak merged commit 62311ff into staging Jun 3, 2026
6 checks passed
@TaprootFreak TaprootFreak deleted the feat/kyc-context-param branch June 3, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tier3:full Opt-in: run Tier 3 Maestro handbook flows on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants