Skip to content

Conversation

@rogelioLpz
Copy link
Member

@rogelioLpz rogelioLpz commented Mar 12, 2025

  • Se elimina KYCVerification y se unifica con KYCValidation
  • Se agrega enum KYCValidationFlow para indicar si es validación del lado en el cliente o del server.
  • Level maximo permitido es 3

Summary by CodeRabbit

  • Refactor
    • Removed the legacy verification functionality from the public interface.
  • New Features
    • Enhanced the KYC validation process with an updated parameter for a more streamlined flow.
  • Chores
    • Updated the application version to 2.1.3 and dependency requirements to cuenca-validations==2.1.5.
  • Tests
    • Removed outdated test resources and revised tests to match the new validation enhancements.
    • Updated test cases to include new parameters and modified request/response structures.

@rogelioLpz rogelioLpz self-assigned this Mar 12, 2025
@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2025

Walkthrough

The changes involve the removal of the KYCVerification entity from the public API by deleting its import and export declarations from both cuenca/__init__.py and cuenca/resources/__init__.py, as well as eliminating the corresponding file (cuenca/resources/kyc_verifications.py). Additionally, the KYCValidation class in cuenca/resources/kyc_validations.py has been updated to include a new source_type parameter, replacing the previous documents parameter. The version in cuenca/version.py was bumped to '2.1.3', and updates were applied to dependency versions in both requirements.txt and setup.py (switching from version 2.1.0 to 2.1.5). Finally, test files and cassette YAML files related to KYC verification create, retrieve, and update operations were removed.

Suggested reviewers

  • felipao-mx
  • alexviquez
  • pachCode

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 08c4014 and 77489a5.

