hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(router): [Nuvei] add amount conversion framework for connectors

Open kaustubh1106 opened this issue 1 year ago • 1 comments

Type of Change

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

Description

This feature introduces a new Unit struct along with the MinorUnit type to standardize amount handling across all connectors within the application. The primary objective is to centralize the conversion logic within the core framework, eliminating the need for each connector to handle its own conversion.

By standardizing the format and placing the conversion logic in one location, this change simplifies the codebase and reduces potential inconsistencies in how amounts are managed across different connectors. Each connector can now simply invoke the convert function to receive amounts in their required format, based on their documentation.

This update will make future modifications and bug fixes easier to implement, as all amount conversions are now handled by a single, unified system.

fixes #6023

Checklist

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

kaustubh1106 avatar Sep 30 '24 16:09 kaustubh1106

Review changes with SemanticDiff.

Analyzed 4 of 4 files.

Overall, the semantic diff is 11% smaller than the GitHub diff.

Filename Status
:heavy_check_mark: crates/router/tests/connectors/nuvei.rs Analyzed
:heavy_check_mark: crates/router/src/types/api.rs Analyzed
:heavy_check_mark: crates/router/src/connector/nuvei.rs 19.78% smaller
:heavy_check_mark: crates/router/src/connector/nuvei/transformers.rs Analyzed

semanticdiff-com[bot] avatar Sep 30 '24 16:09 semanticdiff-com[bot]

Add the amount conversion for the following api flows as well: Authorize, Preprocessing, and CompleteAuthorize

Sakilmostak avatar Oct 06 '24 15:10 Sakilmostak

Add the amount conversion for the following api flows as well: Authorize, Preprocessing, and CompleteAuthorize

hey @kaustubh1106 kindly look into the changes requested

mrudulvajpayee4935 avatar Oct 08 '24 11:10 mrudulvajpayee4935

@mrudulvajpayee4935 sure

kaustubh1106 avatar Oct 10 '24 08:10 kaustubh1106

Hey @kaustubh1106 Were you able to work on the changes?

gorakhnathy7 avatar Oct 15 '24 11:10 gorakhnathy7

Hi @kaustubh1106 Please compile the code before raising the pr cargo build

deepanshu-iiitu avatar Oct 17 '24 06:10 deepanshu-iiitu

Hey @kaustubh1106 any update on the changes!

gorakhnathy7 avatar Oct 24 '24 10:10 gorakhnathy7