Skip to content

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

Merged
zulquer merged 3 commits into
masterfrom
PTHMINT-125
Jun 3, 2026
Merged

PTHMINT-125: Cloud POS tip and amount_details support#62
zulquer merged 3 commits into
masterfrom
PTHMINT-125

Conversation

@zulquer
Copy link
Copy Markdown
Collaborator

@zulquer zulquer commented May 14, 2026

This pull request introduces support for specifying tip amounts in Cloud POS and POS order creation requests. It adds new models for handling tip and amount details, updates the order request structure, and provides documentation, examples, and comprehensive tests to ensure correct serialization and integration.

Cloud POS Tip Support:

  • Added new models AmountDetails and Tip to represent order amount breakdowns, allowing tip information to be included in order requests. [1] [2]
  • Updated OrderRequest to support an optional amount_details field and added an add_amount_details method for builder-style usage. [1] [2] [3]
  • Updated component imports and exports to include AmountDetails and Tip. [1] [2]

Documentation and Examples:

  • Added a new section to the README.md with usage instructions and an example for sending tip information in Cloud POS orders.
  • Provided a full example in examples/order_manager/cloud_pos_order_with_tip.py demonstrating how to create a Cloud POS order with a tip.

Testing:

  • Added and updated integration and unit tests to cover the new amount_details and tip fields, ensuring correct initialization, builder usage, and serialization. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

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.66%. Comparing base (369bdc2) to head (b3752d3).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #62      +/-   ##
==========================================
+ Coverage   92.61%   92.66%   +0.05%     
==========================================
  Files         180      182       +2     
  Lines        3331     3356      +25     
==========================================
+ Hits         3085     3110      +25     
  Misses        246      246              

☔ 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 Outdated
Comment on lines +127 to +133
This serializes to:

```json
{
"amount_details": {
"tip": {
"amount": 20
zulquer added 2 commits May 27, 2026 11:47
Add copyright, license and disclaimer headers to example, component and test files; clarify README text for amount_details serialization; and change OrderRequest.amount type from Optional[str] to Optional[int] to reflect numeric amounts. Tests were updated with headers only.
@zulquer zulquer merged commit 3da99c0 into master Jun 3, 2026
6 checks passed
@zulquer zulquer deleted the PTHMINT-125 branch June 3, 2026 14:13
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