コード例 #1
0
        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));
            }
        }
コード例 #2
0
        public static Messages.Response PrintersTest(Messages.Request request)
        {
            string printerName = request.Parameters.Value <string>("printerName");

            Utils.ShellPrintTestDocument(printerName);
            return(request.Success(printerName));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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"));
        }
コード例 #7
0
        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));
        }
コード例 #8
0
 public static Messages.Response EpaymentSupportedProtocols(Messages.Request request)
 {
     return(request.Success(ConcertProtocol.SupportedProtocols()));
 }
コード例 #9
0
 public static Messages.Response SerialPortsList(Messages.Request request)
 {
     return(request.Success(SerialPort.GetPortNames()));
 }
コード例 #10
0
 public static Messages.Response CompanionExit(Messages.Request request)
 {
     NativeHost.StopService("Receveid request companion.exit");
     return(request.Success(true));
 }
コード例 #11
0
 public static Messages.Response CompanionPause(Messages.Request request)
 {
     Thread.Sleep(5000);
     return(request.Success("Had a nice pause !"));
 }
コード例 #12
0
        public static Messages.Response CompanionVersion(Messages.Request request)
        {
            Version version = Assembly.GetEntryAssembly().GetName().Version;

            return(request.Success(version.ToString()));
        }
コード例 #13
0
 public static Messages.Response Echo(Messages.Request request)
 {
     return(request.Success("Companion-echo : " + request.Parameters.ToString()));
 }
コード例 #14
0
 public static Messages.Response Ping(Messages.Request request)
 {
     return(request.Success("companion-pong"));
 }
コード例 #15
0
 public static Messages.Response PrintersList(Messages.Request request)
 {
     return(request.Success(PrinterSettings.InstalledPrinters));
 }