#10 added docs about how payment vendor side tip is handled + extend …#11
#10 added docs about how payment vendor side tip is handled + extend …#11turtletramp wants to merge 2 commits intomainfrom
Conversation
…HOWTO_01 and HOWTO_08 to log the tip information nicely on the console
There was a problem hiding this comment.
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.DumpToLoggermethod to accept optionalPayItemRequestparameter and display tip calculations - Added detailed documentation in
HOWTO_01_Payment_csharp/README.MDexplaining payment vendor tip handling with a flow example - Refactored payment examples to declare
PayItemRequestobjects 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.
deboragracio
left a comment
There was a problem hiding this comment.
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) | |
There was a problem hiding this comment.
| | 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. |
There was a problem hiding this comment.
| 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: |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
| - 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) |
There was a problem hiding this comment.
| - 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€ |
There was a problem hiding this comment.
| - 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€ |
There was a problem hiding this comment.
| - 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€ |
There was a problem hiding this comment.
| - 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). |
There was a problem hiding this comment.
| 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): |
There was a problem hiding this comment.
Should a hyperlink be added to: (see also an example on the POS System API docs)?
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:
Utils.DumpToLoggermethod inUtils.csto accept the originalPayItemRequestand 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]Utils.DumpToLoggerin payment examples (Program.csin bothHOWTO_01_Payment_csharpandHOWTO_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:
HOWTO_01_Payment_csharp/README.MDexplaining 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.README.MDto reference the new documentation for handling payments with tips, specifically for the test case with code30000,50.Code and test clarifications: