feat: add new api clients and improve docs#423
Merged
armando-rodriguez-cko merged 20 commits intomasterfrom Mar 3, 2026
Merged
feat: add new api clients and improve docs#423armando-rodriguez-cko merged 20 commits intomasterfrom
armando-rodriguez-cko merged 20 commits intomasterfrom
Conversation
- Add FORWARD_SANDBOX_URL and FORWARD_LIVE_URL to config types - Add IDENTITY_VERIFICATION_SANDBOX_URL and IDENTITY_VERIFICATION_LIVE_URL to config types - Update AuthenticationError, ActionNotAllowed, NotFoundError to include error parameter and body property in error types
- Update error handling table: 401/403/404 now include error.body with details - Update test count from 813+ to 816 tests - Extract contributing guidelines to CONTRIBUTING.md - Remove broken RunKit section - Add link to CONTRIBUTING.md in README footer
… dedicated modules Split monolithic Checkout.js into specialized modules for better maintainability: - auth-builder.js: Centralized authentication configuration (OAuth, static keys, env vars) - special-urls.js: Service-specific URL calculation (files, transfers, balances, etc.) - endpoints-factory.js: Factory pattern for API endpoint initialization Reduces Checkout.js from ~200 lines to ~46 lines while improving code organization and testability.
Enhanced HTTP service layer with better error handling and response processing: - Improved error body propagation for 401/403/404 responses - Better handling of empty responses and edge cases - Refactored request/response processing for consistency - Enhanced error messages with more context These improvements provide better debugging information and more reliable error handling across all API endpoints.
…d submodules Extracted Platforms API into focused, maintainable submodules: - subentity.js: Sub-entity onboarding and management operations - files.js: File upload and retrieval for identity documentation - payment-instruments.js: Payment instrument management for payouts - payout-schedules.js: Payout schedule configuration - reserve-rules.js: Reserve rule management with ETag support Main Platforms class now delegates to submodules while maintaining backward compatibility through proxy methods. Reduces platforms.js from ~500 lines to ~106 lines. Includes TypeScript definitions for all new submodules with proper typing for method signatures and optional parameters.
…nd documentation Updated all API endpoint clients to leverage enhanced HTTP service layer: - Account Updater: Improved error handling - Apple Pay: Enhanced request validation - Balances: Better response processing - Customers: Updated documentation and error handling - Events: Improved query parameter handling - Forex: Enhanced error messages - Forward: Better request processing - Hosted Payments: Updated error handling - Identities (all submodules): Improved error propagation - Instruments: Added 204 No Content response handling - Payment Contexts: Enhanced validation - Reconciliation: Better error messages - Risk: Improved request handling - Sources: Enhanced error handling - Transfers: Updated documentation - Workflows: Better response processing All clients now benefit from improved error body propagation and more consistent error handling patterns.
…t and integration folders Major restructuring of test suite for better organization and maintainability: Reorganized test modules: - Identities: Split into submodules (aml-screenings, applicants, face-authentications, id-document-verifications, identity-verifications, delegation) - Issuing: Split into submodules (access, cardholders, cards, control-groups, control-profiles, controls, digital-cards, disputes, simulate, transactions) - Platforms: Split into submodules (files, payment-instruments, payout-schedules, reserve-rules, subentity) - Instruments: Split into unit and integration tests Renamed for consistency: - card-metadata.js → card-metadata-unit.js - customers.js → customers-unit.js - Added corresponding *-it.js files for integration tests Deleted consolidated monolithic test files: - test/balances/balances.js (split into unit/integration) - test/instruments/instruments.js (440 lines → modular structure) - test/issuing/issuing-it.js, issuing-unit.js (split into submodules) - test/identities/*-unit.js, identities-it.js (split into submodules) - test/platforms/platforms-unit.js (split into submodules) - test/reconciliation/reconciliation.js (split into unit tests) - test/reports/reports.js (split into unit tests) - test/risk/risk.js (split into unit tests) Updated all existing tests: - Enhanced test coverage for new error handling - Updated assertions for improved HTTP responses - Added tests for 204 No Content handling in instruments - Improved test organization and naming conventions Total: ~51 new/reorganized test files with better separation of concerns between unit and integration tests.
Updated documentation to reflect architectural improvements: - Added documentation for new modular structure - Enhanced configuration examples with subdomain usage - Updated API client usage examples - Improved error handling documentation - Added examples for Platforms submodules - Updated installation and setup instructions Updated .gitignore: - Added .cursor/ directory - Added docs/ directory for generated documentation - Added *_REVIEW.md pattern for review files - Added swagger-spec.json and swagger.* patterns - Improved organization and comments These changes provide better guidance for SDK users and contributors, reflecting the improved architecture and new capabilities.
|
david-ruiz-cko
approved these changes
Mar 2, 2026
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.



Add new API clients and improve project documentation
📋 Summary
This PR adds support for 5 new API clients, updates 36 existing endpoints, improves project documentation, fixes a critical error handling bug, and enhances overall code quality. The SDK now provides comprehensive coverage of the Checkout.com API with better developer experience.
✨ New Features
New API Clients Added
Account Updater (
cko.accountUpdater)Network Tokens (
cko.networkTokens)Payment Methods (
cko.paymentMethods)Identities - Complete identity verification suite (
cko.identities)Issuing - 10 new submodules (
cko.issuing)🔄 Updates to Existing Endpoints
Updated 36 existing API endpoint implementations to align with latest API specifications:
📚 Documentation Improvements
README.md
error.bodyinformationNew Files
TypeScript Definitions
FORWARD_SANDBOX_URL,FORWARD_LIVE_URL,IDENTITY_VERIFICATION_SANDBOX_URL,IDENTITY_VERIFICATION_LIVE_URLAuthenticationError,ActionNotAllowed,NotFoundErrorto includebodyproperty🐛 Bug Fixes
Critical Error Handling Fix
Issue: Error responses for 401/403/404 status codes were not propagating response body details to merchants, preventing visibility into error causes (e.g., "card_not_enrolled" in Sessions endpoint 403 responses).
Solution:
AuthenticationError,ActionNotAllowed,NotFoundErrorconstructors to accept and store error bodydetermineErrorfunction to passawait errorJSONto these error classesImpact: Merchants can now access detailed error information via
error.bodyfor better debugging and error handling.🔧 Configuration & Metadata Improvements
package.json
LICENSE
.npmignore
jsconfig.json
eslint.config.js
prefer-const,no-var,eqeqeq,no-throw-literal,prefer-promise-reject-errors🧪 Testing
🔍 Code Quality
EnvironmentSubdomain.jsandfiles.js📦 Commits Breakdown
feat(account-updater): Add Account Updater API clientfeat(identities): Add Identities API with all submodules (6 submodules)feat(issuing): Add new Issuing submodules (10 submodules)feat(network-tokens): Add Network Tokens API clientfeat(payment-methods): Add Payment Methods API clientfeat: Integrate new API clients into SDK (Checkout.js, index.js exports)feat: Update existing API endpoints (36 modules)test(payment-setups): Add comprehensive test coveragedocs: Rewrite README with improved structure and HTTP client documentationchore: Update package metadata, LICENSE, .npmignore, jsconfig.jsonchore: Improve code quality with ESLint rules and remove unused variablesfix: Propagate error body for 401/403/404 status codesdocs(types): Add missing config URLs and update error typesdocs: Update README and extract CONTRIBUTING to separate fileNone. All changes are backwards compatible. Existing code will continue to work without modifications.
🎯 Migration Notes
cko.paymentsinstead)error.bodynow available for 401/403/404 responses✅ Checklist
📸 Test Results
Ready for review and merge to master. This PR significantly expands SDK capabilities while maintaining high code quality and test coverage.