Skip to content

Merchant feature parity - #9

Merged
nick434434 merged 8 commits into
mainfrom
feat/merchant-feature-parity
Apr 28, 2026
Merged

Merchant feature parity#9
nick434434 merged 8 commits into
mainfrom
feat/merchant-feature-parity

Conversation

@nick434434

@nick434434 nick434434 commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Catching up on TS/PHP SDK functionality, making the Python one have the same (or extremely similar) public contracts and implementation logic

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 SupertabConnect merchant 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_link to generate_license_link removes the old import path, which is a breaking change for any users who were importing it directly. Consider keeping _generate_license_link as an alias to generate_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.

Comment thread connect/merchant/events.py
Comment thread connect/merchant/license.py Outdated
Comment thread connect/merchant/bots.py Outdated
Comment thread connect/merchant/jwks.py
Comment thread connect/url_pattern.py
Comment thread connect/merchant/client.py
@nick434434
nick434434 marked this pull request as ready for review April 28, 2026 08:43
Comment thread connect/merchant/bots.py Outdated
Comment thread connect/merchant/bots.py

@ranael-garem ranael-garem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

@nick434434
nick434434 merged commit 37b21b4 into main Apr 28, 2026
1 check passed
@nick434434
nick434434 deleted the feat/merchant-feature-parity branch April 28, 2026 15:21
Comment thread connect/types.py
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.

4 participants