feat(connector): add integrity check support for thunes authorize, ps…
Fixes juspay/hyperswitch#9992
Type of Change
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
This PR adds integrity check support for the Thunes connector across multiple payment flows:
- Payment Authorization flow: Added integrity object validation for authorized payments
- Payment Sync (PSync) flow: Added integrity object validation for payment status synchronization
- Refund Execute flow: Added integrity object validation for refund creation
- Refund Sync (RSync) flow: Added integrity object validation for refund status synchronization
Changes Made
1. Updated crates/hyperswitch_connectors/src/connectors/thunes.rs:
- Changed import to use
utils as connector_utilsfor better clarity - Added
get_authorise_integrity_object()call in authorize response handling - Added
get_sync_integrity_object()call in payment sync response handling - Added
get_refund_integrity_object()call in refund execute response handling - Added
get_refund_integrity_object()call in refund sync response handling - Modified response handling to store integrity objects in
router_data.request.integrity_object
2. Updated crates/hyperswitch_connectors/src/connectors/thunes/transformers.rs:
- Added
amountandcurrencyfields toThunesPaymentsResponsestruct - Added
amountandcurrencyfields toRefundResponsestruct - These fields are required for integrity validation
Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Motivation and Context
Integrity checks ensure data consistency and help detect potential issues with payment amounts and currencies during transaction processing. By adding integrity validation for Thunes connector flows, we can:
- Validate that response amounts match expected values
- Ensure currency consistency across payment operations
- Provide additional safeguards against data corruption or manipulation
- Maintain audit trails for compliance and debugging purposes
This enhancement aligns with the existing integrity check framework used by other connectors in the codebase.
How did you test it?
- [x] Code compiles successfully without errors
- [x] No linter errors from
cargo clippy - [x] Code formatting verified with
cargo +nightly fmt --all - [ ] Manual testing with Thunes sandbox environment (pending access)
- [ ] Integration tests updated (if applicable)
The changes follow the existing pattern used in other connector implementations and utilize the standard connector_utils helper functions for integrity object creation.
Checklist
- [x] I formatted the code
cargo +nightly fmt --all - [x] I addressed lints thrown by
cargo clippy - [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
Changed Files
| File | Status |
|---|---|
Updated PR description with issue link #9992