Skip to content

Commit d5f1bd1

Browse files
author
Thomas Danzl
committed
#10 fix review feedback
1 parent e51d392 commit d5f1bd1

2 files changed

Lines changed: 23 additions & 18 deletions

File tree

HOWTO_01_Payment_csharp/README.MD

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ In all of these cases, the solution is to resend the original request using the
2929
## Special case - payment vendor added TIP
3030

3131
In many payment vendor apps it is possible to add a tip to the payment amount.
32-
Flow example in a restaruant:
32+
Flow example in a restaurant:
3333
- Guest asks for the bill
3434
- Waiter triggers to create the bill at the POS (e.g. mobile device)
3535
- The POS on the mobile device pushes the amount (for example 10€) to be paid to the configured payment app (via POS System API and the fiskaltrust InStore App)
@@ -41,6 +41,6 @@ Flow example in a restaruant:
4141
- 2 pay items
4242
- Pay item 1: The fully paid amount with the receipt -> 12€
4343
- Pay item 2: The tip with negative amount -> -2€
44-
- sum of the 2 pay items is the orginal requested amount of 10€
44+
- sum of the 2 pay items is the original requested amount of 10€
4545

46-
NOTE: The tip can be calculated by simply substracting the requested amount from the paid amount (12-10 = 2€ tip) or alternatively from the 2nd pay item (-2 * -1 = 2€ tip).
46+
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).

libPosSystemAPI/PosAPIUtils/Utils.cs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -211,26 +211,31 @@ public static void DumpToLogger(PayResponse payResp, PayItemRequest? payItemRequ
211211
protocol = protocolValue.GetString() ?? "ERROR: invalid type";
212212
}
213213
Logger.LogInfo($"- PayItem {i+1}");
214+
Logger.LogInfo($"\t\tDescription: {ftPayItem.Description}");
214215
if (protocol != "unknown") Logger.LogInfo($"\t\tprotocol: {protocol}");
215216
Logger.LogInfo($"\t\tAmount: {ftPayItem.Amount}");
216-
if (payItemRequest != null)
217+
// only show calculate included tip and process receipt for the real payment item and not for the additional info entries
218+
if (payItemCaseData != null)
217219
{
218-
decimal tipAmount = ftPayItem.Amount - payItemRequest.Amount;
219-
Logger.LogInfo($"\t\t\tIncluded Tip Amount: {tipAmount}");
220-
}
221-
Logger.LogInfo("\t\tReceipt:");
222-
if (payItemCaseData?.Receipt == null)
223-
{
224-
Logger.LogInfo("\t\t\t WARNING: No receipt info received!");
225-
}
226-
else
227-
{
228-
string[]? payReceipt = ftPayItem.GetPayItemCaseData()?.Receipt;
229-
if (payReceipt != null)
220+
if (payItemRequest != null)
221+
{
222+
decimal tipAmount = ftPayItem.Amount - payItemRequest.Amount;
223+
Logger.LogInfo($"\t\t\tIncluded Tip Amount: {tipAmount}");
224+
}
225+
Logger.LogInfo("\t\tReceipt:");
226+
if (payItemCaseData?.Receipt == null)
227+
{
228+
Logger.LogInfo("\t\t\t WARNING: No receipt info received!");
229+
}
230+
else
230231
{
231-
foreach (string line in payReceipt)
232+
string[]? payReceipt = ftPayItem.GetPayItemCaseData()?.Receipt;
233+
if (payReceipt != null)
232234
{
233-
Logger.LogInfo($"\t\t\t{line}");
235+
foreach (string line in payReceipt)
236+
{
237+
Logger.LogInfo($"\t\t\t{line}");
238+
}
234239
}
235240
}
236241
}

0 commit comments

Comments
 (0)