feat(kyc): consume context param from KYC/registration exceptions#652
Merged
Conversation
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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
contextfield fromKycLevelRequiredExceptionandRegistrationRequiredExceptionAPI error responsesKycPageManager→KycCubit→ service layer?context=RealunitBuy(orRealunitSell) as query param onGET /v2/kycandPUT /v2/kycFlow: API throws exception with context → cubit stores in failure state → button passes via route
extra→KycPageManagerforwards toKycCubit→ service appends query param → API returns only relevant stepsFiles changed (18)
Exceptions:
buy_exceptions.dart— added nullablecontextfield to both exception classesStates:
buy_payment_info_state.dart,sell_payment_info_state.dart— addedcontextto failure states + Equatable propsCubits:
buy_payment_info_cubit.dart,sell_payment_info_cubit.dart— passe.contextto failure statesNavigation:
sell_button.dart,payment_additional_action_needed_button.dart— passstate.contextvia routeextraRoute + page:
router_config.dart,kyc_page_manager.dart— extractextraaskycContext, forward to cubitKYC cubit:
kyc_cubit.dart— store_kycContext, sticky across re-checks, forward to service callsKYC service:
dfx_kyc_service.dart— acceptcontextparam, append as query param on GET/PUTTests (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 testscontextfield?context=query param present/absentradioButtonUnselectedLabeli18n compilation error on develop