Beispiel #1
0
        public string Notity()
        {
            string str = @"MTczNjY1NjgzOTIzMzU5
                |F+TZrzcmMkYfn+MCZtE8n8Baheymf3wCeQlN9pkICJZ0KA/+ukQeoSdJAhTCKj+AMkarxiS4GVax
                hoEl8wh894CKSK+AH+ZHXjfav96ntSi/yqk0K/yzznyoneASEA9t/J+87L5cjxYiEMpthTQ15D+q
                pgCkoqKrFVQOS9uzlb4=
                |JPyAiMWmzppINFr5rmTaFgpQ+IXIUiJ0CPs9GQmNhgN5Nm8aNAG/lV3DUaCXu9889E8louE7AvL2
                1EJ6buAvKHHtFJ7MMpMM2bIQnoTZ1Y0iJ7oVX5jqUo/meWANdj17wUiRe/0kkxD4u9OMEtPNFiu3
                qOjuOhmoxs4VcywFQ7REyNdpd8Ocm8bOFXMsBUO0e60qMhRzsjhWtmEc6uhWyUVMWlXZ2uNlvvcN
                caEDDUnIUSqu8+MzcCeCZzIwNdqoJpIDLCGEs2RRFtS/I7I1K0qO8nUqO/GMxw6AP+AoLmQqoXhJ
                GNBeAKhg+VLKF+GGIiwl6enlFFAgvvPNFRm/dw1k0hn/22ubqslGktnqkzUxdRA+nsfy96hg+VLK
                F+GGIiwl6enlFFDJnlBYjHfw3MqaQTLL/1g/OIpHlBvd/iaqyUaS2eqTNZUBcz5t6iDzxfh5jIv8
                Z8g4iWwtiAhKtaiAKhD3dGE9BOSM/NglAv25K4qseWvABZiVjMd/wYMDXBQwvInwL8s5GhIJPnh8
                yhb9OqD8Fw3RWMntlJKB3b9GDN4t1Yv3ekQNe9OsYyemEoLcLjCHXnDLdAh41JvvoGm0x1JW+Ab6
                fEY1h/KKRAgyRZ3RFCAY5UTD+QwlBRT57OOT6tpvtqIYJtH/ezfsVrTpsK+mlvOfLepVO7zE5LwE
                +RpeYqBAQC3qVTu8xOS8pOMonfzwHB4r15IJN5fFynWYlliYE7dtSZxKcO/o9zMjAxBQfwRzMbwv
                8iQRXa/RJaVhriSkVOqxGftwD/2HB9bT9sOjz8D84ZoCVLaVu2GxGftwD/2HB6skwUp8+xXDxMxx
                blf910WAjhRcuy/yvSu99wTQBhT6NJB/gPGfM4osv99SiHmjqrEZ+3AP/YcHIjlx/zhVBDTtDn5l
                J8I/TgpMCsnuu1249DxX35ShCf5B0hmsQ86tfbEZ+3AP/YcHm+IYmvu3o//6+ufRNDvVUObvqxC/
                3Yalmv6ZgK5zmHmxGftwD/2HB3ebi3WUOhc2JvFSg2JgNEZ+lOa+nJmdSwT5Gl5ioEBA21oWtNrG
                R9RdLhAZrVBVEmluUFCsLk/bkyB8F5Jz99MRtiyF0QhA4lEgcQqXoutD4rfGr4StJev3V5MqUx/8
                WwtsT7GEHkyEauwOQWu62L+dKq61NUVE5X7eEddnOhhYt16BPXqrnhlKwPL2u97vj64Mzv8NgnVw
                glj8cB5DQXvd8BU0wwIC9dkY2tFD31idpsncCSW9UJRneS1oA4CnLUimqx34E2cPVZyiua/iVbFH
                ZHzYhX7SofDND+yZvUv4Di5GBUyJJeY=";
            //var result = HttpWebClient.DoHttpRequest("http://localhost:1693/Notify/NegotiationNotify.ashx?ChannelID=93", str);
            var result = HttpWebClient.DoHttpRequest("  http://112.124.68.147:8181/Notify/NegotiationNotify.ashx?ChannelID=93", str);

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 订单号生成
        /// </summary>
        /// <returns></returns>
        public Order CreateOrderNo()
        {
            string url = "http://o2oapi.aladingyidong.com/OnlineShopping/data/Data.aspx?action=setOrderInfo&ReqContent={\"common\":{\"openId\":\"oxbbcjrc2RgSbCyYt_5fYMvmqqtE\",\"customerId\":\"e703dbedadd943abacf864531decdac1\",\"userId\":\"8a52e19010474d5283b224a38b4f0aa5\",\"locale\":null},\"special\":{\"qty\":1,\"totalAmount\":33,\"action\":\"setOrderInfo\",\"orderDetailList\":[{\"skuId\":\"\",\"salesPrice\":33,\"qty\":1}]}}";

            //Request Create Service
            return(HttpWebClient.DoHttpRequest(url, string.Empty).DeserializeJSONTo <Order>());
        }
Beispiel #3
0
        private string Pay()
        {
            PayRequest req = new PayRequest("173665683923359");

            req.AccBankCode    = "6222021001081623333";
            req.AccName        = "测试";
            req.Account        = "1";
            req.Amount         = "1";
            req.MerchantSerial = "100" + DateTime.Now.ToString("yyyyMMddhhddss") + "021";;
            req.Misc           = "xxxxxxxxxxxxxx";
            req.MsgExt         = "xxxxxxxxxxxxx";
            req.TransDesc      = "xxxxxxxxxxxxxxxxxxxxx";
            req.TransTime      = DateTime.Now.ToString("yyyyMMddhhmmss");

            string Parameters = "{\"ChannelId\":93,\"AppOrderID\":88,\"merchantId\":\"" + DateTime.Now.ToString("yyyyMMddhhmmsss") + "\""
                                + ",\"transTime\":\"" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "\""
                                + ",\"amount\":1,\"account\":\"6222021001081623939\",\"accName\":\"穆恒涛\",\"accBankCode\":\"10001\""
                                + "}";
            string str = "request={\"ClientID\":\"" + "e703dbedadd943abacf864531decdac1" + "\","
                         + "\"UserID\":\"" + "oUcanjlz0pGMW57Xm50-uiCqkPIc" + "\","
                         + "\"Token\":null,\"AppID\":1,"
                         + "\"Parameters\":" + Parameters + "}";
            var result = HttpWebClient.DoHttpRequest("http://112.124.68.147:8181/Gateway.ashx?action=Pay", str);

            return(result);
        }
Beispiel #4
0
        private string BatchPay()
        {
            string Parameters = "{\"ChannelId\":53,\"AppOrderID\":91,\"merchantId\":\"" + DateTime.Now.ToString("yyyyMMddhhmmsss") + "\""
                                + ",\"transTime\":\"" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "\""
                                + ",\"transList\":\"1,6222021208004387203,穆恒涛,10001,0,0,010102321458|2,6222021208004387203,穆恒涛,10001,0,0,010102321459\""
                                + "}";
            string str = "request={\"ClientID\":\"" + "e703dbedadd943abacf864531decdac1" + "\","
                         + "\"UserID\":\"" + "oUcanjlz0pGMW57Xm50-uiCqkPIc" + "\","
                         + "\"Token\":null,\"AppID\":1,"
                         + "\"Parameters\":" + Parameters + "}";
            var result = HttpWebClient.DoHttpRequest("http://115.29.10.228:8181/Gateway.ashx?action=BatchPay", str);

            return(result);
        }
Beispiel #5
0
        /// <summary>
        /// 调用API
        /// </summary>
        /// <param name="pQueryString">查询字符串</param>
        /// <param name="pPostContent">请求内容</param>
        /// <returns></returns>
        public static string CallAPI(string pQueryString, string pPostContent)
        {
            var url = APIClientProxy.URL;

            if (!string.IsNullOrWhiteSpace(pQueryString))
            {
                if (pQueryString.StartsWith("?"))
                {
                    pQueryString = pQueryString.Substring(1);
                }
                url = url + pQueryString;
            }
            var rsp = HttpWebClient.DoHttpRequest(url, pPostContent);

            return(rsp);
        }
Beispiel #6
0
        protected override EmptyResponseData ProcessRequest(APIRequest <SetCustomerPageSettingRP> pRequest)
        {
            EmptyResponseData rdata      = new EmptyResponseData();
            SysPageBLL        sysPageBLL = new SysPageBLL(this.CurrentUserInfo);

            for (int i = 0; i < pRequest.Parameters.Node.Length; i++)
            {
                int Res = sysPageBLL.SetCustomerPageSetting(CurrentUserInfo.ClientID, pRequest.Parameters.MappingId, pRequest.Parameters.PageKey, pRequest.Parameters.Node[i].ToString(), pRequest.Parameters.NodeValue[i].ToString(), CurrentUserInfo.UserID);
            }

            //发布到js文件里
            EmptyRequest commonRequest = new EmptyRequest();

            commonRequest.Parameters = new EmptyRequestParameter();
            commonRequest.UserID     = "";
            commonRequest.CustomerID = CurrentUserInfo.ClientID;
            commonRequest.OpenID     = "";
            commonRequest.Token      = Guid.NewGuid().ToString();
            commonRequest.ChannelId  = "";
            commonRequest.Locale     = "1";

            //发布
            var url = ConfigurationManager.AppSettings["interfacehost"] + "/ApplicationInterface/Gateway.ashx"; //正式

            //var url = "http://121.199.42.125:5012/Gateway.ashx";        //测试

            if (string.IsNullOrEmpty(url))
            {
                throw new Exception("未配置平台接口URL:interfacehost");
            }

            url += "?type=Product&action=WX.SysPage.CreateCustomerConfig";
            var postContent = string.Format("req={0}", commonRequest.ToJSON());
            var strAldRsp   = HttpWebClient.DoHttpRequest(url, postContent);
            var aldRsp      = strAldRsp.DeserializeJSONTo <CreateCustomerConfigReponse>();

            if (aldRsp == null || aldRsp.ResultCode != 0 || !aldRsp.IsSuccess)
            {
                throw new Exception("发布配置到文件失败");
            }

            return(rdata);
        }
        /// <summary>
        /// 设置商户自己的支付方式
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        public string SetPayChannel(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <SetPayChannel> >();

            if (rp.Parameters.AddPayChannelData.Length == 0)
            {
                throw new APIException("请求参数中缺少AddPayChannelData或值为空.")
                      {
                          ErrorCode = 121
                      };
            }
            var paymentTypeId = rp.Parameters.AddPayChannelData[0].PaymentTypeId;

            CheckCustomerMapping(paymentTypeId);//判断是否重复配置同类型支付信息

            var loggingSessionInfo             = new SessionManager().CurrentUserLoginInfo;
            var tPaymentTypeCustomerMappingBll = new TPaymentTypeCustomerMappingBLL(loggingSessionInfo);

            var customerId = loggingSessionInfo.ClientID;


            //获取该支付通道的信息
            var tPaymeentTypeCusMapEntity = tPaymentTypeCustomerMappingBll.QueryByEntity(new TPaymentTypeCustomerMappingEntity()
            {
                ChannelId  = Convert.ToString(rp.Parameters.AddPayChannelData[0].ChannelId),
                CustomerId = customerId
            }, null);

            //if (tPaymeentTypeCusMapEntity != null && tPaymeentTypeCusMapEntity.Length > 0)
            //{
            //    var payDeloyType = tPaymeentTypeCusMapEntity[0].PayDeplyType;

            //    //如果该支付通道之前为默认配置,将channelId设置为0,这样支付中心会生成一条新的数据
            //    if (payDeloyType == 0)
            //    {
            //        rp.Parameters.AddPayChannelData[0].ChannelId = 0;
            //    }
            //}

            var tPaymentTypeCustomerMappingEntityList =
                tPaymentTypeCustomerMappingBll.QueryByEntity(new TPaymentTypeCustomerMappingEntity()
            {
                PaymentTypeID = rp.Parameters.AddPayChannelData[0].PaymentTypeId,
                CustomerId    = customerId
            }, null);

            if (rp.Parameters.AddPayChannelData[0].PayType > 0) //非货到付款
            {
                var paychannelUrl = ConfigurationManager.AppSettings["payChannelUrl"];

                string reqs = "request" + pRequest;

                string str = "{\"ClientID\":\"" + loggingSessionInfo.ClientID + "\","
                             + "\"UserID\":\"" + loggingSessionInfo.UserID + "\","
                             + "\"Token\":null,\"AppID\":1,"
                             + "\"Parameters\":" + rp.Parameters.ToJSON() + "}";
                var result = HttpWebClient.DoHttpRequest(paychannelUrl + "Gateway.ashx?action=SetPayChannel", "request=" +
                                                         HttpUtility.UrlEncode(str));

                string loggerStr = paychannelUrl + "Gateway.ashx?action=SetPayChannel&" +
                                   str;
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = loggerStr
                });

                var channelList = result.DeserializeJSONTo <PayChannelReturnResult>();

                if (channelList.Datas == null)
                {
                    throw new APIException("创建失败:" + result)
                          {
                              ErrorCode = 122
                          };
                }

                if (channelList.Datas.PayChannelIdList[0].ChannelId == 0)
                {
                    throw new APIException("创建失败:" + result)
                          {
                              ErrorCode = 122
                          };
                }
                else
                {
                    if (tPaymentTypeCustomerMappingEntityList != null && tPaymentTypeCustomerMappingEntityList.Length > 0)
                    {
                        tPaymentTypeCustomerMappingBll.Delete(tPaymentTypeCustomerMappingEntityList);
                    }


                    var tPaymentTypeCustomerMappingEntity = new TPaymentTypeCustomerMappingEntity();

                    tPaymentTypeCustomerMappingEntity.MappingId     = Guid.NewGuid();
                    tPaymentTypeCustomerMappingEntity.CustomerId    = loggingSessionInfo.ClientID;
                    tPaymentTypeCustomerMappingEntity.PaymentTypeID = rp.Parameters.AddPayChannelData[0].PaymentTypeId;
                    tPaymentTypeCustomerMappingEntity.APPId         = "1";
                    tPaymentTypeCustomerMappingEntity.Currency      = 1;
                    tPaymentTypeCustomerMappingEntity.PayDeplyType  = 1;

                    tPaymentTypeCustomerMappingBll.Create(tPaymentTypeCustomerMappingEntity);


                    var payTypeId = rp.Parameters.AddPayChannelData[0].PayType;

                    var updateSql = "";
                    if (payTypeId == 1 || payTypeId == 2)
                    {
                        var unionPayData = rp.Parameters.AddPayChannelData[0].UnionPayData;

                        var merchantId                 = unionPayData.MerchantID;
                        var certificateFilePath        = unionPayData.CertificateFilePath;
                        var certificateFilePassword    = unionPayData.CertificateFilePassword;
                        var decryptCertificateFilePath = unionPayData.DecryptCertificateFilePath;
                        var packetEncryptKey           = unionPayData.PacketEncryptKey;

                        updateSql = "PayAccountNumber = '" + merchantId + "',"
                                    + "EncryptionCertificate = '" + certificateFilePath + "',"
                                    + "EncryptionPwd ='" + certificateFilePassword + "',"
                                    + "DecryptionCertificate ='" + decryptCertificateFilePath + "',"
                                    + "DecryptionPwd ='" + packetEncryptKey + "',"
                                    + "PayDeplyType=1";
                    }
                    if (payTypeId == 3 || payTypeId == 4)
                    {
                        var wapData = rp.Parameters.AddPayChannelData[0].WapData;

                        var partner           = wapData.Partner;
                        var sellerAccountName = wapData.SellerAccountName;
                        var RSA_PublicKey     = wapData.RSA_PublicKey;
                        var RSA_PrivateKey    = wapData.RSA_PrivateKey;
                        var MD5Key            = wapData.MD5Key;
                        var SCAN_AppID        = wapData.SCAN_AppID;
                        var PayEncryptedPwd   = wapData.PayEncryptedPwd;


                        updateSql = "PayAccountNumber ='" + partner + "',"
                                    + "PayAccounPublic='" + RSA_PublicKey + "',"
                                    + "PayPrivate='" + RSA_PrivateKey + "',"
                                    + "SalesTBAccess='" + sellerAccountName + "',"
                                    + "ApplyMD5Key='" + MD5Key + "',"
                                    + "EncryptionCertificate='" + SCAN_AppID + "',"
                                    + "PayEncryptedPwd='" + PayEncryptedPwd + "',"
                                    + "PayDeplyType=1";
                    }
                    if (payTypeId == 5 || payTypeId == 6)
                    {
                        var wxData = rp.Parameters.AddPayChannelData[0].WxPayData;
                        var appID  = wxData.AppID;
                        //var appSecret = wxData.AppSecret;
                        //var parnterID = wxData.ParnterID;
                        //var parnterKey = wxData.ParnterKey;
                        //var PaySignKey = wxData.PaySignKey;
                        var mch_id  = wxData.Mch_ID;
                        var signKey = wxData.SignKey;

                        updateSql = "AccountIdentity='" + appID + "',"
                                    //+ "PublicKey='" + appSecret + "',"
                                    //+ "TenPayIdentity='" + parnterID + "',"
                                    //+ "TenPayKey='" + parnterKey + "',"
                                    //+ "PayEncryptedPwd='" + PaySignKey + "',"
                                    + "TenPayIdentity='" + mch_id + "',"
                                    + "TenPayKey='" + signKey + "',"
                                    + "PayDeplyType=1";
                    }

                    tPaymentTypeCustomerMappingBll.UpdatePaymentMap(updateSql, channelList.Datas.PayChannelIdList[0].ChannelId + 1
                                                                    , rp.Parameters.AddPayChannelData[0].PaymentTypeId, customerId);
                }
            }
            else //货到付款
            {
                if (tPaymentTypeCustomerMappingEntityList != null && tPaymentTypeCustomerMappingEntityList.Length > 0)
                {
                    tPaymentTypeCustomerMappingBll.Delete(tPaymentTypeCustomerMappingEntityList);
                }


                var tPaymentTypeCustomerMappingEntity = new TPaymentTypeCustomerMappingEntity();

                tPaymentTypeCustomerMappingEntity.MappingId     = Guid.NewGuid();
                tPaymentTypeCustomerMappingEntity.CustomerId    = loggingSessionInfo.ClientID;
                tPaymentTypeCustomerMappingEntity.PaymentTypeID = rp.Parameters.AddPayChannelData[0].PaymentTypeId;
                tPaymentTypeCustomerMappingEntity.APPId         = "1";
                tPaymentTypeCustomerMappingEntity.Currency      = 1;
                tPaymentTypeCustomerMappingEntity.PayDeplyType  = 1;

                tPaymentTypeCustomerMappingBll.Create(tPaymentTypeCustomerMappingEntity);
            }
            var rd  = new EmptyResponseData();
            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }
