Ejemplo n.º 1
0
        public static string wtRefund(Dictionary <string, string> list, string secondShopNo)
        {
            string _2 = list["2"], _4 = list["4"], _59 = list["59"];
            string theOrderNo = Wanton.GetOrderNo();
            string termailNo  = SysConfigHelper.readerNode("ClientNo");
            string shopNo     = SysConfigHelper.readerNode("ShopNo");
            Dictionary <string, string> map = new Dictionary <string, string>();

            Dictionary <int, string> data = new Dictionary <int, string>();

            data.Add(2, _2);
            data.Add(3, "200000");
            data.Add(4, wtPayUtils.ConvertMoney(_4));
            data.Add(11, theOrderNo);
            map.Add("11", data[11]);

            data.Add(22, "051");
            data.Add(25, "00");
            data.Add(41, termailNo);
            map.Add("41", data[41]);

            data.Add(42, shopNo);
            data.Add(48, "TC_ONE|Y00000001|" + secondShopNo);
            //data.Add(48, "Y00000001");
            data.Add(49, "156");
            data.Add(59, _59);
            data.Add(60, "22000003000");
            data.Add(63, "01");

            byte[] countMacData = EncryptWT.countMacData("0200", EncryptWT.encryptLKL(data, null));

            byte[] mac = PasswordBLL.GetMac(2, countMacData);

            byte[] sendData = EncryptWT.EncryptData("0200", "6000000000", EncryptWT.encryptLKL(data, mac));


            //byte[] sendData = EncryptWT.EncryptData("0200", "6000000000", EncryptWT.encryptLKL(data, calculateMac(data, "0200")));
            Console.WriteLine();
            Console.WriteLine(BCDUtil.byteArrToString(sendData));
            return(BCDUtil.byteArrToString(sendData));
        }
Ejemplo n.º 2
0
        public static Dictionary <string, string> refund(string _2, string _4, string _59, TradeRecord tradeRecord, string secondShopNo)
        {
            string theOrderNo = Wanton.GetOrderNo();
            string termailNo  = SysConfigHelper.readerNode("ClientNo");
            string shopNo     = SysConfigHelper.readerNode("ShopNo");

            tradeRecord.amount         = _4;
            tradeRecord.batch_no       = "" + "|" + SysBLL.getMMDDHHMMSSTime() + "|" + _2;
            tradeRecord.order_no       = theOrderNo;
            tradeRecord.termail_no     = termailNo;
            tradeRecord.lkl_wt_shop_no = shopNo;
            Dictionary <string, string> map = new Dictionary <string, string>();

            Dictionary <int, string> data = new Dictionary <int, string>();

            data.Add(2, _2);
            data.Add(3, "200000");
            data.Add(4, wtPayUtils.ConvertMoney(_4));
            data.Add(11, theOrderNo);
            map.Add("11", data[11]);

            data.Add(22, "051");
            data.Add(25, "00");
            data.Add(41, termailNo);
            map.Add("41", data[41]);

            data.Add(42, shopNo);
            data.Add(48, "TC_ONE|Y00000001|" + secondShopNo);
            //data.Add(48, "Y00000001");
            data.Add(49, "156");
            data.Add(59, _59);
            data.Add(60, "22000003000");
            data.Add(63, "01");

            byte[] countMacData = EncryptWT.countMacData("0200", EncryptWT.encryptLKL(data, null));

            byte[] mac = PasswordBLL.GetMac(2, countMacData);

            byte[] sendData = EncryptWT.EncryptData("0200", "6000000000", EncryptWT.encryptLKL(data, mac));


            //byte[] sendData = EncryptWT.EncryptData("0200", "6000000000", EncryptWT.encryptLKL(data, calculateMac(data, "0200")));
            Console.WriteLine();
            Console.WriteLine(BCDUtil.byteArrToString(sendData));
            AnalysisBaseWT lk = new AnalysisBaseWT();

            byte[] result = Client(LakalaIp, LakalaPort, sendData);

            //接收的数据
            string receiveStr1 = BCDUtil.byteArrToString(result);

            log.Write("tuikuan的数据:" + receiveStr1);

            Dictionary <string, ResultData> ret = lk.analysis(result);


            string recode = Wanton.handleDataMac(ret); //发送数据

            if ("00".Equals(recode))
            {
                tradeRecord.lkl_wt_state = "1";
                tradeRecord.order_state  = "1";
            }
            else
            {
                tradeRecord.lkl_wt_state = "2";
                tradeRecord.order_state  = "0";
            }
            //发送的数据
            string sendStr = BCDUtil.byteArrToString(sendData);
            //接收的数据
            string receiveStr = BCDUtil.byteArrToString(result);

            map.Add("recode", recode);
            map.Add("sendStr", sendStr);
            map.Add("receiveStr", receiveStr);
            map.Add("ShopNo", data[11] + "|" + data[41] + "|" + data[42]);

            map.Add("39", ret["39"].value);

            log.Write("万通卡退款交易返回" + ret["39"].value);


            string serialStr = JsonConvert.SerializeObject(map);

            tradeRecord.data_id = serialStr;
            TradeBLL.SendOrderRefundRecord(tradeRecord);

            return(map);


            //if (result.Length > 0)
            //{
            //    return lk.analysis(result); //发送数据
            //}
            //else
            //{
            //    return null;
            //}
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 冲正
        /// </summary>
        /// <returns></returns>
        public static Dictionary <string, string> correct(WintopPayParam param, string secondShopNo)
        {
            try
            {
                string termailNo = SysConfigHelper.readerNode("ClientNo");

                Dictionary <string, string> map = new Dictionary <string, string>();

                Dictionary <int, string> data = new Dictionary <int, string>();
                data.Add(2, param.wintopNo);
                data.Add(3, "000000");
                data.Add(4, wtPayUtils.ConvertMoney(param.price));
                data.Add(11, param.orderNo);
                map.Add("11", data[11]);


                data.Add(25, "00");
                data.Add(39, "17");
                data.Add(41, termailNo);
                map.Add("41", data[41]);

                data.Add(42, SysConfigHelper.readerNode("ShopNo"));

                data.Add(48, "TC_ONE|Y00000001|" + secondShopNo);
                //data.Add(48, "Y00000001");
                data.Add(49, "156");
                data.Add(63, "01");

                byte[] countMacData = EncryptWT.countMacData("0400", EncryptWT.encryptLKL(data, null));

                byte[] mac = PasswordBLL.GetMac(2, countMacData);

                byte[] sendData = EncryptWT.EncryptData("0400", "6000000000", EncryptWT.encryptLKL(data, mac));

                //发送的数据
                string sendStr = BCDUtil.byteArrToString(sendData);
                log.Write("发送冲正的数据:" + sendStr);

                //byte[] sendData = EncryptWT.EncryptData("0400", "6000000000", EncryptWT.encryptLKL(data, calculateMac(data, "0400")));
                Console.WriteLine(BCDUtil.byteArrToString(sendData));
                AnalysisBaseWT lk     = new AnalysisBaseWT();
                byte[]         result = Client(LakalaIp, LakalaPort, sendData);
                string         recode = Wanton.handleDataMac(lk.analysis(result)); //发送数据

                //接收的数据
                string receiveStr = BCDUtil.byteArrToString(result);
                log.Write("接收冲正的数据:" + result);
                map.Add("recode", recode);
                map.Add("sendStr", sendStr);
                map.Add("receiveStr", receiveStr);
                map.Add("ShopNo", param.orderNo + "|" + data[41] + "|" + data[42]);
                map.Add("money", param.price);


                string serialStr = JsonConvert.SerializeObject(map);
                return(map);
            }
            catch (Exception e)
            {
                return(new Dictionary <string, string>());
            }
        }
Ejemplo n.º 4
0
        public static Dictionary <string, string> pay(WintopPayParam param, string secondShopNo)
        {
            try
            {
                Dictionary <string, string> map = new Dictionary <string, string>();

                Dictionary <int, string> data = new Dictionary <int, string>();
                data.Add(2, param.wintopNo);                       //万通卡号
                data.Add(3, "000000");
                data.Add(4, wtPayUtils.ConvertMoney(param.price)); //交易金额
                data.Add(11, param.orderNo);                       //POS终端交易流水
                map.Add("11", data[11]);


                data.Add(25, "00");
                data.Add(41, SysConfigHelper.readerNode("ClientNo"));//终端代码
                map.Add("41", data[41]);

                data.Add(42, SysConfigHelper.readerNode("ShopNo")); //商户代码
                data.Add(48, "TC_ONE|Y00000001|" + secondShopNo);   //data.Add(48, "TC_ONE|Y00000001|"+secondShopNo);
                //data.Add(48, "Y00000001");
                data.Add(49, "156");
                data.Add(62, param.pwd);//明文,卡号
                data.Add(63, "01");

                byte[] countMacData = EncryptWT.countMacData("0200", EncryptWT.encryptLKL(data, null));

                byte[] mac = PasswordBLL.GetMac(2, countMacData);

                byte[] sendData = EncryptWT.EncryptData("0200", "6000000000", EncryptWT.encryptLKL(data, mac));

                //发送的数据
                string sendStr = BCDUtil.byteArrToString(sendData);
                log.Write("发送支付的数据:" + sendStr);

                //Console.WriteLine();
                //Console.WriteLine(BCDUtil.byteArrToString(sendData));
                AnalysisBaseWT lk     = new AnalysisBaseWT();
                byte[]         result = Client(LakalaIp, LakalaPort, sendData);

                //接收的数据
                string receiveStr = BCDUtil.byteArrToString(result);
                log.Write("接收支付的数据:" + receiveStr);

                Dictionary <string, ResultData> ret = lk.analysis(result);
                string recode = Wanton.handleDataMac(ret); //发送数据
                log.Write("支付返回码:" + recode);
                if ("00".Equals(recode))
                {
                }
                else if ("A0".Equals(recode))
                {
                    DeviceState.SendState("333333");
                }
                else
                {
                }
                map.Add("recode", recode);
                map.Add("sendStr", sendStr);
                map.Add("receiveStr", receiveStr);
                map.Add("ShopNo", param.orderNo + "|" + data[41] + "|" + data[42]);
                map.Add("money", param.price);

                if (ret.ContainsKey("2"))
                {
                    map.Add("2", ret["2"].value);
                }

                map.Add("4", param.price);

                if (ret.ContainsKey("59"))
                {
                    map.Add("59", ret["59"].value);
                    map.Add("cloudOrderNo", ret["59"].value);
                }

                string serialStr = JsonConvert.SerializeObject(map);



                return(map);
            }
            catch (WtException e)
            {
                throw e;
            }

            catch (Exception e)
            {
                throw new WtException(WtExceptionCode.Bus.WT_PAY, e.Message);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 退款
        /// </summary>
        /// <returns></returns>
        public static Dictionary <string, string> refund(WintopPayParam param, string _59, string secondShopNo)
        {
            string theOrderNo = Wanton.GetOrderNo();
            string termailNo  = SysConfigHelper.readerNode("ClientNo");


            Dictionary <string, string> map = new Dictionary <string, string>();

            Dictionary <int, string> data = new Dictionary <int, string>();

            data.Add(2, param.wintopNo);
            data.Add(3, "200000");
            data.Add(4, wtPayUtils.ConvertMoney(param.price));
            data.Add(11, getHHMMSS());
            map.Add("11", data[11]);

            data.Add(22, "051");
            data.Add(25, "00");
            data.Add(41, SysConfigHelper.readerNode("ClientNo"));
            map.Add("41", data[41]);

            data.Add(42, SysConfigHelper.readerNode("ShopNo"));
            data.Add(48, "TC_ONE|Y00000001|" + secondShopNo);
            //data.Add(48, "Y00000001");
            data.Add(49, "156");
            data.Add(59, _59);
            data.Add(60, "22000003000");
            data.Add(63, "01");

            byte[] countMacData = EncryptWT.countMacData("0200", EncryptWT.encryptLKL(data, null));

            byte[] mac = PasswordBLL.GetMac(2, countMacData);

            byte[] sendData = EncryptWT.EncryptData("0200", "6000000000", EncryptWT.encryptLKL(data, mac));

            string sendStr = BCDUtil.byteArrToString(sendData);

            log.Write("发送退款的数据:" + sendStr);

            //byte[] sendData = EncryptWT.EncryptData("0200", "6000000000", EncryptWT.encryptLKL(data, calculateMac(data, "0200")));
            Console.WriteLine();
            Console.WriteLine(BCDUtil.byteArrToString(sendData));
            AnalysisBaseWT lk = new AnalysisBaseWT();

            byte[] result = Client(LakalaIp, LakalaPort, sendData);

            //result
            string resultstr = BCDUtil.byteArrToString(result);

            log.Write("接收退款的数据:" + resultstr);



            string recode = Wanton.handleDataMac(lk.analysis(result)); //发送数据

            log.Write("万通退款结果" + recode);

            string serialStr = JsonConvert.SerializeObject(map);


            //接收的数据
            string receiveStr = BCDUtil.byteArrToString(result);

            map.Add("recode", recode);
            map.Add("sendStr", sendStr);
            map.Add("receiveStr", receiveStr);
            map.Add("ShopNo", param.orderNo + "|" + data[41] + "|" + data[42]);
            map.Add("money", param.price);
            return(map);


            //if (result.Length > 0)
            //{
            //    return lk.analysis(result); //发送数据
            //}
            //else
            //{
            //    return null;
            //}
        }