diff --git a/api/src/pcapi/connectors/beneficiaries/ubble.py b/api/src/pcapi/connectors/beneficiaries/ubble.py index a89982cf3e5..a49d7f8f379 100644 --- a/api/src/pcapi/connectors/beneficiaries/ubble.py +++ b/api/src/pcapi/connectors/beneficiaries/ubble.py @@ -10,7 +10,6 @@ from pcapi import settings from pcapi.connectors.serialization import ubble_serializers from pcapi.core.fraud import models as fraud_models -from pcapi.core.subscription.ubble import exceptions as ubble_exceptions from pcapi.core.users import models as users_models from pcapi.utils import requests @@ -118,9 +117,6 @@ def create_identity_verification( "webhook_url": webhook_url, }, ) - if response.status_code == 409: - # user tried to reattempt an identity verification while a previous one is being checked - raise ubble_exceptions.ExistingProcessingIdentityVerification() response.raise_for_status() ubble_identification = parse_obj_as(ubble_serializers.UbbleV2IdentificationResponse, response.json()) diff --git a/api/src/pcapi/core/subscription/ubble/exceptions.py b/api/src/pcapi/core/subscription/ubble/exceptions.py index 51843b1f3ce..a8801b8f9f4 100644 --- a/api/src/pcapi/core/subscription/ubble/exceptions.py +++ b/api/src/pcapi/core/subscription/ubble/exceptions.py @@ -1,6 +1,2 @@ class UbbleDownloadedFileEmpty(Exception): "raised when the downloaded file is empty" - - -class ExistingProcessingIdentityVerification(Exception): - pass diff --git a/api/src/pcapi/routes/native/v1/subscription.py b/api/src/pcapi/routes/native/v1/subscription.py index 6fa8cc7cfe5..cbbbeb721cf 100644 --- a/api/src/pcapi/routes/native/v1/subscription.py +++ b/api/src/pcapi/routes/native/v1/subscription.py @@ -12,7 +12,6 @@ from pcapi.core.subscription import models as subscription_models from pcapi.core.subscription import profile_options from pcapi.core.subscription.ubble import api as ubble_subscription_api -from pcapi.core.subscription.ubble import exceptions as ubble_exceptions from pcapi.core.users import models as users_models from pcapi.models import api_errors from pcapi.routes.native.security import authenticated_and_active_user_required @@ -228,8 +227,7 @@ def start_identification_session( user, declared_names[0], declared_names[1], body.redirectUrl ) return serializers.IdentificationSessionResponse(identificationUrl=identification_url) # type: ignore[arg-type] - except ubble_exceptions.ExistingProcessingIdentityVerification: - raise api_errors.ApiErrors({"code": "IDCHECK_ALREADY_PROCESSED"}) + except requests_utils.ExternalAPIException as exception: if exception.is_retryable: code = "IDCHECK_SERVICE_UNAVAILABLE" diff --git a/api/tests/routes/native/v1/account_test.py b/api/tests/routes/native/v1/account_test.py index 57c2a667041..8d8140569eb 100644 --- a/api/tests/routes/native/v1/account_test.py +++ b/api/tests/routes/native/v1/account_test.py @@ -35,7 +35,6 @@ from pcapi.core.mails.transactional.sendinblue_template_ids import TransactionalEmail import pcapi.core.subscription.api as subscription_api import pcapi.core.subscription.models as subscription_models -from pcapi.core.subscription.ubble import exceptions as ubble_exceptions from pcapi.core.testing import assert_num_queries from pcapi.core.users import factories as users_factories from pcapi.core.users import models as users_models @@ -2592,20 +2591,6 @@ def test_allow_rerun_identification_from_started(self, client, ubble_mock): assert check assert response.json["identificationUrl"] == expected_url - def test_existing_processing_id_check(self, client): - user = build_user_at_id_check(18) - - with patch( - "pcapi.core.subscription.ubble.api.start_ubble_workflow", - side_effect=ubble_exceptions.ExistingProcessingIdentityVerification, - ): - response = client.with_token(user.email).post( - "/native/v1/ubble_identification", json={"redirectUrl": "http://example.com/deeplink"} - ) - - assert response.status_code == 400 - assert response.json["code"] == "IDCHECK_ALREADY_PROCESSED" - class AccountSecurityTest: def test_account_hacker_changes_password(self, client, app):