feat(connector): [CYBERSOURCE] add integrity check support for Authorize, PSync, Refund, and RSync flows #9798
+94
−26
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.
Type of Change
Description
This PR adds Integrity Check support for the Cybersource connector across the following payment flows:
The integrity check ensures that the
amount
andcurrency
values returned by the connector match the values originally sent in the request. This verification helps maintain transaction accuracy and consistency between Hyperswitch and the connector.Key Implementation Details
Added calls to the appropriate integrity helper functions from
crates/hyperswitch_connectors/src/utils.rs
:get_authorise_integrity_object
get_sync_integrity_object
get_refund_integrity_object
get_capture_integrity_object
(where applicable)Attached the generated integrity object to each flow’s request before returning the response.
Ensured compatibility across both
v1
and non-v1
feature flags.Verified code formatting, linting, and successful build checks.
Additional Changes
Motivation and Context
Integrity checks are critical to prevent data mismatches and ensure reliable reconciliation between Hyperswitch and external connectors.
This feature aligns Cybersource with other connectors (like Adyen, Stripe, and Razorpay) that already support similar validation.
Fixes: #9165
How did you test it?
amount
andcurrency
values locally to trigger and verify integrity check errors.cargo check
,cargo +nightly fmt --all
, andcargo clippy
to confirm code quality and correctness.Checklist
cargo +nightly fmt --all
cargo clippy