📒 Files selected for processing (3)
  • cuenca/version.py (1 hunks)
  • requirements.txt (1 hunks)
  • setup.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • cuenca/version.py
  • requirements.txt
  • setup.py

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (fe2eb3e) to head (77489a5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #419   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           50        49    -1     
  Lines         1124      1103   -21     
=========================================
- Hits          1124      1103   -21     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cuenca/__init__.py 100.00% <ø> (ø)
cuenca/resources/__init__.py 100.00% <ø> (ø)
cuenca/resources/kyc_validations.py 100.00% <100.00%> (ø)
cuenca/version.py 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fe2eb3e...77489a5. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rogelioLpz rogelioLpz changed the title Levels Changes in KYC Validation Mar 20, 2025
@rogelioLpz rogelioLpz marked this pull request as ready for review March 20, 2025 18:34
@rogelioLpz rogelioLpz requested a review from alexviquez as a code owner March 20, 2025 18:34
@rogelioLpz rogelioLpz requested a review from pachCode March 20, 2025 18:35
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
cuenca/resources/kyc_validations.py (1)

17-17: Typo in class attribute name.

There's a typo in the class attribute: attemps should be attempts. While this is pre-existing code and not part of the current PR, it would be good to fix it in a future update.

-    attemps: Optional[int] = None
+    attempts: Optional[int] = None
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe2eb3e and 161d3c2.

📒 Files selected for processing (12)
  • cuenca/__init__.py (0 hunks)
  • cuenca/resources/__init__.py (0 hunks)
  • cuenca/resources/kyc_validations.py (3 hunks)
  • cuenca/resources/kyc_verifications.py (0 hunks)
  • cuenca/version.py (1 hunks)
  • requirements.txt (1 hunks)
  • setup.py (1 hunks)
  • tests/resources/cassettes/test_kyc_verification_create.yaml (0 hunks)
  • tests/resources/cassettes/test_kyc_verification_retrieve.yaml (0 hunks)
  • tests/resources/cassettes/test_kyc_verification_update.yaml (0 hunks)
  • tests/resources/test_kyc_validations.py (1 hunks)
  • tests/resources/test_kyc_verifications.py (0 hunks)
💤 Files with no reviewable changes (7)
  • cuenca/init.py
  • tests/resources/test_kyc_verifications.py
  • tests/resources/cassettes/test_kyc_verification_create.yaml
  • tests/resources/cassettes/test_kyc_verification_retrieve.yaml
  • cuenca/resources/init.py
  • tests/resources/cassettes/test_kyc_verification_update.yaml
  • cuenca/resources/kyc_verifications.py
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.py`: Enforce Relative Imports for Internal Modules

Ensure that any imports referencing internal modules use relative paths. However, if modules reside in the main module dir...

**/*.py: Enforce Relative Imports for Internal Modules

Ensure that any imports referencing internal modules use relative paths. However, if modules reside in the main module directories (for example /src or /library_or_app_name) —and relative imports are not feasible—absolute imports are acceptable. Additionally, if a module is located outside the main module structure (for example, in /tests or /scripts at a similar level), absolute imports are also valid.

Examples and Guidelines:

  1. If a module is in the same folder or a subfolder of the current file, use relative imports. For instance: from .some_module import SomeClass
  2. If the module is located under /src or /library_or_app_name and cannot be imported relatively, absolute imports are allowed (e.g., from library_or_app_name.utilities import helper_method).
  3. If a module is outside the main module directories (for example, in /tests, /scripts, or any similarly placed directory), absolute imports are valid.
  4. External (third-party) libraries should be imported absolutely (e.g., import requests).
  • setup.py
  • tests/resources/test_kyc_validations.py
  • cuenca/version.py
  • cuenca/resources/kyc_validations.py
`**/*.py`: Rule: Enforce Snake Case in Python Backend
  1. New or Modified Code: Use snake_case for all variables, functions, methods, and class attributes.
  2. Exceptions (Pydantic...

**/*.py:
Rule: Enforce Snake Case in Python Backend

  1. New or Modified Code: Use snake_case for all variables, functions, methods, and class attributes.
  2. Exceptions (Pydantic models for API responses):
    • Primary fields must be snake_case.
    • If older clients expect camelCase, create a computed or alias field that references the snake_case field.
    • Mark any camelCase fields as deprecated or transitional.

Examples

Invalid:

class CardConfiguration(BaseModel):
    title: str
    subTitle: str  # ❌ Modified or new field in camelCase

Valid:

class CardConfiguration(BaseModel):
    title: str
    subtitle: str  # ✅ snake_case for new/modified field

    @computed_field
    def subTitle(self) -> str:  # camelCase allowed only for compatibility
        return self.subtitle

Any direct use of camelCase in new or updated code outside of these exceptions should be flagged.

  • setup.py
  • tests/resources/test_kyc_validations.py
  • cuenca/version.py
  • cuenca/resources/kyc_validations.py
🔇 Additional comments (7)
cuenca/version.py (1)

1-1: Version update looks appropriate.

The version bump from '2.1.2' to '2.1.3' aligns with the changes described in the PR objectives, which involve removing the KYCVerification component, unifying it with KYCValidation, and introducing the KYCValidationType enumeration.

requirements.txt (1)

2-2: Consider using a stable version instead of a development release.

The dependency on cuenca-validations==2.1.4.dev1 uses a development version which might contain unstable features. Development releases are typically not recommended for production environments.

Is there a specific reason for using a development version? Is there a timeline for when a stable version (without the .dev1 suffix) will be available?

tests/resources/test_kyc_validations.py (2)

2-2: Import of KYCValidationType correctly added.

The import of KYCValidationType from cuenca_validations.types aligns with the PR objective of introducing this enumeration to specify the validation type.


9-12: Test correctly updated to include validation_type parameter.

The KYCValidation.create method now includes the new validation_type parameter set to KYCValidationType.background, which aligns with the PR objectives. This test now validates that KYC validations can be classified by type.

Note that the test still expects a verification_id on the KYCValidation object, which suggests that although the KYCVerification component is removed as mentioned in the PR objectives, the concept of a verification ID is still maintained within the KYCValidation class.

cuenca/resources/kyc_validations.py (3)

3-7: Import change looks good.

The addition of KYCValidationType from cuenca_validations.types is appropriate for the new parameter in the create method.


47-47: Correct implementation of validation_type parameter.

The parameter is correctly passed to the KYCValidationRequest constructor, maintaining consistency with the method signature change.


38-38:

Details

✅ Verification successful

New parameter addition is appropriate.

Adding the validation_type parameter aligns with the PR objective of unifying KYC validation and verification. This parameter will help specify whether validation occurs on the client side or server side.


🏁 Script executed:

#!/bin/bash
# Search for all existing calls to KYCValidation.create to ensure they're updated with the new required parameter
rg "KYCValidation.create\(" --type py
rg "KYCValidation\.create\(" --type py

Length of output: 276


Approval: New parameter addition verified and aligned with PR objectives.

The new validation_type: KYCValidationType parameter in cuenca/resources/kyc_validations.py has been correctly added. I ran a search for calls to KYCValidation.create( and found one occurrence in tests/resources/test_kyc_validations.py. It appears that the test call is the only call in the codebase and has been updated accordingly. No issues were detected regarding outdated call sites or missing parameter updates.

@rogelioLpz rogelioLpz requested review from felipao-mx and removed request for pachCode March 26, 2025 23:11
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
cuenca/resources/kyc_validations.py (1)

13-13: Minor typo in existing field name.

There's a typo in the field name attemps (should be attempts). While not directly related to your current changes, it would be good to fix this in a future PR.

-    attemps: Optional[int] = None
+    attempts: Optional[int] = None
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 161d3c2 and e1b43a7.

📒 Files selected for processing (5)
  • cuenca/resources/kyc_validations.py (2 hunks)
  • cuenca/version.py (1 hunks)
  • requirements.txt (1 hunks)
  • setup.py (1 hunks)
  • tests/resources/test_kyc_validations.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • setup.py
  • cuenca/version.py
  • requirements.txt
  • tests/resources/test_kyc_validations.py
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.py`: Enforce Relative Imports for Internal Modules

Ensure that any imports referencing internal modules use relative paths. However, if modules reside in the main module dir...

**/*.py: Enforce Relative Imports for Internal Modules

Ensure that any imports referencing internal modules use relative paths. However, if modules reside in the main module directories (for example /src or /library_or_app_name) —and relative imports are not feasible—absolute imports are acceptable. Additionally, if a module is located outside the main module structure (for example, in /tests or /scripts at a similar level), absolute imports are also valid.

Examples and Guidelines:

  1. If a module is in the same folder or a subfolder of the current file, use relative imports. For instance: from .some_module import SomeClass
  2. If the module is located under /src or /library_or_app_name and cannot be imported relatively, absolute imports are allowed (e.g., from library_or_app_name.utilities import helper_method).
  3. If a module is outside the main module directories (for example, in /tests, /scripts, or any similarly placed directory), absolute imports are valid.
  4. External (third-party) libraries should be imported absolutely (e.g., import requests).
  • cuenca/resources/kyc_validations.py
`**/*.py`: Rule: Enforce Snake Case in Python Backend
  1. New or Modified Code: Use snake_case for all variables, functions, methods, and class attributes.
  2. Exceptions (Pydantic...

**/*.py:
Rule: Enforce Snake Case in Python Backend

  1. New or Modified Code: Use snake_case for all variables, functions, methods, and class attributes.
  2. Exceptions (Pydantic models for API responses):
    • Primary fields must be snake_case.
    • If older clients expect camelCase, create a computed or alias field that references the snake_case field.
    • Mark any camelCase fields as deprecated or transitional.

Examples

Invalid:

class CardConfiguration(BaseModel):
    title: str
    subTitle: str  # ❌ Modified or new field in camelCase

Valid:

class CardConfiguration(BaseModel):
    title: str
    subtitle: str  # ✅ snake_case for new/modified field

    @computed_field
    def subTitle(self) -> str:  # camelCase allowed only for compatibility
        return self.subtitle

Any direct use of camelCase in new or updated code outside of these exceptions should be flagged.

  • cuenca/resources/kyc_validations.py
🔇 Additional comments (3)
cuenca/resources/kyc_validations.py (3)

3-3: Import statement correctly updated to include KYCValidationFlow.

The import statement has been updated to include KYCValidationFlow from cuenca_validations.types, which aligns with the PR objectives of introducing an enumeration to specify validation flow type. The use of absolute imports for external modules follows the coding guidelines.


34-35: Method signature properly updated with validation_flow parameter.

The addition of the validation_flow parameter of type KYCValidationFlow aligns with the PR objectives. The parameter follows snake_case naming convention as required by the coding guidelines. The parameter placement before the optional parameters is appropriate.


41-41: Request instantiation correctly updated to use validation_flow.

The KYCValidationRequest instantiation has been properly updated to include the validation_flow parameter, replacing the previously existing documents parameter as intended in the PR objectives.

@rogelioLpz rogelioLpz merged commit b3742d3 into main Apr 1, 2025
18 checks passed
@rogelioLpz rogelioLpz deleted the levels branch April 1, 2025 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants