-
Notifications
You must be signed in to change notification settings - Fork 0
PTHMINT-78: Avoid duplicate taxes when checkout options is autogenerated #29
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #29 +/- ##
=======================================
Coverage 90.48% 90.48%
=======================================
Files 107 107
Lines 2322 2323 +1
=======================================
+ Hits 2101 2102 +1
Misses 221 221 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…nts/test_integration_orders_components_checkout_options.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nts/test_integration_orders_components_checkout_options.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this 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 pull request fixes duplicate tax generation in the generate_from_shopping_cart method by deduplicating tax table selectors and updates tests to ensure proper validation of this behavior.
- Introduced deduplication logic using a set to ensure unique tax table selectors
- Modified existing test to sort tax rules for consistent comparison
- Added new test case to validate duplicate tax table selector handling
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/multisafepay/api/paths/orders/request/components/checkout_options.py |
Implemented deduplication logic using set comprehension to avoid duplicate tax rules |
tests/multisafepay/integration/api/path/orders/request/components/test_integration_orders_components_checkout_options.py |
Updated existing test with sorting logic and added new test for duplicate tax table selector scenario |
Comments suppressed due to low confidence (1)
tests/multisafepay/integration/api/path/orders/request/components/test_integration_orders_components_checkout_options.py:174
- The test uses identical CartItem objects which may not adequately test the deduplication logic. Consider using different items with the same tax_table_selector to better validate that deduplication works across different products.
name="Geometric Candle Holders",
This pull request refines the
generate_from_shopping_cartmethod to handle unique tax table selectors more effectively and updates the corresponding test cases to ensure correctness. The key changes include introducing logic for deduplication of tax table selectors, updating tests to reflect this change, and adding a new test case for scenarios with duplicate tax table selectors.Enhancements to
generate_from_shopping_cart:src/multisafepay/api/paths/orders/request/components/checkout_options.py, src/multisafepay/api/paths/orders/request/components/checkout_options.pyR113-R124).Updates to test cases:
test_generate_from_shopping_cartto sort both the generated and expected tax rules before comparison, ensuring consistent test results regardless of the order of processing (tests/multisafepay/integration/api/path/orders/request/components/test_integration_orders_components_checkout_options.py, tests/multisafepay/integration/api/path/orders/request/components/test_integration_orders_components_checkout_options.pyR63-R79).test_generate_from_shopping_cart_with_items_with_same_tax_table_selector, to validate that duplicate tax table selectors in the shopping cart are correctly handled and result in a single tax rule (tests/multisafepay/integration/api/path/orders/request/components/test_integration_orders_components_checkout_options.py, tests/multisafepay/integration/api/path/orders/request/components/test_integration_orders_components_checkout_options.pyR153-R199).