feat: comprehensive SDK improvements - error handling, build system, testing, and documentation#17
Merged
Merged
Conversation
- Replace yup validation library with zod for schema validation - Convert validateRefundOptions from async to synchronous function - Update schema definition to use zod syntax with z.object() and z.string() - Simplify validation call from schema.validate() to schema.parse() - Maintain same validation rules for tx_ref, reason, amount, and meta fields
- Add .changeset/config.json with schema reference and default settings - Configure changelog generation using @changesets/cli - Set access level to restricted for package publishing - Set base branch to main for version tracking - Configure internal dependency updates to patch level - Disable automatic commit creation on version bumps
- Add bug report template with reproduction steps and environment details - Add feature request template with problem statement and proposed solution - Add question template for user inquiries - Add issue template config to disable blank issues and link to documentation - Standardize issue creation workflow with structured forms
- Add CI workflow that runs on push to main and develop branches - Add pull request trigger for main and develop branches - Configure matrix testing across Node.js versions 18.x, 20.x, and 22.x - Add steps for dependency installation with pnpm frozen lockfile - Add format check, linting, and test execution steps - Add build step to verify compilation - Add codecov integration for coverage reporting on Node.js 20.x - Automate quality checks and test execution on code changes
- Add GitHub pull request template to standardize PR submissions - Include sections for description, change type, and related issues - Add checklist for code quality, testing, and documentation requirements - Provide structure for contributors to follow when creating pull requests
- Add pre-commit hook configuration to run linting checks - Add pre-commit hook configuration to run format validation - Add pre-commit hook configuration to run test suite - Ensures code quality and consistency before commits are made
- Add ChapaErrorResponse interface for standardized error responses - Add isAxiosError type guard function to safely check Axios errors - Create types/index.ts barrel export for centralized type exports - Establish foundation for consistent error handling across the SDK
- Replace yup validation library with zod in transaction.validation.ts - Replace yup validation library with zod in transfer.validation.ts - Convert validateGetTransactionLogsOptions to synchronous function using zod.parse() - Convert validateTransferOptions to synchronous function using zod.parse() - Convert validateBulkTransferOptions to synchronous function using zod.parse() - Convert validateVerifyTransferOptions to synchronous function using zod.parse() - Extract schema definitions to module level for better reusability - Remove async/await patterns in favor of synchronous zod validation - Simplify schema definitions by removing explicit .required() calls (zod fields are required by default)
- Create axios instance factory with configurable base URL and timeout - Add request/response logging with sensitive data redaction - Implement automatic retry logic for failed requests with exponential backoff - Add debug mode for detailed request/response inspection - Sanitize headers and request/response data to prevent credential leakage - Support Bearer token authentication via secret key parameter
…idation errors - Add error handler utility to normalize axios and zod validation errors - Implement axios status code resolution for network errors (timeouts, connection refused, host unreachable) - Map axios errors to appropriate HTTP status codes (408 for timeouts, 503 for connection errors, 500 default) - Handle zod validation errors with 400 status code and first issue message - Provide consistent error response format through HttpException wrapper - Enables standardized error handling across the application for external API calls and input validation
- Add withErrorHandling generic function to wrap async operations - Integrate centralized error handling via handleChapaError - Provide reusable pattern for consistent error management across async calls
- Add WebhookPayload interface for type-safe webhook data handling - Implement verifyWebhookSignature function to validate webhook authenticity - Add constantTimeEquals helper for secure signature comparison to prevent timing attacks - Support both string and object payload formats with automatic JSON serialization - Use HMAC-SHA256 for cryptographic signature generation and validation
- Add comprehensive tests for verifyWebhookSignature utility function - Test valid signature verification with object payload - Test valid signature verification with string payload - Test detection of tampered payload signatures - Test rejection of signatures with incorrect secret - Ensure webhook signature validation works correctly before deployment
- Add payment validation tests for initialize and verify options - Add subaccount creation validation tests with split type validation - Add direct charge validation tests for mobile payment options - Add transfer validation tests for bank account transfers - Add refund validation tests for transaction refunds - Test both valid inputs and error cases for all validation schemas - Ensure zod schema validation errors are properly thrown on invalid data
- Remove verbose inline comments for cleaner configuration - Update target to ES2017 for better compatibility - Simplify lib configuration to ES2017 only - Add explicit output directory configuration (dist) - Add declaration directory mapping for type definitions - Remove JSX transpilation (react) as not needed for this project - Add Node and Jest type definitions - Consolidate and remove redundant compiler options - Improve maintainability by reducing comment clutter
- Add supported versions table with version support status - Document vulnerability reporting process and contact information - Include response time expectations for security issues - Add disclosure policy for coordinated vulnerability announcements - List security best practices for library users - Document available security features including webhook verification and type-safe validation - Establish clear guidelines for responsible disclosure
- Add Rollup configuration with CommonJS and ESM output formats - Configure TypeScript plugin to compile source files with sourcemap support - Set up node-resolve and commonjs plugins for dependency resolution - Mark axios, nanoid, nanoid-dictionary, and zod as external dependencies - Add rollup-plugin-dts for bundled type definitions generation - Enable sourcemaps for both output formats to aid debugging
- Add Chapa class integration tests covering transaction initialization, verification, and mobile payments - Add error handler utility tests for axios and validation error handling - Add HTTP exception tests for error response handling - Add utility function tests for common helper functions - Add refund endpoint tests with improved coverage - Ensure all core SDK functionality is properly tested with mocked axios instances
- Add comprehensive Code of Conduct document outlining community standards - Define positive behavior expectations including inclusivity and respect - Document unacceptable behaviors and enforcement procedures - Establish clear reporting mechanism for violations - Adapt from Contributor Covenant v2.0 for consistency with industry standards
- Add root EditorConfig configuration file for project-wide editor settings - Configure UTF-8 charset and LF line endings for all files - Set 2-space indentation for consistent code style across the project - Enable automatic final newline insertion and trailing whitespace trimming - Preserve trailing whitespace in Markdown files for proper formatting - Ensure consistent YAML indentation settings - Standardize development environment configuration across team members
- Add .npmignore to exclude source files, configs, and dev dependencies from npm package - Add .nvmrc to specify Node.js version 20.10.0 for consistent development environment - Add .prettierrc with code formatting rules (80 char width, semicolons, single quotes, trailing commas) - Add eslint.config.js with TypeScript and Jest support for comprehensive linting coverage - Ensures consistent code quality and formatting across the project and for contributors
- Add comprehensive CHANGELOG.md documenting v2.3.0 features and improvements - Add CONTRIBUTING.md with guidelines for bug reports, feature requests, and pull requests - Add bump.config.json for version management configuration - Include development setup instructions and coding standards - Document project structure and testing guidelines - Establish contribution workflow and commit message conventions
Contributor
Author
|
@fireayehu what do you think about this changes? |
- Remove codecov badge link from README shields section - Simplify badge display by removing coverage tracking reference
fireayehu
requested changes
Feb 13, 2026
haxurn
commented
Feb 13, 2026
Contributor
Author
haxurn
left a comment
There was a problem hiding this comment.
Thanks for the feedback earlier. I’ve addressed all the requested changes and updated the implementation accordingly. Everything should now align with the project’s expectations. Looks good from my side ready to merge to main when you are.
…ssary async from genTxRef
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Major improvements to the chapa-nodejs SDK including modernized build system, enhanced error handling, comprehensive testing, and complete documentation.
Breaking Changes
Core Improvements
Error Handling
withErrorHandling()wrapper to eliminate duplicate try-catch blocksBuild System
dist/index.js) and ESM (dist/index.esm.js) bundlesValidation
awaitcalls)HTTP Client
Testing
CI/CD
Documentation
Developer Experience
.nvmrcfor Node version management.editorconfigfor consistent coding style.gitignoreand.npmignoreFiles Changed
src/chapa.ts,src/error-handler.ts,src/utils.ts,src/axios-instance.ts,src/webhook.tssrc/validations/migrated to Zodtest/*.test.ts(7 test files)package.json,tsconfig.json,rollup.config.mjs,jest.config.js.github/workflows/ci.yml,.github/workflows/publish.yml.github/ISSUE_TEMPLATE/*,.github/PULL_REQUEST_TEMPLATE.mdREADME.md,CONTRIBUTING.md,SECURITY.md,CODE_OF_CONDUCT.md.nvmrc,.editorconfig,.gitignore,.npmignore,.husky/pre-commitTesting
Checklist