Example #1
0
        public override void HandleMsg(string msg)
        {
            // optional predicate for "termSig" message
            // predicate string is displayed on sig capture screen
            if (msg.Length > 7 && msg.Substring(0, 7) == "termSig")
            {
                //sig_message = msg.Substring(7);
                msg = "termSig";
            }
            switch (msg)
            {
            case "termReset":
            case "termReboot":
                if (rba != null)
                {
                    rba.stubStop();
                }
                initDevice();
                break;

            case "termManual":
                break;

            case "termApproved":
                if (rba != null)
                {
                    rba.showApproved();
                }
                break;

            case "termSig":
                if (rba != null)
                {
                    rba.stubStop();
                }
                GetSignature();
                break;

            case "termGetType":
                break;

            case "termGetTypeWithFS":
                break;

            case "termGetPin":
                break;

            case "termWait":
                break;
            }
        }
Example #2
0
        protected string GetSignature(bool udp = true)
        {
            string xml = "<?xml version=\"1.0\"?>"
                         + "<TStream>"
                         + "<Transaction>"
                         + "<MerchantID>MerchantID</MerchantID>"
                         + "<TranCode>GetSignature</TranCode>"
                         + "<SecureDevice>" + this.device_identifier + "</SecureDevice>"
                         + "<ComPort>" + this.com_port + "</ComPort>"
                         + "<Account>"
                         + "<AcctNo>SecureDevice</AcctNo>"
                         + "</Account>"
                         + "</Transaction>"
                         + "</TStream>";

            PdcActive(true);
            Console.WriteLine(this.hideDialogs);
            string result = ax_control.ProcessTransaction(xml, this.hideDialogs, string.Empty, string.Empty);

            PdcActive(false);
            XmlDocument doc = new XmlDocument();

            try {
                doc.LoadXml(result);
                XmlNode status = doc.SelectSingleNode("RStream/CmdResponse/CmdStatus");
                if (status.InnerText != "Success")
                {
                    return(null);
                }
                string       sigdata = doc.SelectSingleNode("RStream/Signature").InnerText;
                List <Point> points  = SigDataToPoints(sigdata);

                string my_location      = AppDomain.CurrentDomain.BaseDirectory;
                char   sep              = Path.DirectorySeparatorChar;
                string ticks            = System.Guid.NewGuid().ToString();
                string filename         = my_location + sep + "ss-output" + sep + "tmp" + sep + ticks + ".bmp";
                BitmapBPP.Signature sig = new BitmapBPP.Signature(filename, points);
                if (udp)
                {
                    parent.MsgSend("TERMBMP" + ticks + ".bmp");
                }
                else
                {
                    return("<img>" + ticks + ".bmp</img>");
                }
                if (rba != null)
                {
                    rba.showApproved();
                }
            } catch (Exception ex) {
                this.LogMessage(ex.ToString());
            }

            return("<err>Error collecting signature</err>");
        }