Merchant feature parity - #9
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR brings the Python SDK’s merchant surface area closer to parity with the TS/PHP SDKs by adding a high-level merchant client, event recording, header-to-event mapping, and bot detection, plus promoting some previously-internal helpers into public API.
Changes:
- Add merchant analytics/event plumbing (
record_event, header property mapping,verify_and_record_event) and associated tests. - Introduce a high-level
SupertabConnectmerchant client with enforcement modes and optional bot detection. - Promote/rename internal utilities to public API (
score_path_pattern,generate_license_link) and adjust call sites/tests accordingly.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
connect/__init__.py |
Expands top-level public exports to include merchant helpers, client, and new types. |
connect/_version.py |
Adds internal SDK User-Agent construction helper for outbound requests. |
connect/types.py |
Adds merchant-facing config/types (config dataclass, handler result TypedDicts, bot detector alias). |
connect/url_pattern.py |
Renames path pattern scoring helper to a public API name. |
connect/customer/content_matcher.py |
Updates customer matcher to use the renamed path-scoring function. |
connect/merchant/__init__.py |
Defines merchant subpackage exports for a cleaner merchant-facing API. |
connect/merchant/client.py |
Adds SupertabConnect high-level client and request handler logic. |
connect/merchant/license.py |
Adds verify_and_record_event, returns typed handler results, and renames license-link helper. |
connect/merchant/events.py |
Adds event recording helper (best-effort, non-raising). |
connect/merchant/headers.py |
Adds header-to-event-properties mapping with a denylist. |
connect/merchant/bots.py |
Adds default bot detection heuristic. |
connect/merchant/jwks.py |
Renames JWKS key lookup helper to underscore-prefixed form. |
tests/merchant/test_client.py |
Adds coverage for the new SupertabConnect client behavior. |
tests/merchant/test_events.py |
Adds coverage for record_event payload/logging behavior. |
tests/merchant/test_headers.py |
Adds coverage for request header mapping to event properties. |
tests/merchant/test_bots.py |
Adds coverage for default bot detection heuristic. |
tests/merchant/test_license.py |
Adds coverage for verify_and_record_event analytics recording behavior. |
tests/merchant/test_jwks.py |
Updates tests to use renamed _find_key_by_kid. |
tests/customer/test_content_matcher.py |
Updates tests to use renamed score_path_pattern. |
Comments suppressed due to low confidence (1)
connect/merchant/license.py:50
- Changing
_generate_license_linktogenerate_license_linkremoves the old import path, which is a breaking change for any users who were importing it directly. Consider keeping_generate_license_linkas an alias togenerate_license_link(or providing a deprecation period) to avoid accidental breakage.
def generate_license_link(request_url: str) -> str:
try:
parsed = urlparse(request_url)
if not parsed.scheme or not parsed.netloc:
return "/license.xml"
return f"{parsed.scheme}://{parsed.netloc}/license.xml"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nick434434
marked this pull request as ready for review
April 28, 2026 08:43
filias
reviewed
Apr 28, 2026
filias
reviewed
Apr 28, 2026
filias
reviewed
Apr 29, 2026
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.
Catching up on TS/PHP SDK functionality, making the Python one have the same (or extremely similar) public contracts and implementation logic