hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

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

Open bsayak03 opened this issue 7 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/sift.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

If I look at the temperature graph I can see the cpu_thermal, Which matches with the reported temps on the systems it self. Are your CPU temps not reported there?

svenvg93 avatar Jan 19 '25 10:01 svenvg93

What OS is the agent system?

henrygd avatar Jan 19 '25 17:01 henrygd

If I look at the temperature graph I can see the cpu_thermal, Which matches with the reported temps on the systems it self. Are your CPU temps not reported there?

These are the only sensors I see image

TomerGamerTV avatar Jan 19 '25 18:01 TomerGamerTV

What OS is the agent system?

Windows 11 (compiled exe and using NSSM method)

TomerGamerTV avatar Jan 19 '25 18:01 TomerGamerTV

Check this thread for more info: https://github.com/henrygd/beszel/discussions/18#discussioncomment-11039049 (click on expand replies)

Try running the agent as administrator and let me know if that gives you more temps.

It may just be a limitation with WMI. I may look into the possibility of working around it via LibreHardwareMonitor in the future.

henrygd avatar Jan 19 '25 18:01 henrygd

Check this thread for more info: https://github.com/henrygd/beszel/discussions/18#discussioncomment-11039049 (click on expand replies)

Try running the agent as administrator and let me know if that gives you more temps.

It may just be a limitation with WMI. I may look into the possibility of working around it via LibreHardwareMonitor in the future.

That might be a bit problematic, it's going to become annoying real fast when I have to accept admin prompts every startup...

TomerGamerTV avatar Jan 19 '25 19:01 TomerGamerTV

Hey! I Just got the monitoring set up on 2 Linux machines and a few Windows machines. Is there a solution to getting Windows 11 (NSSM Method) to report CPU temps? I am only seeing the GPU even when I set the program to run as admin... I am willing to help find a solution.

Image

Just for reference, here's my NAS:

Image

StevensPCService avatar Jan 24 '25 14:01 StevensPCService

I'm having the same issue, AMD 7950X3D if it matters for Intel vs AMD. Running the agent as admin doesn't help.

renegadepixels avatar Feb 11 '25 19:02 renegadepixels

I have no temp showing for AMD Ryzen 7 7800X3D on windows using 0.10.2; let me know if you need any further information or what can be done to help resolve this

Slip-Up avatar Mar 29 '25 16:03 Slip-Up

Any updates?

TomerGamerTV avatar Apr 24 '25 14:04 TomerGamerTV

I'm also experiencing the same issue with an AMD Ryzen 7 5800X3D on Windows 11 running beszel-agent 0.10.2 as admin

harryscheiner avatar Apr 24 '25 16:04 harryscheiner

Getting temps with WMI is apparently hit or miss depending on hardware.

I can probably add a fallback to pull temperatures from Libre Hardware Monitor (LHM), but this would require LHM to be running in the background. It does have an option built-in to run on startup. Is anyone interested in this?

henrygd avatar Apr 24 '25 18:04 henrygd

Just installed beszel today and same issue with an AMD Ryzen 7 7700X on Windows 11 Pro 24H2 using NSSM binary install

danlivingston avatar May 04 '25 21:05 danlivingston

Interested with the LHM approach, but is there any hack around to push sensor datas to beszel?

justinmahendra avatar May 08 '25 05:05 justinmahendra

Anyone get a workaround? Like others, I only see my RTX 5090 temp. It would be nice to have CPU temps, and ideally other sensors such as drive temps, motherboard, AIO temps etc. With summer coming around, having that data would be helpful for sure!

jayjay181818 avatar May 21 '25 18:05 jayjay181818

I'll see if it's possible to embed the LHM dll. See discussion https://github.com/henrygd/beszel/discussions/829.

henrygd avatar May 22 '25 18:05 henrygd

Also noticed that Intel CPU i7 12700k temps aren't logged in Windows, only GPU and some sensors, same as TomerGamerTV.

Sn00zEZA avatar May 23 '25 10:05 Sn00zEZA

I made a test program that embeds LibreHardwareMonitorLib. I can add the same functionality to Beszel if it works for everyone.

It matches what LHM reports on my one Windows machine (old laptop with only three sensors). The CPU temperature jumps around more than I would expect, but that may be an issue with the laptop.

The one big downside is that it has to be run as administrator to get the data, just like LHM itself. Not thrilled about that but don't know a way around it. The alternative would be to run LHM outside Beszel and interact through WMI.

Here's a link to the repo and a prebuilt executable. It should print all sensors every second or so. Let me know how it goes if you test it.

https://github.com/henrygd/lhw-go

https://static.beszel.dev/discussions/829/get_temps.exe (2.9 MB)

.\get_temps.exe
sha256sum get_temps.exe
61b6d7f161b7e03ef75024f896cbff7a1a3da194a8453909191547810b7eeb85  get_temps.exe

henrygd avatar May 26 '25 22:05 henrygd

Running as standard user

Image

Running with administrator rights

Image

Sn00zEZA avatar May 27 '25 06:05 Sn00zEZA

@Sn00zEZA Thanks, good job on your cooling.

I just updated the exe to exclude the TJMax values and show what device the Temperature x readings are coming from.

henrygd avatar May 27 '25 18:05 henrygd

Just some good old aircooling :)

Running as standard user

Image

Running as Administrator

Image

Sn00zEZA avatar May 27 '25 18:05 Sn00zEZA

Thanks, I fixed the float parsing issue and made sure the sensor names are unique. Otherwise it would be a problem if you had more than one of the same Samsung drive.

henrygd avatar May 27 '25 19:05 henrygd

Looking good now. Nice work.

Running as standard user

Image

Running as Administrator

Image

Only have one Samsung NVME, but its seems like it has multiple sensors

Image

Sn00zEZA avatar May 27 '25 19:05 Sn00zEZA

I tried the .exe and I am not getting CPU or discrete GPU temps as standard user or admin. I have a 9070 xtx and 7950x3d, it is only pulling the temperature from the motherboard graphics. LHM is able to see both and pull the main temp, even though it's not showing the individual core temps, just having the main one would be good enough for monitoring

Edit: sorry I misread the screenshot, it is pulling all GPU temps, just showing them in one line, so that is working. Just the CPU temp is not working.

Image

renegadepixels avatar May 28 '25 19:05 renegadepixels

@renegadepixels Are you running as administrator? If not, please try it.

henrygd avatar May 28 '25 20:05 henrygd

I made a test program that embeds LibreHardwareMonitorLib. I can add the same functionality to Beszel if it works for everyone. https://static.beszel.dev/discussions/829/get_temps.exe (2.9 MB)

Works for me too: as regular user it only pulls GPU temps, but as administrator it pulls both GPU and CPU. LibreHardware also has motherboard's info temp which could also be added (it has its own reading of CPU, System, VRM, PCH, CPU Socket, PCle, M2, ...). Interestingly however it doesn't display temperature from memory sticks for example, even though HWMonitor/HWinfo64 etc. are able to read it.

DavidFelsen avatar Jun 02 '25 14:06 DavidFelsen

@DavidFelsen Thanks, I updated it to check for sensors in subhardware. Maybe it will show the other temps now.

henrygd avatar Jun 02 '25 20:06 henrygd

@DavidFelsen Thanks, I updated it to check for sensors in subhardware. Maybe it will show the other temps now.

Assuming you updated the file at the same location, it's not showing more devices on my machine.

DavidFelsen avatar Jun 06 '25 16:06 DavidFelsen

@henrygd Can confirm your program does work, does it mean it will be implemented into the official client?

Image

TomerGamerTV avatar Jul 12 '25 14:07 TomerGamerTV

Si

henrygd avatar Jul 12 '25 18:07 henrygd