hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

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

Open bsayak03 opened this issue 3 months ago • 3 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/tsys.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 20:09 bsayak03

Hello there, I'm interested to work on above issue, pl assign me!

Jatan196 avatar Sep 04 '25 11:09 Jatan196

Hi @Jatan196 Assigned to you

awasthi21 avatar Sep 04 '25 11:09 awasthi21

Okay ! Thank you @awasthi21 sir !

Jatan196 avatar Sep 04 '25 11:09 Jatan196

@Jatan196 - is there a PR raised for the issue? Are you still working on this?

neerajkumar-n avatar Sep 26 '25 07:09 neerajkumar-n

@neerajkumar-n Yes I'm working on it, soon be raising PR !

Jatan196 avatar Oct 03 '25 17:10 Jatan196

Hello @neerajkumar-n sir, as i'm working to add integrity check in tsys connector. I would be needing api creds to access api contract of tsys connector. As i'm unable to find api contract of tsys connector. So could you pl share the same ?

Jatan196 avatar Oct 04 '25 08:10 Jatan196

Hello @neerajkumar-n sir, as i'm working to add integrity check in tsys connector. I would be needing api creds to access api contract of tsys connector. As i'm unable to find api contract of tsys connector. So could you pl share the same ?

We would be testing this from our end. You can raise the PR and if any changes are needed then we will let you know @Jatan196

bsayak03 avatar Oct 04 '25 10:10 bsayak03

Ok @bsayak03 sir

Jatan196 avatar Oct 04 '25 11:10 Jatan196

Hello @awasthi21 @neerajkumar-n @bsayak03 Sir!! I have not recieved any fix for the connector fallback error to "amazonpay" on slack community. This is blocking me to finalising this PR. Kindly provide any suggestions so that I can pickup next issues also.

Thank you!!

Jatan196 avatar Oct 07 '25 05:10 Jatan196

Hello @awasthi21 @neerajkumar-n @bsayak03 Sir!! I have not recieved any fix for the connector fallback error to "amazonpay" on slack community. This is blocking me to finalising this PR. Kindly provide any suggestions so that I can pickup next issues also.

Thank you!!

hey @Jatan196 can you instead raise the PR for the changes requested in the issue description? We would be doing the testing stuff and if anything's needed from your end, we will reach out to you

bsayak03 avatar Oct 08 '25 06:10 bsayak03

Okay @bsayak03 Sir, Sure will be raising PR in a while. And pl let me know after that if any further changes would be needed in the PR from my end. Thank you!!

Jatan196 avatar Oct 08 '25 17:10 Jatan196

Hello sir @bsayak03 I have opened a PR for this issue. Kindly provide the review or any other necessary changes that needed to be done from my end ASAP

Thank you for your time & consideration !!

Jatan196 avatar Oct 13 '25 07:10 Jatan196