Beispiel #8
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetBusinessBasisConfigRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo      = new SessionManager().CurrentUserLoginInfo;
            var customerBasicSettingBLL = new CustomerBasicSettingBLL(loggingSessionInfo);

            //ap库配置
            //var APloggingSessionInfo = Default.GetBSLoggingSession(loggingSessionInfo.ClientID, "1");
            //APloggingSessionInfo.CurrentLoggingManager.Connection_String = ConfigurationManager.AppSettings["Conn_ap"];
            //var t_customerBLL = new t_customerBLL(APloggingSessionInfo);


            #region 基础配置集合赋值
            var list = new List <CustomerBasicSettingEntity>();

            if (!string.IsNullOrWhiteSpace(para.CustomerShortName))
            {
                //var APCustomerData = t_customerBLL.GetByID(APloggingSessionInfo.ClientID);
                //if (APCustomerData != null)
                //{
                //    APCustomerData.customer_name = para.customer_name;
                //    t_customerBLL.Update(APCustomerData);
                //}

                list.Add(new CustomerBasicSettingEntity()
                {//商户简称
                    SettingCode  = "CustomerShortName",
                    SettingValue = para.CustomerShortName
                });
            }
            if (!string.IsNullOrWhiteSpace(para.WebLogo))
            {
                list.Add(new CustomerBasicSettingEntity()
                {//商户Logo
                    //SettingCode = "BusinessLogo",
                    SettingCode  = "WebLogo",
                    SettingValue = para.WebLogo
                });
            }
            if (!string.IsNullOrWhiteSpace(para.CustomerPhone))
            {
                list.Add(new CustomerBasicSettingEntity()
                {//客服电话
                    SettingCode  = "CustomerPhone",
                    SettingValue = para.CustomerPhone
                });
            }
            if (!string.IsNullOrWhiteSpace(para.ForwardingMessageTitle))
            {
                list.Add(new CustomerBasicSettingEntity()
                {//分享标题
                    //SettingCode = "ShareTitle",
                    SettingCode  = "ForwardingMessageTitle",
                    SettingValue = para.ForwardingMessageTitle
                });
            }
            if (!string.IsNullOrWhiteSpace(para.ForwardingMessageLogo))
            {
                list.Add(new CustomerBasicSettingEntity()
                {//分享图片
                    //SettingCode = "ShareImageUrl",
                    SettingCode  = "ForwardingMessageLogo",
                    SettingValue = para.ForwardingMessageLogo
                });
            }
            if (!string.IsNullOrWhiteSpace(para.ForwardingMessageSummary))
            {
                list.Add(new CustomerBasicSettingEntity()
                {//分享摘要内容
                    //SettingCode = "ShareContent",
                    SettingCode  = "ForwardingMessageSummary",
                    SettingValue = para.ForwardingMessageSummary
                });
            }
            if (!string.IsNullOrWhiteSpace(para.GuideLinkUrl))
            {
                list.Add(new CustomerBasicSettingEntity()
                {//引导链接
                    SettingCode  = "GuideLinkUrl",
                    SettingValue = para.GuideLinkUrl
                });
            }
            if (!string.IsNullOrWhiteSpace(para.GuideQRCode))
            {
                list.Add(new CustomerBasicSettingEntity()
                {//引导二维码
                    SettingCode  = "GuideQRCode",
                    SettingValue = para.GuideQRCode
                });
            }
            if (!string.IsNullOrWhiteSpace(para.CustomerGreeting))
            {
                list.Add(new CustomerBasicSettingEntity()
                {//客服欢迎语
                    SettingCode  = "CustomerGreeting",
                    SettingValue = para.CustomerGreeting
                });
            }
            else
            {
                list.Add(new CustomerBasicSettingEntity()
                {//客服欢迎语
                    SettingCode  = "CustomerGreeting",
                    SettingValue = "感谢您关注" + para.CustomerShortName + "!您的支持是我们无限的动力~",
                });
            }
            #endregion
            if (list.Count > 0)
            {
                customerBasicSettingBLL.SaveCustomerBasicInfo(loggingSessionInfo.ClientID, list);
            }



            //发布到js文件里
            EmptyRequest commonRequest = new EmptyRequest();
            commonRequest.Parameters = new EmptyRequestParameter();
            commonRequest.UserID     = "";
            commonRequest.CustomerID = CurrentUserInfo.ClientID;
            commonRequest.OpenID     = "";
            commonRequest.Token      = Guid.NewGuid().ToString();
            commonRequest.ChannelId  = "";
            commonRequest.Locale     = "1";

            //发布
            var url = ConfigurationManager.AppSettings["interfacehost"] + "/ApplicationInterface/Gateway.ashx";  //正式
            //var url = "http://121.199.42.125:5012/Gateway.ashx";        //测试

            if (string.IsNullOrEmpty(url))
            {
                throw new Exception("未配置平台接口URL:interfacehost");
            }

            url += "?type=Product&action=WX.SysPage.CreateCustomerConfig";
            var postContent = string.Format("req={0}", commonRequest.ToJSON());
            var strAldRsp   = HttpWebClient.DoHttpRequest(url, postContent);
            var aldRsp      = strAldRsp.DeserializeJSONTo <CreateCustomerConfigReponse>();

            if (aldRsp == null || aldRsp.ResultCode != 0 || !aldRsp.IsSuccess)
            {
                throw new Exception("发布配置到文件失败");
            }


            return(rd);
        }
        public string GetTradeCenterPay(string pRequest)
        {
            ReqTradeCenterPay entity = pRequest.DeserializeJSONTo <ReqTradeCenterPay>();
            var    rsp     = new SuccessResponse <IAPIResponseData>();
            string SeriaNo = DateTime.Now.ToString("yyyyMMddhhmmss");
            string result  = string.Empty;

            try
            {
                var    loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
                string Key = "";
                if (!string.IsNullOrEmpty(entity.Parameters.SeriaNo))
                {
                    Key = entity.Parameters.SeriaNo;
                }
                string  Parameters = "";
                var     bll        = new CustomerWithdrawalBLL(loggingSessionInfo);
                DataSet ds         = bll.GetTradeCenterPay(Key);
                if (ds == null || ds.Tables.Count < 2)
                {
                    return("");
                }
                if (ds.Tables[1] == null || ds.Tables[1].Rows.Count < 1)
                {
                    rsp.ResultCode = 00001;
                    rsp.Message    = "无可代付数据";
                    return(rsp.ToJSON());
                }
                if (ds.Tables[0] == null || ds.Tables[0].Rows.Count < 1)
                {
                    rsp.ResultCode = 00001;
                    rsp.Message    = "无客户信息";
                    return(rsp.ToJSON());
                }
                Parameters = GetXml(ds.Tables[0], ds.Tables[1], SeriaNo, Key);
                string str = "request={\"ClientID\":\"" + loggingSessionInfo.ClientID + "\","
                             + "\"UserID\":\"" + loggingSessionInfo.UserID + "\","
                             + "\"Token\":null,\"AppID\":1,"
                             + "\"Parameters\":" + Parameters + "}";

                string url = ConfigurationManager.AppSettings["TradeCenterPayUrl"];

                if (string.IsNullOrEmpty(Key))
                {
                    result = HttpWebClient.DoHttpRequest(url + "?action=BatchPay", str);
                }
                else
                {
                    result = HttpWebClient.DoHttpRequest(url + "?action=Pay", str);
                }
                ResTradeCenterPay req = result.DeserializeJSONTo <ResTradeCenterPay>();
                if (req.ResultCode == "0")
                {
                    if (req.Datas.ResultCode == "0000")
                    {
                        SetCustomerWithdrawal(Key);
                        string pRes = CreateCustomerWithdrawalTransfer(SeriaNo, str, ds.Tables[1], 40);
                        return(result);
                    }
                    rsp.ResultCode = 00001;
                    rsp.Message    = req.Datas.Message;
                    return(rsp.ToJSON());
                }
                else
                {
                    string pRes = CreateCustomerWithdrawalTransfer(SeriaNo, str, ds.Tables[1], 0);
                }
            }
            catch (Exception)
            {
                rsp.ResultCode = 00001;
                rsp.Message    = "错误";
                return(rsp.ToJSON());
            }
            return(result);
        }