public static Messages.Response EpaymentProcess(Messages.Request request) { float amount = request.Parameters.Value <float>("amount"); string device = request.Parameters.Value <string>("device"); string protocol = request.Parameters.Value <string>("protocol"); string port = request.Parameters.Value <string>("port"); string data = request.Parameters.Value <string>("data"); int pos = request.Parameters.Value <int>("pos"); PaymentRequest paymentRequest = new PaymentRequest(amount); ConcertProtocol concertProtocol = ConcertProtocol.find(protocol); concertProtocol.Terminal = new SerialTerminal(port); Issue issue = concertProtocol.SendPaymentRequest(paymentRequest); if (issue.Type == Issue.SUCCESS) { return(request.Success(issue.Response)); } else { return(request.Failure("", issue.Message)); } }
public static Messages.Response PrintersTest(Messages.Request request) { string printerName = request.Parameters.Value <string>("printerName"); Utils.ShellPrintTestDocument(printerName); return(request.Success(printerName)); }
public static Messages.Response EpaymentSupportedTerminals(Messages.Request request) { Dictionary <string, string> map = new Dictionary <string, string>(); map.Add("Ingenico-ICT220", "Ingenico ICT 220"); map.Add("Ingenico-ICT250", "Ingenico ICT 250"); return(request.Success(map)); }
public static Messages.Response DocumentPrint(Messages.Request request) { string printerName = request.Parameters.Value <string>("printerName"); string path = request.Parameters.Value <string>("path"); Utils.ShellPrintDocument(printerName, path); return(request.Success(path)); }
public static Messages.Response EpaymentPing(Messages.Request request) { string device = request.Parameters.Value <string>("device"); string port = request.Parameters.Value <string>("port"); string protocol = request.Parameters.Value <string>("protocol"); ConcertProtocol concertProtocol = ConcertProtocol.find(protocol); concertProtocol.Terminal = new SerialTerminal(port); concertProtocol.SendTest(); return(request.Success(true)); }
public static Messages.Response EpaymentTest(Messages.Request request) { Concert2Protocol protocol = new Concert2Protocol(new SerialTerminal("")); string payload = request.Parameters.Value <string>("payload"); payload += ConcertProtocol.FromCharCode(ConcertProtocol.ETX).ToString(); string message = ConcertProtocol.FromCharCode(ConcertProtocol.STX); message += payload; message += ConcertProtocol.FromCharCode(ConcertProtocol.LRC(payload)); protocol.PrepareResponse(ConcertProtocol.ToBytes(message)); return(request.Success("OK")); }
public static Messages.Response LocationOpen(Messages.Request request) { string filepath = request.Parameters.First.ToObject <string>(); ProcessStartInfo info = new ProcessStartInfo { Verb = "open", FileName = filepath, CreateNoWindow = false, UseShellExecute = true, WindowStyle = ProcessWindowStyle.Normal }; using Process process = new Process() { StartInfo = info }; process.Start(); return(request.Success(filepath)); }
public static Messages.Response EpaymentSupportedProtocols(Messages.Request request) { return(request.Success(ConcertProtocol.SupportedProtocols())); }
public static Messages.Response SerialPortsList(Messages.Request request) { return(request.Success(SerialPort.GetPortNames())); }
public static Messages.Response CompanionExit(Messages.Request request) { NativeHost.StopService("Receveid request companion.exit"); return(request.Success(true)); }
public static Messages.Response CompanionPause(Messages.Request request) { Thread.Sleep(5000); return(request.Success("Had a nice pause !")); }
public static Messages.Response CompanionVersion(Messages.Request request) { Version version = Assembly.GetEntryAssembly().GetName().Version; return(request.Success(version.ToString())); }
public static Messages.Response Echo(Messages.Request request) { return(request.Success("Companion-echo : " + request.Parameters.ToString())); }
public static Messages.Response Ping(Messages.Request request) { return(request.Success("companion-pong")); }
public static Messages.Response PrintersList(Messages.Request request) { return(request.Success(PrinterSettings.InstalledPrinters)); }