Skip to content

Conversation

TharunChinnannagari
Copy link

feat(connector): [PAYPAL] Add Integrity Check for Authorize, PSync, Refund & RSync

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

In this PR, we have added integrity checks for Authorize, PSync, Refund and RSync flows for PayPal Connector.

What is an integrity check?
A scenario where there is a discrepancy between the amount sent in the request and the amount received from the connector, which is checked during response handling.

Implementation details:

  • Added integrity check calls in handle_response functions for each flow in crates/hyperswitch_connectors/src/connectors/paypal.rs
  • Utilized existing utility functions from crates/hyperswitch_connectors/src/utils.rs:
    • get_authorise_integrity_object for Authorize flow
    • get_sync_integrity_object for PSync flow
    • get_refund_integrity_object for Refund and RSync flows
  • Made necessary fields public in crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs to access amount and currency data from PayPal responses
  • Added amount field to RefundSyncResponse struct for proper refund sync validation
  • Implemented fallback logic for cases where amount/currency may not be directly available in connector response (e.g., redirect flows, 3DS flows)

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Motivation and Context

How did you test it?

Checklist

  • [X ] I formatted the code cargo +nightly fmt --all
  • [ X] I addressed lints thrown by cargo clippy
  • [ X] I reviewed the submitted code
  • [X ] I added unit tests for my changes where possible

@TharunChinnannagari TharunChinnannagari requested review from a team as code owners October 10, 2025 08:10
Copy link

semanticdiff-com bot commented Oct 10, 2025

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.

1 participant