ZIP-596: adds taxcloud support for CalculateCart feature#15
Merged
ericlakich merged 9 commits intomainfrom Feb 27, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive support for shopping cart tax calculation with intelligent dual routing between the ZipTax and TaxCloud APIs. The implementation maintains a unified input contract (CalculateCartRequest) while automatically selecting the appropriate backend based on client configuration. When TaxCloud credentials are configured, requests are transformed and routed to TaxCloud's /tax/connections/{connectionId}/carts endpoint with proper address parsing and field mapping.
Changes:
- Added automatic backend routing in
CalculateCart()that transparently handles ZipTax and TaxCloud APIs with unified input but distinct response types - Introduced address parsing utility (
parse_address_string()) and three new TaxCloud response models (TaxCloudCalculateCartResponse,TaxCloudCartItemResponse,TaxCloudCartLineItemResponse) - Added 17 new tests covering routing logic, request transformation, response parsing, and error handling scenarios
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/ziptax/resources/functions.py |
Implements dual-routing CalculateCart() with private helpers for ZipTax and TaxCloud backends, plus static transformation method |
src/ziptax/utils/validation.py |
Adds parse_address_string() utility to convert single-string addresses to structured TaxCloud format |
src/ziptax/models/responses.py |
Defines 9 ZipTax cart models and 3 TaxCloud cart response models with Pydantic validation constraints |
src/ziptax/__init__.py |
Exports new cart and TaxCloud models, updates version to 0.2.3-beta |
src/ziptax/models/__init__.py |
Exports cart calculation and TaxCloud response models |
tests/test_functions.py |
Adds 17 tests for TaxCloud routing and 9 tests for basic cart functionality with Pydantic validation |
tests/conftest.py |
Adds fixtures for ZipTax and TaxCloud cart responses |
pyproject.toml |
Updates version to 0.2.3-beta |
docs/spec.yaml |
Documents cart endpoint specification with dual-routing behavior and transformation rules |
README.md |
Adds cart tax calculation usage guide with dual-routing explanation and validation examples |
CLAUDE.md |
Updates developer documentation with cart calculation patterns and SDK version |
CHANGELOG.md |
Documents changes for 0.2.3-beta and 0.2.1-beta releases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a major update (v0.2.3-beta) to the ZipTax SDK, focusing on comprehensive support for shopping cart tax calculation with dual routing between the ZipTax and TaxCloud APIs. The update adds new models, utilities, and tests, and refactors the main cart calculation method to support both backends transparently. Documentation and versioning are also updated to reflect these changes.
Cart Tax Calculation & Routing Enhancements:
CalculateCart()to TaxCloud's/tax/connections/{connectionId}/cartsendpoint when TaxCloud credentials are configured, maintaining the same input contract (CalculateCartRequest) and transforming requests as needed (address parsing,taxabilityCodemapping, line item indexing). The return type is now a union ofCalculateCartResponseandTaxCloudCalculateCartResponse._transform_cart_for_taxcloud()for request transformation, and split cart calculation into two private helpers for ZipTax and TaxCloud backends.Model and Utility Additions:
parse_address_string()inutils/validation.pyto convert single-string addresses to structured components, with robust error handling.TaxCloudCalculateCartResponse,TaxCloudCartItemResponse, andTaxCloudCartLineItemResponse, and exported them in__init__.pyandmodels/__init__.py. [1] [2] [3]Testing and Validation:
TestCalculateCartTaxCloudRoutingto cover routing logic, request/response transformation, and error handling for cart calculation.Documentation and Versioning:
README.mdandCLAUDE.mdto document the new cart tax calculation feature, dual-routing behavior, usage examples, and model constraints. [1] [2] [3]0.2.0-betato0.2.3-betain all relevant files. [1] [2] [3] [4]Technical and Quality Improvements:
__init__.pyandmodels/__init__.pyto include new cart and TaxCloud models. [1] [2] [3]These changes significantly expand the SDK's tax calculation capabilities, improve developer ergonomics, and ensure robust validation and testing.
Cart Tax Calculation & Routing Enhancements:
CalculateCart()to TaxCloud or ZipTax based on credentials, with request/response transformation and unified input contract.Model and Utility Additions:
Testing and Validation:
Documentation and Versioning:
0.2.3-betain all relevant files. [1] [2] [3] [4] [5]Technical and Quality Improvements: