Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(connector): [Paypal]Enhance currency Mapping with ConnectorCurrencyCommon Trait #2191

Merged
merged 3 commits into from
Sep 26, 2023

Conversation

srujanchikke
Copy link
Contributor

Type of Change

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

Description

Problem : Currently, amount mapping for different connectors are handled by hard coding dollars/cents which has been leading to multiple bugs due to incorrect mapping. Need to handle this better in code by having separate types for dollar vs cents .

Solution : To address this issue and improve code maintainability, this pull request introduces the get_currecny_unit from ConnectorCommon trait. This function allows connectors to declare their accepted currency unit as either "Base" or "Minor" .

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Implement the ConnectorCurrencyCommon trait, where you can declare the accepted currency unit (either Base or Minor) using the get_currency_unit method in ConnectorCommon trait .

How did you test it?

tested it locally

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
  • I added a CHANGELOG entry if applicable

@srujanchikke srujanchikke added A-connector-integration Area: Connector integration S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-refactor Category: Refactor labels Sep 20, 2023
@srujanchikke srujanchikke self-assigned this Sep 20, 2023
@srujanchikke srujanchikke requested a review from a team as a code owner September 20, 2023 06:59
ArjunKarthik
ArjunKarthik previously approved these changes Sep 21, 2023
prasunna09
prasunna09 previously approved these changes Sep 21, 2023
Copy link
Contributor

@prasunna09 prasunna09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please test for one zero decimal currency, two-decimal, and three-decimal, and confirm whether it is working as expected?

@srujanchikke
Copy link
Contributor Author

Can you please test for one zero decimal currency, two-decimal, and three-decimal, and confirm whether it is working as expected?
tested with both USD and JPY

Screenshot 2023-09-22 at 3 43 48 PM Screenshot 2023-09-22 at 3 44 43 PM

@ArjunKarthik ArjunKarthik added this pull request to the merge queue Sep 26, 2023
@ArjunKarthik ArjunKarthik added S-ready-for-merge and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Sep 26, 2023
Merged via the queue into main with commit 2e97869 Sep 26, 2023
10 checks passed
@ArjunKarthik ArjunKarthik deleted the paypal_currency_conversion branch September 26, 2023 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-integration Area: Connector integration C-refactor Category: Refactor
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

4 participants