hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

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

Open bsayak03 opened this issue 4 months ago • 0 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/nuvei.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 19:09 bsayak03

It should update automatically when new data arrives. By default this is every 60 seconds.

If that doesn't happen, it may be an issue with the proxy. See this section of the docs for more info. This is a known issue with Coolify, for example, but it's an easy fix in the service settings.

We haven't added custom intervals yet. We will at some point, but will likely restrict the lower end to something like 10 or 15 seconds. But we may allow lower on the system details page if you are actively viewing a specific system.

henrygd avatar Apr 16 '25 22:04 henrygd

We haven't added custom intervals yet. We will at some point

Yes please, as 60s for a monitoring system seems a very high value.

Also, SSH may not be the best option to communicate between Hub and Agent, gRPC would be a very better option and this would allow for near real time.

See https://goteleport.com/blog/improving-ssh-speeds/

solracsf avatar Apr 21 '25 12:04 solracsf

The SSH connection is persistent, so it's not a limiting factor.

The one minute interval is a design choice to keep database size and resource utilization low. Metrics like CPU are not just snapshots at that moment -- the whole time between intervals is accounted for.

We may allow something like one second intervals when viewing a system, but it would be passed directly through to the browser.

henrygd avatar Apr 21 '25 17:04 henrygd

Thanks for your feedback.

We're "monitoring" Beszel as a replacement for Nezha, but (near) real-time is the only thing that stops us from migration ATM.

Nezha real-time can be observed here: https://qio.ng/

Keep up your great work 🚀

solracsf avatar Apr 26 '25 08:04 solracsf

Thanks for your feedback.

We're "monitoring" Beszel as a replacement for Nezha, but (near) real-time is the only thing that stops us from migration ATM.

Nezha real-time can be observed here: https://qio.ng/

Keep up you great work 🚀

Looks like an interesting project as well — may I ask what's pushing you to migrate to beszel?

Their interface is pretty clean as well especially for many machines, definitely some good ideas there for beszel if henry sees fit.

Davdav05 avatar May 02 '25 14:05 Davdav05