fix: cast refund amount to string for paypal#539
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
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=...)tostr(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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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 Decimal → null issues from the SDK’s jsonpickle serialization).
Changes:
- Coerce
refund_order(..., amount=...)amount tostr(amount)when building the PayPal request body. - Add a regression test verifying that a
Decimalrefund 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.
Internal ticket: https://redventures.atlassian.net/browse/RV2U-511
Merge checklist:
Check off if complete or not applicable:
Post-merge: