From 6c170147f4cc740292c7047408fbe1e0fab5631c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 13:25:49 +0000 Subject: [PATCH 1/2] Initial plan From 4383d373e1781967f1c01bff8d88a3c7aabee333 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 13:32:19 +0000 Subject: [PATCH 2/2] Add brand_id support to SdkConfig for IDV session customization Co-authored-by: mehmet-yoti <111424390+mehmet-yoti@users.noreply.github.com> --- .../doc_scan/session/create/sdk_config.py | 28 +++++++++++++++ .../session/create/test_sdk_config.py | 35 +++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/yoti_python_sdk/doc_scan/session/create/sdk_config.py b/yoti_python_sdk/doc_scan/session/create/sdk_config.py index 37cde6b5..2caa8396 100644 --- a/yoti_python_sdk/doc_scan/session/create/sdk_config.py +++ b/yoti_python_sdk/doc_scan/session/create/sdk_config.py @@ -23,6 +23,7 @@ def __init__( error_url, allow_handoff=None, privacy_policy_url=None, + brand_id=None, ): """ :param allowed_capture_methods: the allowed capture methods @@ -45,6 +46,8 @@ def __init__( :type privacy_policy_url: str :param allow_handoff: boolean flag for allow_handoff :type allow_handoff: bool + :param brand_id: the brand identifier for custom branding + :type brand_id: str """ self.__allowed_capture_methods = allowed_capture_methods self.__primary_colour = primary_colour @@ -56,6 +59,7 @@ def __init__( self.__error_url = error_url self.__privacy_policy_url = privacy_policy_url self.__allow_handoff = allow_handoff + self.__brand_id = brand_id @property def allowed_capture_methods(self): @@ -148,6 +152,15 @@ def allow_handoff(self): """ return self.__allow_handoff + @property + def brand_id(self): + """ + The brand identifier for custom branding + + :return: the brand_id + """ + return self.__brand_id + def to_json(self): return remove_null_values( { @@ -161,6 +174,7 @@ def to_json(self): "error_url": self.error_url, "privacy_policy_url": self.privacy_policy_url, "allow_handoff": self.allow_handoff, + "brand_id": self.brand_id, } ) @@ -181,6 +195,7 @@ def __init__(self): self.__error_url = None self.__privacy_policy_url = None self.__allow_handoff = None + self.__brand_id = None def with_allowed_capture_methods(self, allowed_capture_methods): """ @@ -320,6 +335,18 @@ def with_allow_handoff(self, flag): self.__allow_handoff = flag return self + def with_brand_id(self, brand_id): + """ + Sets the brand identifier for custom branding + + :param brand_id: the brand identifier + :type brand_id: str + :return: the builder + :rtype: SdkConfigBuilder + """ + self.__brand_id = brand_id + return self + def build(self): return SdkConfig( self.__allowed_capture_methods, @@ -332,4 +359,5 @@ def build(self): self.__error_url, self.__allow_handoff, self.__privacy_policy_url, + self.__brand_id, ) diff --git a/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py b/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py index d621a441..3f69c184 100644 --- a/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py +++ b/yoti_python_sdk/tests/doc_scan/session/create/test_sdk_config.py @@ -16,6 +16,7 @@ class SdkConfigTest(unittest.TestCase): SOME_ERROR_URL = "https://mysite.com/yoti/error" SOME_PRIVACY_POLICY_URL = "https://mysite.com/privacy" SOME_ALLOW_HANDOFF = True + SOME_BRAND_ID = "my-custom-brand" def test_should_build_correctly(self): result = ( @@ -78,6 +79,40 @@ def test_should_serialize_to_json_without_error(self): s = json.dumps(result, cls=YotiEncoder) assert s is not None and s != "" + def test_should_build_with_brand_id(self): + result = ( + SdkConfigBuilder() + .with_allows_camera_and_upload() + .with_brand_id(self.SOME_BRAND_ID) + .build() + ) + + assert isinstance(result, SdkConfig) + assert result.brand_id == self.SOME_BRAND_ID + + def test_not_passing_brand_id(self): + result = SdkConfigBuilder().with_allows_camera().build() + + assert result.brand_id is None + + def test_should_serialize_brand_id_to_json(self): + result = ( + SdkConfigBuilder() + .with_allows_camera_and_upload() + .with_brand_id(self.SOME_BRAND_ID) + .build() + ) + + json_data = json.loads(json.dumps(result, cls=YotiEncoder)) + assert "brand_id" in json_data + assert json_data["brand_id"] == self.SOME_BRAND_ID + + def test_should_not_include_brand_id_in_json_when_not_set(self): + result = SdkConfigBuilder().with_allows_camera_and_upload().build() + + json_data = json.loads(json.dumps(result, cls=YotiEncoder)) + assert "brand_id" not in json_data + if __name__ == "__main__": unittest.main()