public void SendHashAndSignTransaction() { // Create the event to sign. string pos_serial_nr = "B999000ABC4567"; // BXXXCCCPPPPPPP: // BXXX: Producer ID. // CCC: Certificate number. // PPPPPPP: Last 7 characters of software license key, // ignoring possible control character. string terminal_id = "10"; string terminal_name = "FDM DEMO POS"; string operator_id = "79100590097"; // INSZ-number or BIS-number (11 characters) or "Guest" (00000000097) string operator_name = "Tony"; int transaction_nr = 1; // ??? PosEvent posevent = new PosEvent(pos_serial_nr, terminal_id, terminal_name, operator_id, operator_name, transaction_nr, DateTime.Now); Debug.Assert(TrainingButton.IsChecked != null); Debug.Assert(RefundButton.IsChecked != null); posevent.IsTrainingMode = (bool)TrainingButton.IsChecked; posevent.IsRefund = (bool)RefundButton.IsChecked; posevent.IsFinalized = true; posevent.DrawerOpen = posevent.IsFinalized && (posevent.Payments.Count != 0); posevent.SetVatRate(21, 12, 6, 0); decimal payment_total = 0.0m; // DEBUG foreach (ReceiptLine l in ReceiptLines) { // TODO: Determine whether to use 'ID' or 'SKU' for argument 'ProductId'. posevent.Products.Add(new ProductLine(l.SKU, l.Description, l.Amount, l.TotalPrice, l.VAT.ToString())); payment_total += l.TotalPrice; } posevent.Payments.Add(new PaymentLine("PAY001", "Euro", PaymentTypes.Cash, 1, payment_total)); FDMClient.BeginHashAndSign(posevent, HashAndSignCallback, null); // Argument 3 feeds the callback. }
public void SendHashAndSignTransaction() { // Create the event to sign. string pos_serial_nr = "B999000ABC4567"; // BXXXCCCPPPPPPP: // BXXX: Producer ID. // CCC: Certificate number. // PPPPPPP: Last 7 characters of software license key, // ignoring possible control character. string terminal_id = "10"; string terminal_name = "FDM DEMO POS"; string operator_id = "79100590097"; // INSZ-number or BIS-number (11 characters) or "Guest" (00000000097) string operator_name = "Tony"; int transaction_nr = 1; // ??? PosEvent posevent = new PosEvent(pos_serial_nr, terminal_id, terminal_name, operator_id, operator_name, transaction_nr, DateTime.Now); posevent.IsRefund = false; posevent.IsTrainingMode = false; posevent.IsFinalized = true; posevent.DrawerOpen = (posevent.IsFinalized && posevent.Payments.Count != 0); posevent.SetVatRate(21, 12, 6, 0); int multiplier = posevent.IsRefund ? -1 : 1; decimal total = 2.20m * multiplier + 11.90m * multiplier; // TODO: DEBUG posevent.Products.Add(new ProductLine("BEV021", "SOFTDRINKS", "SOFT004", "Cola", multiplier, 2.20m * multiplier, "A")); posevent.Products.Add(new ProductLine("FOO018", "SNACKS", "SNAC007", "Snack", multiplier, 11.90m * multiplier, "B")); // string PaymentId, string PaymentName, PaymentTypes Type, int Quantity, decimal Amount posevent.Payments.Add(new PaymentLine("PAY001", "Euro", PaymentTypes.Cash, 1, total)); c.BeginHashAndSign(posevent, HashAndSignCallback, null); // Argument 3 feeds the callback. }