Skip to content

fix: cast refund amount to string for paypal#539

Merged
bseverino merged 2 commits into
mainfrom
bseverino/RV2U-511-paypal-refund
May 4, 2026
Merged

fix: cast refund amount to string for paypal#539
bseverino merged 2 commits into
mainfrom
bseverino/RV2U-511-paypal-refund

Conversation

@bseverino
Copy link
Copy Markdown
Member

Internal ticket: https://redventures.atlassian.net/browse/RV2U-511

Merge checklist:
Check off if complete or not applicable:

  • Documentation updated (not only docstrings)
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Manual testing instructions provided
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

Post-merge:

Copilot AI review requested due to automatic review settings April 30, 2026 13:07
@bseverino bseverino requested a review from a team as a code owner April 30, 2026 13:07
@github-actions
Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  commerce_coordinator/apps/paypal
  clients.py
  commerce_coordinator/apps/paypal/tests
  test_clients.py
Project Total  

This report was generated by python-coverage-comment-action

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the PayPal refund request payload to ensure the refund amount is serialized as a string (matching PayPal Money.value expectations) and adds a regression test to prevent reintroducing Decimal→null serialization issues.

Changes:

  • Cast refund_order(..., amount=...) to str(amount) when building the PayPal SDK request body.
  • Add a PayPal client regression test asserting the request payload uses a string for the refund amount.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
commerce_coordinator/apps/paypal/clients.py Coerces refund amount to string in the PayPal refund request body and documents the rationale.
commerce_coordinator/apps/paypal/tests/test_clients.py Adds a regression test verifying the refund request payload shapes amount.value as a string.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread commerce_coordinator/apps/paypal/clients.py
Comment thread commerce_coordinator/apps/paypal/tests/test_clients.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 30, 2026 13:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes PayPal refund request serialization by ensuring the refund amount is always sent as a string (matching PayPal’s Money.value requirements and avoiding Decimalnull issues from the SDK’s jsonpickle serialization).

Changes:

  • Coerce refund_order(..., amount=...) amount to str(amount) when building the PayPal request body.
  • Add a regression test verifying that a Decimal refund amount is serialized as a string in the outgoing request.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
commerce_coordinator/apps/paypal/clients.py Casts refund amount to string in the PayPal refund payload to prevent SDK serialization issues.
commerce_coordinator/apps/paypal/tests/test_clients.py Adds a regression test asserting Decimal("49.00") is passed to PayPal as "49.00".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bseverino bseverino merged commit 81ec225 into main May 4, 2026
12 checks passed
@bseverino bseverino deleted the bseverino/RV2U-511-paypal-refund branch May 4, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants