Skip to content

Commit

Permalink
Added additional examples
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKert committed Feb 4, 2020
1 parent 0b2cb4a commit d1fe220
Show file tree
Hide file tree
Showing 31 changed files with 1,027 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/fiskaltrust.Middleware.Demo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ namespace fiskaltrust.Middleware.Demo
{
public static class Program
{
private const string _RECEIPTEXAMPLEFOLDER = "ReceiptExamples";

private static IPOS pos = null;
private static Guid cashBoxId;
private static Guid _cashBoxId;

private static readonly Dictionary<string, ReceiptRequest> Examples = new Dictionary<string, ReceiptRequest>();

/// <param name="cashboxId">The cashboxid for the Middleware.</param>
Expand All @@ -26,7 +29,7 @@ public static async Task Main(string cashboxId, string url = "grpc://localhost:1
{
if (Guid.TryParse(cashboxId, out var parsedCashBoxId))
{
cashBoxId = parsedCashBoxId;
_cashBoxId = parsedCashBoxId;
LoadExamples();
pos = GetPosClientForUrl(url);
await EchoAsync();
Expand Down Expand Up @@ -55,11 +58,12 @@ public static async Task Main(string cashboxId, string url = "grpc://localhost:1

private static void LoadExamples()
{
foreach (var folder in Directory.GetDirectories("ReceiptExamples"))
foreach (var file in Directory.GetFiles(_RECEIPTEXAMPLEFOLDER, "*.json", SearchOption.AllDirectories).OrderBy(f => f))
{
var content = File.ReadAllText(Path.Combine(folder, "request.json"));
var content = File.ReadAllText(file);
var req = JsonConvert.DeserializeObject<ReceiptRequest>(content);
Examples.Add(Path.GetFileName(folder), req);
req.ftCashBoxID = _cashBoxId.ToString();
Examples.Add(file, req);
}
}

Expand Down Expand Up @@ -134,7 +138,6 @@ private static async Task PerformPosRequest(ReceiptRequest req)
try
{
PrintRequest(req);
req.ftCashBoxID = cashBoxId.ToString();
var resp = await pos.SignAsync(req);
PrintResponse(resp);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ftCashBoxID":"c094f242-91d5-4343-9c54-bce85f70d0d6",
"ftQueueID":"c98c5357-cb89-49ef-9ee5-bf911db6d8cb",
"ftPosSystemId": "d4a62055-ca6c-4372-ae4d-f835a88e4a5d",
"cbTerminalID": "T1",
"cbReceiptReference": "2020013017414513",
"cbReceiptMoment": "2020-01-30T17:41:45.133Z",
"cbChargeItems": [],
"cbPayItems": [],
"ftReceiptCase":4919338172267102227,
"ftReceiptCaseData": "",
"cbReceiptAmount": 0,
"cbUser": "System",
"cbArea": "",
"cbSettlement": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"ftCashBoxID": "c094f242-91d5-4343-9c54-bce85f70d0d6",
"ftQueueID": "c98c5357-cb89-49ef-9ee5-bf911db6d8cb",
"ftPosSystemId": "d4a62055-ca6c-4372-ae4d-f835a88e4a5d",
"cbTerminalID": "T1",
"cbReceiptReference": "2020013017414513",
"cbReceiptMoment": "2020-01-30T17:42:45.222Z",
"cbChargeItems": [
{
"Position": 1,
"Quantity": 1.0,
"Description": "1 night stay",
"Amount": 84.0,
"VATRate": 7.0000,
"VATAmount": 5.88,
"ftChargeItemCase": 4919338167972134914,
"ftChargeItemCaseData": "",
"CostCenter": "1",
"AccountNumber": "19829182",
"ProductGroup": "Room",
"ProductNumber": "101",
"ProductBarcode": "",
"Unit": "Night",
"UnitQuantity": 1,
"UnitPrice": 84,
"Moment": "2020-01-30T17:42:40.342Z"
}
],
"cbPayItems": [
{
"Position": 1,
"Quantity": 1.0,
"Description": "Internal",
"Amount": 84.0,
"ftPayItemCase": 4919338167972134922,
"ftPayItemCaseData": "",
"AccountNumber": "19829182",
"CostCenter": "827272",
"Moment": "2020-01-30T17:42:40.342Z"
}
],
"ftReceiptCase": 4919338172267102224,
"cbArea": "Hotel Romantic"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"ftCashBoxID": "c094f242-91d5-4343-9c54-bce85f70d0d6",
"ftQueueID": "c98c5357-cb89-49ef-9ee5-bf911db6d8cb",
"ftPosSystemId": "d4a62055-ca6c-4372-ae4d-f835a88e4a5d",
"cbTerminalID": "T1",
"cbReceiptReference": "2020013017414513",
"cbReceiptMoment": "2020-02-01T12:09:22.233Z",
"cbChargeItems": [
{
"Position": 1,
"Quantity": 1.0,
"Description": "1 night stay",
"Amount": 84.0,
"VATRate": 7.0000,
"VATAmount": 5.88,
"ftChargeItemCase": 4919338167972134914,
"ftChargeItemCaseData": "",
"CostCenter": "827272",
"AccountNumber": "19829182",
"ProductGroup": "Room",
"ProductNumber": "101",
"ProductBarcode": "",
"Unit": "Night",
"UnitQuantity": 1,
"UnitPrice": 84,
"Moment": "2020-02-01T12:07:10.166Z"
}
],
"cbPayItems": [
{
"Position": 1,
"Quantity": 1,
"Description": "Bar",
"Amount": 84.0,
"ftPayItemCase": 4919338167972134913,
"ftPayItemCaseData": "",
"AccountNumber": "19829182",
"CostCenter": "827272",
"MoneyGroup": "BAR",
"MoneyNumber": "1234",
"Moment": "2020-02-01T12:08:33.555Z"
}
],
"ftReceiptCase":4919338172267102209,
"ftReceiptCaseData": "",
"cbReceiptAmount": 84.00,
"cbUser": "Receptionist",
"cbArea":"Hotel Romantic",
"cbSettlement": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"ftCashBoxID": "c094f242-91d5-4343-9c54-bce85f70d0d6",
"ftQueueID": "c98c5357-cb89-49ef-9ee5-bf911db6d8cb",
"ftPosSystemId": "d4a62055-ca6c-4372-ae4d-f835a88e4a5d",
"cbTerminalID": "T1",
"cbReceiptReference":"2020013017414513",
"cbReceiptMoment":"2020-02-01T19:35:41.133Z",
"cbChargeItems":[
{
"Position":1,
"Quantity":1.0,
"Description":"Bier 0,5 lt",
"Amount":3.80,
"VATRate":19.00,
"VATAmount":0.61,
"ftChargeItemCase":4919338167972134937,
"ftChargeItemCaseData":"",
"CostCenter":"827272",
"AccountNumber":"19829182",
"ProductGroup":"Bier",
"ProductNumber":"1",
"ProductBarcode":"",
"Unit":"Stk",
"UnitQuantity":1,
"UnitPrice":3.80,
"Moment":"2020-02-01T19:34:59.133Z"


}
],
"cbPayItems":[
{
"Position":1,
"Quantity":1.0,
"Description":"Internal",
"Amount":84.0,
"ftPayItemCase":4919338167972134922,
"ftPayItemCaseData":"",
"AccountNumber":"19829182",
"CostCenter":"827272",
"Moment":"2020-02-01T19:34:59.133Z"
}

],
"ftReceiptCase":4919338172267102224,
"cbArea":"Bar Hotel Romantic"

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"ftCashBoxID": "c094f242-91d5-4343-9c54-bce85f70d0d6",
"ftQueueID": "c98c5357-cb89-49ef-9ee5-bf911db6d8cb",
"ftPosSystemId": "d4a62055-ca6c-4372-ae4d-f835a88e4a5d",
"cbTerminalID": "T1",
"cbReceiptReference": "2020013017414513",
"cbReceiptMoment": "2020-02-02T10:35:45.133Z",
"cbChargeItems": [
{
"Position": 1,
"Quantity": 1.0,
"Description": "Bier 0,5 lt",
"Amount": 3.80,
"VATRate": 19.00,
"VATAmount": 0.61,
"ftChargeItemCase": 4919338167972134937,
"ftChargeItemCaseData": "",
"CostCenter": "827272",
"AccountNumber": "33829182",
"ProductGroup": "Bier",
"ProductNumber": "1",
"ProductBarcode": "",
"Unit": "Stk",
"UnitQuantity": 1,
"UnitPrice": 3.80,
"Moment": "2020-02-02T10:35:40.323Z"
}
],
"cbPayItems": [
{
"Position": 1,
"Quantity": 1,
"Description": "Debitorenkarte",
"Amount": 3.80,
"ftPayItemCase": 4919338167972134916,
"ftPayItemCaseData": "",
"AccountNumber": "33829182",
"CostCenter": "827272",
"MoneyGroup": "DEBITCARD",
"MoneyNumber": "1235",
"Moment": "2020-02-02T10:35:42.323Z"
}
],
"ftReceiptCase": 4919338172267102209,
"ftReceiptCaseData": "",
"cbReceiptAmount": 3.80,
"cbUser": "Receptionist",
"cbArea": "Hotel Romantic",
"cbSettlement": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"ftCashBoxID": "c094f242-91d5-4343-9c54-bce85f70d0d6",
"ftQueueID": "c98c5357-cb89-49ef-9ee5-bf911db6d8cb",
"ftPosSystemId": "d4a62055-ca6c-4372-ae4d-f835a88e4a5d",
"cbTerminalID": "T1",
"cbReceiptReference": "2020013017414513",
"cbReceiptMoment": "2020-02-01T20:15:35.433Z",
"cbChargeItems": [
{
"Position": 1,
"Quantity": 1.0,
"Description": "Greeting Card",
"Amount": 1.0,
"VATRate": 7.00,
"VATAmount": 0.07,
"ftChargeItemCase": 4919338167972134914,
"ftChargeItemCaseData": "",
"CostCenter": "827272",
"AccountNumber": "19829182",
"ProductGroup": "Papitry",
"ProductNumber": "1872",
"ProductBarcode": "",
"Unit": "Stk",
"UnitQuantity": 1,
"UnitPrice": 1.00,
"Moment": "2020-02-01T20:15:29.123Z"
}
],
"cbPayItems": [
{
"Position": 1,
"Quantity": 1,
"Description": "Debitorenkarte",
"Amount": 1.0,
"ftPayItemCase": 4919338167972134916,
"ftPayItemCaseData": "",
"AccountNumber": "2229182",
"CostCenter": "127272",
"MoneyGroup": "DEBITCARD",
"MoneyNumber": "1235",
"Moment": "2020-02-01T20:15:33.123Z"
}
],
"ftReceiptCase": 4919338172267102209,
"ftReceiptCaseData": "",
"cbReceiptAmount": 1.00,
"cbUser": "Receptionist",
"cbArea": "Hotel Romantic",
"cbSettlement": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SEQUENCE EXAMPLE 1 - HOTEL - IMPLICIT FLOW:


1. RESERVATION (not cancellable) - 1 night stay -> info-internal + info-order (1-1-info-internal-request.json, 1-2-info-order-request.json)
2. CHECKIN -> FULL PAYMENT -> pos-receipt (2-pos-receipt-request.json)
3. Consumption 1 Bier at the Bar -> room charge -> info-order (3-info-order-request.json)
4. Purchase of Greeting Card -> payed immediately -> pos-receipt (4-pos-receipt-request.json)
5. CHECKOUT -> Payment of consumption from 3 -> pos-receipt (5-pos-receipt-request.json)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ftCashBoxID": "c094f242-91d5-4343-9c54-bce85f70d0d6",
"ftQueueID": "c98c5357-cb89-49ef-9ee5-bf911db6d8cb",
"ftPosSystemId": "d4a62055-ca6c-4372-ae4d-f835a88e4a5d",
"cbTerminalID": "T1",
"cbReceiptReference": "2020013017414413",
"cbReceiptMoment": "2020-01-30T17:41:44.133Z",
"cbChargeItems": [],
"cbPayItems": [],
"ftReceiptCase": 4919338167972134920,
"ftReceiptCaseData": "",
"cbUser": "System",
"cbArea": "",
"cbSettlement": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ftCashBoxID": "c094f242-91d5-4343-9c54-bce85f70d0d6",
"ftQueueID": "c98c5357-cb89-49ef-9ee5-bf911db6d8cb",
"ftPosSystemId": "d4a62055-ca6c-4372-ae4d-f835a88e4a5d",
"cbTerminalID": "T1",
"cbReceiptReference": "2020013017414413",
"cbReceiptMoment": "2020-01-30T17:41:45.133Z",
"cbChargeItems": [],
"cbPayItems": [],
"ftReceiptCase": 4919338167972134931,
"ftReceiptCaseData": "",
"cbReceiptAmount": 0,
"cbUser": "System",
"cbArea": "",
"cbSettlement": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ftCashBoxID": "c094f242-91d5-4343-9c54-bce85f70d0d6",
"ftQueueID": "c98c5357-cb89-49ef-9ee5-bf911db6d8cb",
"ftPosSystemId": "d4a62055-ca6c-4372-ae4d-f835a88e4a5d",
"cbTerminalID": "T1",
"cbReceiptReference": "2020013017423934",
"cbReceiptMoment": "2020-01-30T17:42:39.342Z",
"cbChargeItems": [],
"cbPayItems": [],
"ftReceiptCase": 4919338167972134920,
"ftReceiptCaseData": "",
"cbUser": "System",
"cbArea": "",
"cbSettlement": ""
}
Loading

0 comments on commit d1fe220

Please sign in to comment.