Skip to content

Conversation

@YabetsZ
Copy link

@YabetsZ YabetsZ commented Nov 2, 2025

Pull Request

Short description

  • What: Implements support for 12 new official API endpoints across four core domains: Transactions, Transfers, Banking, and Direct Charges.
  • Why: To achieve near-complete SDK coverage of the official documentation and enhance utility for complex payment flows (e.g., transfers, direct charges).
  • How:
    Here are the list of things changed:
    • Documentation was revised to reflect the new feature set and generated API items.
    • Initial work for the encryption feature is underway, though it remains fully unimplemented in this PR.
    • The utils feature flag is finished, including the transaction reference generator functionality.
    • New Modules and 14 Endpoints Added:
      • The bulk of this work covers creating models, integration tests, and examples for all new endpoints.

Checklist

  • PR targets the correct branch
  • Code compiles without errors
  • Tests added/updated or not applicable
  • CI passes
  • Docs/CHANGELOG updated if needed
  • PR follows Conventional Commits (feat:, fix:, docs:, etc.)

Testing

  • Run: make check
  • Notes: Running make check will execute the extensive suite of newly added test cases covering all endpoints.
    @isrugeek

Note

Implements new Banking, Transactions, Transfers, and Direct Charge APIs with models, tests, examples, plus utils (tx_ref), feature flags, and docs/config updates.

  • Core API (client):
    • Add endpoints: banks, balances, balances/{currency}, swap; transaction/initialize, transaction/verify/{tx_ref}, transactions, transaction/events/{tx_ref}; transfers (initiate), transfers/verify/{reference}, bulk-transfers, transfers?batch_id=..., transfers (list); charges?type=..., validate?type=....
  • Models & Responses:
    • New/expanded models: bank::{BalanceData, SwapOptions, SwapData}, payment::{VerifyPaymentData, TransactionLog, GetTransactionsData, Transaction, Pagination}, direct_charge::{DirectChargeType, DirectChargeOptions, VerifyDirectChargeOption, DirectChargeData}, transfer::{TransferOptions, VerifyTransferData, BulkTransferOptions, BulkData, BulkTransferData, TransfersData, TransferMeta}.
    • Generic response types: ChapaResponse, ChapaResponseWithMeta; add DirectChargeVerifyResponse.
    • Remove legacy models/transaction.rs (consolidated into payment.rs).
  • Config & Error:
    • ChapaConfig gains optional encryption support (feature-gated), builder env defaults; fields made crate-visible; add MissingEncryptionKey; add JsonError.
  • Utils & Features:
    • Add utils module with generate_tx_ref (feature utils).
    • Scaffold chapa_encrypt::encrypt_data behind encryption feature (unimplemented).
  • Examples & Tests:
    • Add examples for balances, transactions/logs, transfers (single/bulk), swap, tx_ref generation.
    • Extensive integration tests for all new endpoints using mockito.
  • Project setup:
    • Crate name normalized to chapa_rust; add optional deps (des, base64, rand) and feature flags; .env.example adds ENCRYPTION_KEY; makefile docs with --all-features; README updated.

Written by Cursor Bugbot for commit 047e845. This will update automatically on new commits. Configure here.

- implemented transaction logs retrieval
- added methods for bank transfer and bulk transfer
- updated response models to include new transfer data
- Added integration tests inside `tests/` directory and moved some of the tests inside `client.rs` to it since they weren't unit tests anyways.
- Removed transaction model and related structures
- Added comprehensive tests for transaction and transfer functionalities including initialization, verification, and bulk transfers.
- Added integration tests inside `tests/` directory and moved some of the tests inside `client.rs` to it since they weren't unit tests anyways.
- Removed transaction model and related structures
- Added comprehensive tests for transaction and transfer functionalities including initialization, verification, and bulk transfers.
- implement get_balances and get_balances_by_currency methods
- add swap_currencies method for currency conversion
- introduce BalanceData and SwapOptions models
- update response types for balances and swaps
- add integration tests for new functionalities
- Implement direct charge initiation and verification methods
- Add models for direct charge options and responses
- Enhance error handling for JSON serialization issues
- add optional encryption key support in configuration
- though not implemented fully, made a way for the implementation of 3DES
- create encryption utility module
- update dependencies for encryption functionality
- added examples for bulk transfer, getting balances,
  getting transactions and logs, getting transfers,
  swapping currencies, and transferring with verification
- edited and added documentation
- include utility function to generate transaction references
- add options struct for customization of generated references
- update Cargo.toml and Cargo.lock to include rand dependency
- modify documentation generation command in makefile
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.

1 participant