SDK-2614: Python - Support configuration for IDV shortened flow - python#459
Conversation
|
🤖 Claude Code ReviewCode Review FindingsCriticalNone MajorNone Minor
Nit
|
There was a problem hiding this comment.
Pull request overview
Adds support for configuring an IDV “shortened flow” by allowing SDK consumers to suppress specific screens in the Doc Scan journey via a new suppressed_screens field on SdkConfig (builder + JSON serialization) and a set of screen-name constants.
Changes:
- Added new suppressible-screen constants in
doc_scan/constants.py. - Extended
SdkConfig+SdkConfigBuilderto accept and serializesuppressed_screens(including single-screen append helper). - Added unit tests covering builder behavior and JSON serialization for the new field.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| yoti_python_sdk/doc_scan/constants.py | Adds constants identifying suppressible IDV screens. |
| yoti_python_sdk/doc_scan/session/create/sdk_config.py | Adds suppressed_screens to SdkConfig, builder setters, and JSON serialization. |
| yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py | Adds/extends tests for suppressed screen configuration and serialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| assert result.success_url is self.SOME_SUCCESS_URL | ||
| assert result.error_url is self.SOME_ERROR_URL | ||
| assert result.privacy_policy_url is self.SOME_PRIVACY_POLICY_URL | ||
| assert result.allow_handoff is True | ||
| assert result.suppressed_screens == self.SOME_SUPPRESSED_SCREENS |
| :param privacy_policy_url: the privacy policy url | ||
| :type privacy_policy_url: str | ||
| :param allow_handoff: boolean flag for allow_handoff | ||
| :type allow_handoff: bool | ||
| :param suppressed_screens: list of screen names to be suppressed |
| self.__error_url, | ||
| self.__allow_handoff, | ||
| self.__privacy_policy_url, | ||
| self.__suppressed_screens, |
| result = ( | ||
| SdkConfigBuilder() | ||
| .with_suppressed_screens(self.SOME_SUPPRESSED_SCREENS) | ||
| .build() | ||
| ) |



Summary
Adds support for configuring the IDV shortened flow by allowing consumers to suppress specific screens from the IDV journey. A new
suppressed_screensfield is exposed onSdkConfigvia the builder, and seven screen-name constants are added to identify the screens that can be omitted (e.g. ID document education, liveness education, flow completion).Changes
yoti_python_sdk/doc_scan/constants.py: Added seven new constants for suppressible screens —ID_DOCUMENT_EDUCATION,ID_DOCUMENT_REQUIREMENTS,SUPPLEMENTARY_DOCUMENT_EDUCATION,ZOOM_LIVENESS_EDUCATION,STATIC_LIVENESS_EDUCATION,FACE_CAPTURE_EDUCATION,FLOW_COMPLETION.yoti_python_sdk/doc_scan/session/create/sdk_config.py:suppressed_screensparameter toSdkConfig.__init__and corresponding read-only property.suppressed_screensinto_json()(null values continue to be stripped viaremove_null_values).with_suppressed_screens(list)andwith_suppressed_screen(str)builder methods onSdkConfigBuilderto set the list wholesale or append a single screen.yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py: Added tests covering default value, single/multiple screen setters, JSON serialization (present when set, omitted when unset), fluent builder return values, and constant value assertions. Extended the existingtest_should_build_correctlytest to include the new field.QA Test Steps
websdk-auto/SDK-2614-python-python---support-configuration-for-idv-shortened-flow.pip install -e .andpip install -r requirements.txt.pytest yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py -v.test_suppressed_screens_default_to_none,test_should_add_individual_suppressed_screens,test_suppressed_screens_serialized_when_set,test_suppressed_screens_omitted_when_not_set,test_with_suppressed_screens_returns_builder,test_with_suppressed_screen_returns_builder,test_suppressed_screen_constants_defined.pytest yoti_python_sdk/tests/doc_scan/ -vand confirm no existing tests regress."suppressed_screens": ["ID_DOCUMENT_EDUCATION", "FLOW_COMPLETION"]..with_suppressed_screen(...)calls and confirm screens accumulate in insertion order in the serialized JSON.SdkConfigwithout calling either suppressed-screen method.suppressed_screensis not present in the resulting JSON (verifiesremove_null_valuesbehavior)..with_suppressed_screens([])and verify the JSON contains an empty"suppressed_screens": []array (empty list is not null and should be sent through).DocScanClient.create_session()using anSdkConfigwithsuppressed_screenspopulated, and confirm the API accepts the payload without 4xx errors and the returned session honors the shortened flow.Notes
suppressed_screensdefaults toNoneand is excluded from the JSON payload when unset, preserving backwards compatibility for callers that don't opt in.with_suppressed_screenscopies the input list (list(...)) so later mutations of the caller's list do not affect the built config; this matches the immutability conventions elsewhere in the builder.suppressed_screenswas appended as the final positional parameter to avoid breaking existing callers using positional args (note thatSdkConfigBuilder.build()already passesallow_handoffandprivacy_policy_urlin swapped positional order relative to__init__— this pre-existing quirk was preserved, not changed in this PR).DocScanClient; consumers pick up the new field purely throughSdkConfigBuilder.Related Jira: SDK-2614
Auto-generated by n8n + Claude CLI