Skip to content

PTHMINT-118: POS receipt and order cancel features#57

Open
zulquer wants to merge 3 commits intomasterfrom
PTHMINT-118
Open

PTHMINT-118: POS receipt and order cancel features#57
zulquer wants to merge 3 commits intomasterfrom
PTHMINT-118

Conversation

@zulquer
Copy link
Copy Markdown
Collaborator

@zulquer zulquer commented Apr 23, 2026

This pull request introduces support for cancelling Cloud POS orders and improves the example scripts and internal API structure for order cancellation and receipt fetching. The main changes include the addition of a new cancel_transaction method to the OrderManager, new request and response models for order cancellation, and several new and updated example scripts demonstrating Cloud POS order creation, cancellation, and receipt retrieval.

New Cloud POS order cancellation support:

  • OrderManager.cancel_transaction method: Adds a new method to cancel POS transactions by order ID, supporting both direct order ID strings and request objects, with optional terminal group scoping.
  • New request/response models and API structure for cancellation:
    • Adds CancelTransactionRequest and CancelTransaction models for request and response handling. [1] [2]
    • Adds corresponding __init__.py files to expose these models and document their purpose. [1] [2] F37e056cR1)
    • Integrates these models into the OrderManager and its response handling. [1] [2]

Example scripts for Cloud POS flows:

  • Adds examples/order_manager/cancel.py to demonstrate Cloud POS order creation, waiting, and cancellation.
  • Adds examples/order_manager/cloud_pos_order.py to demonstrate Cloud POS order creation with terminal-group scoped authentication.
  • Updates and expands examples/pos_manager/get_receipt.py to show both receipt fetching for an existing order and a complete flow including order creation, event monitoring, and receipt retrieval.

Improvements to authentication and scoping:

  • Updates example scripts and internal APIs to consistently support and document terminal group scoping and environment variable configuration for credentials. [1] [2] [3] [4] [5] [6]

These changes collectively provide a full workflow for Cloud POS order management, including creation, cancellation, and receipt retrieval, with improved code organization and documentation.

zulquer and others added 3 commits April 22, 2026 17:20
Introduce a CredentialResolver protocol, AuthScope dataclass and a default ScopedCredentialResolver to support resolving API keys by auth scope (default_account, partner_affiliate, terminal_group). Update Client and Sdk to accept an optional credential_resolver (and make api_key optional when a resolver is provided), add Client._resolve_api_key and auth_scope plumbing for request creation, and export ScopedCredentialResolver from the package. Add validation to require at least one credential source and improve error messages for missing/unknown scoped keys. Update and add unit tests to cover resolver behavior, header wiring, and SDK initialization with resolver-only configuration.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Introduce POS receipt models and manager, and add order cancel transaction support with terminal-group scoped auth.

- Add PosManager and POS /receipt response models (merchant, order, payment, related_transactions, Receipt) and wire it into the SDK.
- Add cancel transaction request/response models and integrate cancel_transaction into OrderManager.
- Extend OrderManager.create and cancel_transaction to accept optional terminal_group_id and pass AuthScope to the client; ensure order_id path segments are encoded.
- Add unit and integration tests for new behavior (order create scoped auth, cancel_transaction, get_receipt, OrderManager operations) and example scripts (cloud_pos_order, cancel, get_receipt).

These changes enable Cloud POS workflows (create, wait/cancel, fetch receipt) and support terminal-group scoped authentication for relevant endpoints.
Base automatically changed from PTHMINT-116 to master April 27, 2026 09:18
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.

1 participant