Skip to content

#10 added docs about how payment vendor side tip is handled + extend …#11

Open
turtletramp wants to merge 2 commits intomainfrom
10-tip-handling
Open

#10 added docs about how payment vendor side tip is handled + extend …#11
turtletramp wants to merge 2 commits intomainfrom
10-tip-handling

Conversation

@turtletramp
Copy link
Collaborator

This pull request introduces improvements to payment handling, especially around payments that include tips, and enhances logging for better traceability of payment requests and responses. It also updates documentation to explain how to handle tip scenarios and clarifies test and example code to reflect these changes.

Enhancements to payment handling and logging:

  • Improved the Utils.DumpToLogger method in Utils.cs to accept the original PayItemRequest and log both the requested and received amounts, including calculation and display of any included tip amount. The log output is now more structured and easier to read, especially for responses with multiple pay items. [1] [2] [3] [4]
  • Updated usages of Utils.DumpToLogger in payment examples (Program.cs in both HOWTO_01_Payment_csharp and HOWTO_08_pay_sign_issue_csharp) to pass the original payment request, ensuring that logs contain complete context for each payment. [1] [2]

Documentation updates for tip handling:

  • Added a new section to HOWTO_01_Payment_csharp/README.MD explaining how to handle payments where a tip is added by the payment vendor, including a flow example and explanation of how the tip is represented in the response.
  • Updated the main README.MD to reference the new documentation for handling payments with tips, specifically for the test case with code 30000,50.

Code and test clarifications:

  • Refactored payment request creation in example programs to improve clarity and maintainability, ensuring the payment request object is clearly defined and reused. [1] [2]
  • Clarified comments in the integration test to explain that only one pay item is expected unless a tip scenario is tested.

…HOWTO_01 and HOWTO_08 to log the tip information nicely on the console
Copy link

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

This pull request enhances payment handling logging and documentation, specifically focusing on scenarios where payment vendors add tips. The changes improve traceability by logging both requested and received payment amounts and provide comprehensive documentation explaining how tip scenarios work.

Changes:

  • Enhanced Utils.DumpToLogger method to accept optional PayItemRequest parameter and display tip calculations
  • Added detailed documentation in HOWTO_01_Payment_csharp/README.MD explaining payment vendor tip handling with a flow example
  • Refactored payment examples to declare PayItemRequest objects before async operations for better logging context

Reviewed changes

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

Show a summary per file
File Description
libPosSystemAPI/PosAPIUtils/Utils.cs Enhanced DumpToLogger method to accept optional PayItemRequest parameter and log requested vs received amounts with tip calculations
libPosSystemAPI.Test/IntegrationTestsPayment.cs Simplified test comment to remove tip scenario reference
README.MD Updated test case documentation to reference new tip handling guide
HOWTO_01_Payment_csharp/README.MD Added comprehensive section explaining payment vendor tip handling with flow example
HOWTO_08_pay_sign_issue_csharp/Program.cs Refactored to declare PayItemRequest before async operation and pass to DumpToLogger
HOWTO_01_Payment_csharp/Program.cs Refactored to declare PayItemRequest before async operation and pass to DumpToLogger

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

Copy link
Contributor

@deboragracio deboragracio left a comment

Choose a reason for hiding this comment

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

Hi Thomas, here's my review for the text.

| 30000,20 | TIMEOUT (returned as an error message as no other option is available yet) |
| 30000,40 | CANCELLED BY USER |
| 30000,50 | SUCCESS with added guest tip |
| 30000,50 | SUCCESS with added guest tip (see [HOWTO_01_Payment](HOWTO_01_Payment_csharp/README.MD) on how to handle such a tip) |
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
| 30000,50 | SUCCESS with added guest tip (see [HOWTO_01_Payment](HOWTO_01_Payment_csharp/README.MD) on how to handle such a tip) |
| 30000,50 | SUCCESS with added guest tip (see [HOWTO_01_Payment](HOWTO_01_Payment_csharp/README.MD) for instructions on handling tips) |


## Special case - payment vendor added TIP

In many payment vendor apps it is possible to add a tip to the payment amount.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In many payment vendor apps it is possible to add a tip to the payment amount.
In many payment vendor apps, it is possible to add a tip to the payment amount.

## Special case - payment vendor added TIP

In many payment vendor apps it is possible to add a tip to the payment amount.
Flow example in a restaurant:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Flow example in a restaurant:
**Example flow in a restaurant:**


In many payment vendor apps it is possible to add a tip to the payment amount.
Flow example in a restaurant:
- Guest asks for the bill
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Guest asks for the bill
1. The guest asks for the bill.

In many payment vendor apps it is possible to add a tip to the payment amount.
Flow example in a restaurant:
- Guest asks for the bill
- Waiter triggers to create the bill at the POS (e.g. mobile device)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Waiter triggers to create the bill at the POS (e.g. mobile device)
2. The waiter triggers to create the bill on the POS (e.g., mobile device).

- The payment app reports a paid amount of 12€ (including 2€ of tip)
- The fiskaltrust InStore App / POS System API does report back the following in the payment response (see also example in the POS System API docs):
- 2 pay items
- Pay item 1: The fully paid amount with the receipt -> 12€
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Pay item 1: The fully paid amount with the receipt -> 12€
- Pay item 1: The total paid amount with the receipt -> 12€

- The fiskaltrust InStore App / POS System API does report back the following in the payment response (see also example in the POS System API docs):
- 2 pay items
- Pay item 1: The fully paid amount with the receipt -> 12€
- Pay item 2: The tip with negative amount -> -2€
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Pay item 2: The tip with negative amount -> -2€
- Pay item 2: The tip with a negative amount -> -2€

- 2 pay items
- Pay item 1: The fully paid amount with the receipt -> 12€
- Pay item 2: The tip with negative amount -> -2€
- sum of the 2 pay items is the original requested amount of 10€
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- sum of the 2 pay items is the original requested amount of 10€
- The sum of the 2 pay items is the original requested amount of 10€

- Pay item 2: The tip with negative amount -> -2€
- sum of the 2 pay items is the original requested amount of 10€

NOTE: The tip can be calculated by simply subtracting the requested amount from the paid amount (12-10 = 2€ tip) or alternatively from the 2nd pay item (-2 * -1 = 2€ tip).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
NOTE: The tip can be calculated by simply subtracting the requested amount from the paid amount (12-10 = 2€ tip) or alternatively from the 2nd pay item (-2 * -1 = 2€ tip).
**NOTE:** The tip can be calculated by simply subtracting the requested amount from the paid amount (12-10 = 2€ tip) or alternatively by using the 2nd pay item (-2 * -1 = 2€ tip).

- The guest sees a TIP entry screen and adds a tip of 2€
- The guests now pays the full sum of 12€
- The payment app reports a paid amount of 12€ (including 2€ of tip)
- The fiskaltrust InStore App / POS System API does report back the following in the payment response (see also example in the POS System API docs):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should a hyperlink be added to: (see also an example on the POS System API docs)?

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.

[TIP] extend howtos and docs on how payment vendor side added tip is handled

3 participants