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

fix(connector): [Paypal] fix amount to its currency base unit #1780

Merged
merged 4 commits into from
Jul 25, 2023

Conversation

prasunna09
Copy link
Contributor

@prasunna09 prasunna09 commented Jul 24, 2023

Type of Change

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

Description

Fix amount to its currency base unit.
ref for currency decimal - https://docs.adyen.com/development-resources/currency-codes

Additional Changes

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

Motivation and Context

How did you test it?

For JPY
Screen Shot 2023-07-24 at 7 53 27 PM

For USD, We are converting cents to dollars
Screen Shot 2023-07-24 at 7 53 59 PM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@prasunna09 prasunna09 added A-connector-integration Area: Connector integration C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Jul 24, 2023
@prasunna09 prasunna09 added this to the July 2023 Release milestone Jul 24, 2023
@prasunna09 prasunna09 requested review from a team as code owners July 24, 2023 14:26
@prasunna09 prasunna09 self-assigned this Jul 24, 2023
ArjunKarthik
ArjunKarthik previously approved these changes Jul 24, 2023
if currency.is_zero_decimal_currency() {
Ok(amount_f64.to_string())
} else {
Ok(format!("{amount_f64:.2}"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you vary based on 2 or 3 decimal currency?

Copy link
Contributor

@ArjunKarthik ArjunKarthik Jul 24, 2023

Choose a reason for hiding this comment

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

As far as we checked there are no connectors which accepts 3 digit decimals. Currently this method is being used in PayPal only, which don't accept 3 digit decimals for 3 decimal currency.

@ArjunKarthik ArjunKarthik added this pull request to the merge queue Jul 25, 2023
Merged via the queue into main with commit f40d144 Jul 25, 2023
@ArjunKarthik ArjunKarthik deleted the fix-paypal-amount-to-base-unit branch July 25, 2023 06:30
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jul 25, 2023
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-bug Category: Bug
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

4 participants