Skip to content

Conversation

@RafaelJohn9
Copy link
Member

@RafaelJohn9 RafaelJohn9 commented Jan 18, 2026

develop => main

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Updated success status validation logic across all payment modules (B2B Express Checkout, B2C, Account Top-Up, PayBill, Reversal, Transaction Status) to properly recognize success codes containing leading zeros (e.g., "0", "00000000").
  • Tests

    • Expanded test coverage for success validation logic with multiple code format scenarios across all affected payment operations.

✏️ Tip: You can customize this high-level summary in your review settings.

RafaelJohn9 and others added 2 commits January 18, 2026 10:29
…ess codes

- Update all `is_successful()` methods across B2B, B2C, Reversal, and Transaction Status schemas
- Implement robust success detection that treats any string of zeros (e.g., '0', '00000000') as success
- Add comprehensive unit tests covering zero, all-zeros, non-zero, mixed, negative, and empty codes
- Standardize import ordering in schema files
- Fix URL in B2C documentation
- Minor formatting improvements
feat(schemas): enhance is_successful logic to handle zero-padded success codes
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This pull request updates result code validation logic across multiple schema files. It modifies is_successful methods in existing schemas and adds new ones to treat result codes consisting entirely of zeros (e.g., "0", "00000000") as successful outcomes. Comprehensive unit tests validate the updated behavior.

Changes

Cohort / File(s) Summary
Schema: B2B Express Checkout & B2C
mpesakit/b2b_express_checkout/schemas.py, mpesakit/b2c/schemas.py
Updated/added is_successful methods to accept zero-filled codes as success indicators; reordered imports and added new validation methods to B2CResponse and B2CResultCallback
Schema: Account Top-Up, Business PayBill & Reversal
mpesakit/b2c_account_top_up/schemas.py, mpesakit/business_paybill/schemas.py, mpesakit/reversal/schemas.py
Updated/added is_successful methods using zero-stripping logic to evaluate result codes; import reordering and formatting adjustments
Schema: Transaction Status
mpesakit/transaction_status/schemas.py
Added is_successful method to TransactionStatusResultCallback; exported new public types TransactionStatusIdentifierType and TransactionStatusResultParameter; minor import formatting
Tests: B2C, Reversal & Transaction Status
tests/unit/b2c/test_b2c.py, tests/unit/reversal/test_reversal.py, tests/unit/transaction_status/test_transaction_status.py
Comprehensive test coverage for new is_successful implementations; added fixtures, parametrized tests for zero-filled codes, and validation of edge cases across various code representations

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Zero codes hopping through the fields so bright,
Now "0" and "00000000" both shine with success light,
From schemas deep to tests so thorough and true,
Each validation checked—the rabbit approves of you! 🎉

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@RafaelJohn9 RafaelJohn9 merged commit d8d4351 into master Jan 18, 2026
7 of 8 checks passed
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.

2 participants