hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

[FEATURE] : [JPMORGAN] Add Integrity Check Support for Authorize, PSync, Refund and RSync Flows

Open bsayak03 opened this issue 3 months ago • 14 comments

Feature Description/Summary

Integrity check is 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.

Context

Integrity checks in a payments flow are critical for ensuring data consistency, correctness, and security when dealing with amounts between Hyperswitch and connectors like Adyen, Stripe, Razorpay, etc.

Starter Tasks

  • In the handle_response function of Authorize/PSync/Refund/RSync, you will have to call the respective functions - get_authorise_integrity_object for Authorize, get_sync_integrity_object for Payments Sync, get_refund_integrity_object for Refund and RSync and get_capture_integrity_object for Capture.
  • You would have to call these functions from crates/hyperswitch_connectors/src/utils.rs.
  • These functions expect amount_convertor, amount and currency.
  • You can take a look at this PR for reference.

Implementation Hints

  • You can go to crates/hyperswitch_connectors/src/connectors/jpmorgan.rs and call the respective integrity check function as stated above in the handle_response function

Acceptance Criteria

  • [ ] Request and Response body added for each of the flows where integrity check is applied.
  • [ ] All the required GitHub checks passing
  • [ ] Formatted the code using cargo +nightly fmt --all

How to Test it

  • Hardcode the amount or currency field that is being passed to the connector different from the one you are passing in the request body
  • This way you would be able to reproduce the integrity checks error message while testing.

Mentor Contact

  • Tag @bsayak03 [Sayak Bhattacharya] in the comments if you have any doubts/queries

Resources

Here are a few sample PRs :

  • https://github.com/juspay/hyperswitch/pull/8075
  • https://github.com/juspay/hyperswitch/pull/8049

Pre-Flight

Have you spent some time checking if this feature request has been raised before?

  • [x] I checked and didn't find a similar issue

Have you read the Contributing Guidelines?

Submission Process:

  • Ask the maintainers for assignment of the issue, you can request for assignment by commenting on the issue itself.
  • Once assigned, submit a pull request (PR).
  • Maintainers will review and provide feedback, if any.
  • Maintainers can unassign issues due to inactivity, read more here.

Refer here for Terms and conditions for the contest.

bsayak03 avatar Sep 01 '25 18:09 bsayak03

Hi @bsayak03, i'd like to work on the issue, could you please assign it to me.

rahulshendre avatar Oct 01 '25 07:10 rahulshendre

Hi @bsayak03, i'd like to work on the issue, could you please assign it to me.

Assigning it to you @rahulshendre

bsayak03 avatar Oct 01 '25 08:10 bsayak03

Hi @bsayak03 , I looked into the issue, cloned the project, read the files but realized it’s currently beyond my skill level. Could you please unassign me so someone else can take it up? Thank you for understanding

rahulshendre avatar Oct 08 '25 15:10 rahulshendre

Hi @bsayak03 , I looked into the issue, cloned the project, read the files but realized it’s currently beyond my skill level. Could you please unassign me so someone else can take it up? Thank you for understanding

Sure, no issues @rahulshendre

bsayak03 avatar Oct 09 '25 05:10 bsayak03

@bsayak03 Could you assign me this issue?

thisis-gp avatar Oct 11 '25 15:10 thisis-gp

@bsayak03 I have done the required changes but how do i build and test the changes using cURL

kunalsinghdadhwal avatar Oct 12 '25 09:10 kunalsinghdadhwal

Hi @bsayak03 , I would like to work on this and contribute as part of hacktoberfest. Can you please assign me this issue?

vishnup2002 avatar Oct 13 '25 08:10 vishnup2002

I would like to work on this issue as well

suraj-mandal avatar Oct 16 '25 06:10 suraj-mandal

If no one is working, I would like to have a look at this issue.

suraj-mandal avatar Oct 16 '25 06:10 suraj-mandal

Have made the changes. Now need to test

suraj-mandal avatar Oct 16 '25 16:10 suraj-mandal

@bsayak03 , I have made the changes. Before I provide the pull request, I would like to have some help regarding how I can test these changes. From where do I get the payload, and which endpoint to hit? It would be helpful if you could point me in the right direction. Thanks!

suraj-mandal avatar Oct 16 '25 16:10 suraj-mandal

I am drafting a PR as of now, with the changes

suraj-mandal avatar Oct 16 '25 16:10 suraj-mandal

I have attached the PR here: https://github.com/juspay/hyperswitch/pull/9893 @bsayak03 . Kindly check!

suraj-mandal avatar Oct 16 '25 17:10 suraj-mandal

I am creating a fresh PR for this, as I accidentally, used the main branch and pushed changes there.

suraj-mandal avatar Nov 01 '25 08:11 suraj-mandal