feat(connector): [GLOBEPAY] Add Integrity Check Support for Authorize…
Type of Change
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
Added integrity check support for the GLOBEPAY connector to validate amount and currency consistency between request and response in the following flows:
- Authorize – uses
get_authorise_integrity_object() - PSync – uses
get_sync_integrity_object() - Refund (Execute) – uses
get_refund_integrity_object() - RSync – uses
get_refund_integrity_object()
Changes Made
- Added optional
amountandcurrencyfields to theGlobepayPaymentsResponsestructure (Authorize flow). - Added optional
amountandcurrencyfields to theGlobepaySyncResponsestructure (PSync flow). - Added optional
refund_amountandcurrencyfields to theGlobepayRefundResponsestructure (Refund/RSync flows). - Implemented integrity checks in all
handle_responsefunctions for the above flows. - Each flow now extracts
amount/currencyfrom the response (with fallback to request data) and validates against the integrity object.
Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Motivation and Context
Closes #9180
Integrity checks ensure data consistency and security by validating that the amount and currency received from the connector match what was sent in the request. This prevents discrepancies in payment processing flows.
How did you test it?
- Code follows the same integrity check pattern as in Xendit (#8049), Fiserv (#8075), Hipay (#9184), and Checkbook (#9160).
- To test: hardcode mismatched amount or currency values in the connector request to trigger the integrity check failure.
Checklist
- [x] Code formatted using
cargo +nightly fmt --all - [ ] Addressed lints from
cargo clippy - [x] Reviewed submitted code
- [ ] Added unit tests where applicable
Files Changed
crates/hyperswitch_connectors/src/connectors/globepay.rscrates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
Note: Unit tests were not added since integrity checks are typically verified through integration tests with live connector responses.
Changed Files
| File | Status |
|---|---|
Hi @yashranaway,
Please run cargo run command and resolve errors.
Hi @yashranaway, Please run
cargo runcommand and resolve errors.
let me know if there are any more