Skip to content

Conversation

hrithikesh026
Copy link
Contributor

@hrithikesh026 hrithikesh026 commented Oct 11, 2023

Type of Change

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

Description

Using float to deserialize the percentage was giving incorrect values. Hence changing deserializing percentage float value to
serde_json::Value and then calling to_string() on it.

Percentage object will look like this:

{
    "percentage": 2.05
}
Screenshot 2023-10-10 at 2 24 56 PM

List of changes in this PR:

  • Made few fields in surcharge related structs public
  • Added few more fields to SurchargeDetailsResponse (surcharge_amount, tax_on_surcharge_amount, final_amount)
  • Added surcharge_details to PaymentData and populate it from payment_Attempt.surcharge_metadata.
  • Added surcharge_details field to struct PaymentsSessionData and populated it from payment_data.
  • Added surcharge_details field to struct PaymentsAuthorizeData and populated it from payment_data.

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?

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

@hrithikesh026 hrithikesh026 added C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Oct 11, 2023
@hrithikesh026 hrithikesh026 added this to the October 2023 Milestone milestone Oct 11, 2023
@hrithikesh026 hrithikesh026 self-assigned this Oct 11, 2023
@hrithikesh026 hrithikesh026 requested review from a team as code owners October 11, 2023 16:44
Narayanbhat166
Narayanbhat166 previously approved these changes Oct 11, 2023
@hrithikesh026 hrithikesh026 changed the title fix: deserialize percentage float to serde_json value to avoid float value inconsistency fix: percentage float inconsistency problem and api models changes to support surcharge feature Oct 12, 2023
@jarnura jarnura enabled auto-merge October 12, 2023 07:09
@jarnura jarnura added this pull request to the merge queue Oct 12, 2023
Merged via the queue into main with commit 1ee1184 Oct 12, 2023
@jarnura jarnura deleted the fix-float-inconsistency-percentage branch October 12, 2023 07:43
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants