Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update Accounts Module and Integration Tests #451

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

armando-rodriguez-cko
Copy link
Contributor

feat: Update Accounts Module and Integration Tests

Description:

This PR introduces updates to the Accounts module in the Checkout SDK, focusing on onboarding entities and sub-entities, response handling, and improving test cases. New helper methods and random data generation utilities have also been added for testing purposes.


Key Changes:

  1. Accounts Module Enhancements:

    • Modified OnboardEntityRequest:
      • Made Draft and IsDraft properties nullable (bool?).
    • Updated OnboardSubEntityRequest:
      • Added JsonExtensionData for dynamic request properties.
    • Enhanced OnboardingStatus:
      • Added a new Draft enum value with [EnumMember(Value = "draft")].
  2. New Helper Utilities:

    • Added utility methods for generating random data:
      • RandomString(), RandomDigits(), and RandomBusinessRegistrationNumber().
      • Created a custom HttpClient factory (CustomClientFactory) to handle schema versioning.
  3. Test Updates:

    • Replaced static random data generation in integration tests with reusable helper methods.
    • Improved test coverage and response validation in AccountsClientTest and AccountsIntegrationTest.
    • Updated tests to handle random email and phone generation dynamically.
    • Modified test data to include new fields like IsDraft and structured company information.
  4. Code Cleanup:

    • Removed unused imports and redundant methods in the test files.
    • Reorganized helper methods to streamline test setup and execution.

Impact:

  • Functionality:
    • Enables more flexible handling of draft onboarding requests.
    • Simplifies test maintenance with reusable random data generators.
  • Testing:
    • Increased test coverage ensures better reliability for entity and sub-entity onboarding flows.

Testing:

  • Verified the following scenarios:
    • Successful creation of entity onboarding requests with and without the draft flag.
    • Dynamic handling of sub-entity requests using JsonExtensionData.
    • Validation of new helper methods for random data generation.

Notes:

  • Developers should ensure the random data generators are used consistently across tests.
  • Future updates may focus on additional integration scenarios and more detailed response validations.

- Changed `Draft` and `IsDraft` properties in `OnboardEntityRequest` to nullable booleans (`bool?`).
- Added `[JsonExtensionData]` to `OnboardSubEntityRequest` for handling dynamic JSON properties.
- Introduced `Draft` status to the `OnboardingStatus` enum.
- Updated test cases in `AccountsClientTest`:
  - Modified response field names and values.
  - Added checks for `Id` and updated `custom_field_1`.
- Enhanced `AccountsIntegrationTest` with new test cases (`ShouldCreateCompanyV2`, `ShouldCreateCompanyV3`).
- Added helper methods for generating random data:
  - `RandomString`, `RandomDigits`, `RandomBusinessRegistrationNumber`, and `RandomIdentifier`.
- Introduced `CustomClientFactory` to manage HTTP client with schema version headers.
@armando-rodriguez-cko armando-rodriguez-cko requested a review from a team February 4, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants