Skip to content

PTHMINT-125: Cloud POS tip and amount_details support#62

Open
zulquer wants to merge 1 commit into
masterfrom
PTHMINT-125
Open

PTHMINT-125: Cloud POS tip and amount_details support#62
zulquer wants to merge 1 commit into
masterfrom
PTHMINT-125

Conversation

@zulquer
Copy link
Copy Markdown
Collaborator

@zulquer zulquer commented May 14, 2026

Add models and wiring to support tip information in order requests for POS/Cloud POS. Introduces Tip and AmountDetails components, exposes them in components.init, and adds amount_details field and add_amount_details method to OrderRequest. Includes example script and README documentation showing tip serialization (amounts in smallest currency unit), and updates/adds unit and integration tests to cover serialization and behavior. Tip.add_amount accepts either an Amount value object or an int.

Add models and wiring to support tip information in order requests for POS/Cloud POS. Introduces Tip and AmountDetails components, exposes them in components.__init__, and adds amount_details field and add_amount_details method to OrderRequest. Includes example script and README documentation showing tip serialization (amounts in smallest currency unit), and updates/adds unit and integration tests to cover serialization and behavior. Tip.add_amount accepts either an Amount value object or an int.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.89%. Comparing base (8954459) to head (5e7acae).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #62      +/-   ##
==========================================
+ Coverage   92.83%   92.89%   +0.06%     
==========================================
  Files         164      166       +2     
  Lines        2889     2914      +25     
==========================================
+ Hits         2682     2707      +25     
  Misses        207      207              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds amount_details support to order creation payloads to represent POS/Cloud POS tip information, by introducing new request components (Tip, AmountDetails) and wiring them into OrderRequest plus docs/examples/tests.

Changes:

  • Introduces Tip and AmountDetails request component models and exports them from the components package.
  • Extends OrderRequest with amount_details and an add_amount_details() fluent setter.
  • Adds/updates unit + integration tests and documentation/example code demonstrating tip serialization.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/multisafepay/api/paths/orders/request/order_request.py Adds amount_details field + add_amount_details() method; updates docstring.
src/multisafepay/api/paths/orders/request/components/tip.py New Tip component with add_amount() supporting int or Amount.
src/multisafepay/api/paths/orders/request/components/amount_details.py New AmountDetails component that can include a Tip.
src/multisafepay/api/paths/orders/request/components/__init__.py Exposes AmountDetails and Tip via __all__.
tests/multisafepay/unit/api/path/orders/request/test_unit_order_request.py Unit coverage for amount_details initialization, setter, and serialization.
tests/multisafepay/unit/api/path/orders/request/components/test_unit_tip.py New unit tests for Tip behavior.
tests/multisafepay/unit/api/path/orders/request/components/test_unit_amount_details.py New unit tests for AmountDetails behavior and serialization.
tests/multisafepay/integration/api/path/orders/request/test_integration_order_request.py Integration coverage ensuring amount_details is included in to_dict().
tests/multisafepay/integration/api/path/orders/manager/test_integration_order_manager_create.py Integration coverage ensuring request body includes serialized amount_details.
README.md Documents Cloud POS tip usage and expected serialization shape.
examples/order_manager/cloud_pos_order_with_tip.py New runnable example demonstrating creating an order with a tip.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +5
"""Tip model for order request amount details."""

from typing import Optional, Union

from multisafepay.model.request_model import RequestModel
Comment on lines +1 to +5
"""Amount details model for order request amount breakdowns."""

from typing import Optional

from multisafepay.api.paths.orders.request.components.tip import Tip
@@ -67,6 +70,7 @@ class OrderRequest(RequestModel):
order_id (Optional[str]): The order ID.
currency (Optional[str]): The currency of the order.
amount (Optional[str]): The amount of the order.
Comment on lines +1 to +3
"""Test module for unit testing."""

from multisafepay.api.paths.orders.request.components.tip import Tip
Comment on lines +1 to +3
"""Test module for unit testing."""

from multisafepay.api.paths.orders.request.components.amount_details import (
Comment on lines +1 to +8
"""Create a Cloud POS order with tip information."""

import os
import time

from dotenv import load_dotenv

from multisafepay import Sdk
Comment thread README.md
Comment on lines +127 to +133
This serializes to:

```json
{
"amount_details": {
"tip": {
"amount": 20
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.

2 participants