Skip to content

Commit

Permalink
Revert "(PC-34065)[API] feat: handle ubble 409 error"
Browse files Browse the repository at this point in the history
This reverts commit 820ed03.
  • Loading branch information
dnguyen1-pass committed Jan 21, 2025
1 parent 8d4e0a9 commit ef4195d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 26 deletions.
4 changes: 0 additions & 4 deletions api/src/pcapi/connectors/beneficiaries/ubble.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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())
Expand Down
4 changes: 0 additions & 4 deletions api/src/pcapi/core/subscription/ubble/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
class UbbleDownloadedFileEmpty(Exception):
"raised when the downloaded file is empty"


class ExistingProcessingIdentityVerification(Exception):
pass
4 changes: 1 addition & 3 deletions api/src/pcapi/routes/native/v1/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
15 changes: 0 additions & 15 deletions api/tests/routes/native/v1/account_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit ef4195d

Please sign in to comment.