Create a bitmap signature from list of points
Beispiel #1
0
        protected string GetSignature()
        {
            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>";

            lock (pdcLock) {
                pdc_active = true;
            }
            string result = ax_control.ProcessTransaction(xml, 1, null, null);

            lock (pdcLock) {
                pdc_active = 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);

                int    ticks       = Environment.TickCount;
                string my_location = AppDomain.CurrentDomain.BaseDirectory;
                char   sep         = Path.DirectorySeparatorChar;
                while (File.Exists(my_location + sep + "ss-output/" + sep + ticks))
                {
                    ticks++;
                }
                string filename         = my_location + sep + "ss-output" + sep + "tmp" + sep + ticks + ".bmp";
                BitmapBPP.Signature sig = new BitmapBPP.Signature(filename, points);
                parent.MsgSend("TERMBMP" + ticks + ".bmp");
                if (rba != null)
                {
                    rba.showApproved();
                }
            } catch (Exception) {
                return(null);
            }

            return(null);
        }
Beispiel #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>");
        }
Beispiel #3
0
    protected string GetSignature()
    {
        string xml="<?xml version=\"1.0\"?>"
            + "<TStream>"
            + "<Transaction>"
            + "<MerchantID>MerchantID</MerchantID>"
            + "<TranCode>GetSignature</TranCode>"
            + "<SecureDevice>"+ this.device_identifier + "</SecureDevice>"
            + "<Account>"
            + "<AcctNo>SecureDevice</AcctNo>"
            + "</Account>"
            + "</Transaction>"
            + "</TStream>";
        string result = ax_control.ProcessTransaction(xml, 1, null, null);
        XmlDocument doc = new XmlDocument();
        try {
            doc.LoadXml(result);
            XmlNode status = doc.SelectSingleNode("RStream/CmdResponse/CmdStatus");
            if (status.Value != "Success") {
                return null;
            }
            string sigdata = doc.SelectSingleNode("RStream/Signature").Value;
            List<Point> points = SigDataToPoints(sigdata);

            int ticks = Environment.TickCount;
            string my_location = AppDomain.CurrentDomain.BaseDirectory;
            char sep = Path.DirectorySeparatorChar;
            while (File.Exists(my_location + sep + "ss-output/"  + sep + ticks)) {
                ticks++;
            }
            string filename = my_location + sep + "ss-output"+ sep + ticks + ".bmp";
            BitmapBPP.Signature sig = new BitmapBPP.Signature(filename, points);
            parent.MsgSend("TERMBMP" + ticks + ".bmp");
            
        } catch (Exception) {
            return null;
        }
        
        return null;
    }