hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(connector): [GLOBEPAY] Add Integrity Check Support for Authorize…

Open yashranaway opened this issue 2 months ago • 3 comments

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

  1. Added optional amount and currency fields to the GlobepayPaymentsResponse structure (Authorize flow).
  2. Added optional amount and currency fields to the GlobepaySyncResponse structure (PSync flow).
  3. Added optional refund_amount and currency fields to the GlobepayRefundResponse structure (Refund/RSync flows).
  4. Implemented integrity checks in all handle_response functions for the above flows.
  5. Each flow now extracts amount/currency from 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.rs
  • crates/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.

yashranaway avatar Oct 07 '25 16:10 yashranaway

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/globepay.rs  11% smaller
  crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs  0% smaller

semanticdiff-com[bot] avatar Oct 07 '25 16:10 semanticdiff-com[bot]

Hi @yashranaway, Please run cargo run command and resolve errors.

Anurag-05-prog avatar Oct 15 '25 11:10 Anurag-05-prog

Hi @yashranaway, Please run cargo run command and resolve errors.

let me know if there are any more

yashranaway avatar Oct 15 '25 17:10 yashranaway