Skip to content

Conversation

@eddyjaga
Copy link
Collaborator

@eddyjaga eddyjaga commented Oct 23, 2025

Description

This pull request introduces comprehensive user management capabilities to the Zai Payment gem, including full CRUD operations for payin and payout users, support for business users with company details, and extensive validation and documentation updates. It also adds new branding and verification fields for users, improves API endpoint flexibility, and significantly expands usage examples and guides. All changes are backward compatible.

User Management API & Features:

  • Added full CRUD support for users via the new ZaiPayment.users interface, including listing, showing, creating (with progressive profile support), and updating both payin (buyer) and payout (seller/merchant) users. Comprehensive validation is included for email, country code, date of birth, and user type.
  • Introduced new user parameters for enhanced verification and merchant branding: drivers_license_number, drivers_license_state, logo_url, color_1, color_2, custom_descriptor, and authorized_signer_title. Added support for a nested company object for business users with required and optional fields, and special handling for boolean and nested values.

Documentation & Examples:

  • Added and updated extensive documentation: new User Management Guide (docs/USERS.md), user examples (examples/users.md), quick reference, demo script, and implementation summary. README now includes a Users section, quick examples, and updated roadmap. [1] [2] [3] [4] [5] [6]
  • Added a detailed guide on the id field for users, clarifying that it is optional, can be auto-generated or custom, and must not contain dots or be blank. Includes best practices and migration strategy.

API & Client Enhancements:

  • Added base_endpoint parameter to the client for supporting multiple API endpoints; Users API uses core_base, Webhooks API continues with va_base. Updated the response handling to support both webhooks and users.

Testing & Quality:

  • 40+ new test cases for user resource, covering all CRUD operations, validation, error handling, and integration with the main module for both payin and payout users.
  • Increased RuboCop ClassLength limit and excluded variable number naming cop for user resource file to accommodate new logic.

User Management API:

  • Added CRUD operations for users, including business users with company details, and comprehensive field validation. [1] [2]

Documentation & Examples:

  • Added and updated user management documentation, guides, and real-world usage examples. [1] [2] [3] [4] [5] [6]
  • Added guide on the optional id field for users, including validation and best practices.

API Client Enhancements:

  • Introduced base_endpoint parameter and improved response handling for new user endpoints.

Testing & Quality:

  • Added 40+ new test cases and updated RuboCop configuration for expanded user resource logic. [1] [2]

Backward Compatibility:

  • All new parameters and features are optional, ensuring backward compatibility with existing code.

@eddyjaga eddyjaga requested a review from Copilot October 23, 2025 04:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces comprehensive User Management support to the ZaiPayment gem, enabling full CRUD operations for both payin (buyer) and payout (seller/merchant) users. The implementation includes robust validation, extensive documentation with practical examples, and enhanced API client capabilities to support multiple endpoints.

Key Changes:

  • Implemented full User resource with CRUD operations and validation for email, country codes, DOB, and user types
  • Enhanced the client to support multiple API endpoints (core_base for users, va_base for webhooks)
  • Added comprehensive documentation including user guides, quick reference, examples, and implementation summaries

Reviewed Changes

Copilot reviewed 16 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/zai_payment/resources/user.rb New User resource implementing CRUD operations with validation
lib/zai_payment/client.rb Added base_endpoint parameter for multi-endpoint support
lib/zai_payment/response.rb Updated to handle both webhooks and users response formats
lib/zai_payment.rb Integrated User resource with core_base endpoint
spec/zai_payment/resources/user_spec.rb Comprehensive test suite with 40+ test cases
spec/zai_payment/client_spec.rb New test suite for client enhancements
docs/USERS.md Complete user management guide with field reference
docs/USER_QUICK_REFERENCE.md Quick lookup guide for common operations
docs/USER_ID_FIELD.md Detailed guide on user ID field usage
examples/users.md Extensive usage examples and patterns
IMPLEMENTATION_SUMMARY.md Summary of new parameters implementation
IMPLEMENTATION.md Detailed implementation documentation
README.md Added user management examples and updated roadmap
CHANGELOG.md Documented version 1.3.0 features
lib/zai_payment/version.rb Version bump to 1.3.0
.rubocop.yml Updated to accommodate User resource complexity
Comments suppressed due to low confidence (1)

docs/USERS.md:1

  • The field reference table on line 228 shows DOB format as 'DD/MM/YYYY', but the code validates and expects 'YYYYMMDD' format. Update to 'YYYYMMDD' for consistency with implementation.
# User Management

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@eddyjaga eddyjaga merged commit 5506dc5 into main Oct 23, 2025
2 checks passed
@eddyjaga eddyjaga deleted the feature/user-management-payin-payout branch October 23, 2025 04:37
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